@zohodesk/testinglibrary 0.4.24-experimental → 0.4.25-experimental
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/build/core/playwright/builtInFixtures/page.js +34 -45
- package/build/core/playwright/helpers/auth/loginSteps.js +2 -3
- package/build/core/playwright/setup/config-creator.js +3 -2
- package/npm-shrinkwrap.json +2449 -1581
- package/package.json +4 -3
- package/playwright.config.js +0 -48
- package/unit_reports/unit-report.html +0 -260
package/README.md
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
7
|
var _auth = require("../helpers/auth");
|
|
9
|
-
var _getUrlOrigin = _interopRequireDefault(require("../helpers/auth/getUrlOrigin"));
|
|
10
8
|
var _readConfigFile = require("../readConfigFile");
|
|
11
9
|
/* eslint-disable global-require */
|
|
12
10
|
|
|
@@ -50,12 +48,10 @@ async function performDefaultPageSteps({
|
|
|
50
48
|
}
|
|
51
49
|
}
|
|
52
50
|
async function verifyPageIsLoaded(page) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (urlOrigin === domainOrigin) {
|
|
56
|
-
return true;
|
|
51
|
+
if (testSetup.verify && typeof testSetup.verify === 'function') {
|
|
52
|
+
return await testSetup.verify(page);
|
|
57
53
|
}
|
|
58
|
-
return
|
|
54
|
+
return true;
|
|
59
55
|
}
|
|
60
56
|
var _default = exports.default = {
|
|
61
57
|
page: async ({
|
|
@@ -63,45 +59,38 @@ var _default = exports.default = {
|
|
|
63
59
|
$tags,
|
|
64
60
|
page
|
|
65
61
|
}, use) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//This block is used to skip the login process if the @unauthenticated tag is added to the script
|
|
75
|
-
if ($tags.includes('@unauthenticated')) {
|
|
76
|
-
await context.clearCookies();
|
|
77
|
-
await use(page);
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
const testPortalDetails = getCustomAccountDetails($tags);
|
|
81
|
-
if (testPortalDetails === null) {
|
|
82
|
-
await performDefaultPageSteps({
|
|
83
|
-
context,
|
|
84
|
-
$tags,
|
|
85
|
-
page
|
|
86
|
-
});
|
|
87
|
-
const user = (0, _auth.getDefaultActor)();
|
|
88
|
-
process.env.actorInfo = JSON.stringify(user);
|
|
89
|
-
await use(page);
|
|
90
|
-
} else {
|
|
91
|
-
await context.clearCookies();
|
|
62
|
+
try {
|
|
63
|
+
//This block is used to skip the login process if the @unauthenticated tag is added to the script
|
|
64
|
+
if ($tags.includes('@unauthenticated')) {
|
|
65
|
+
await context.clearCookies();
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
92
68
|
const {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
69
|
+
isAuthMode
|
|
70
|
+
} = (0, _readConfigFile.generateConfigFromFile)();
|
|
71
|
+
if (!isAuthMode) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const testPortalDetails = getCustomAccountDetails($tags);
|
|
75
|
+
if (testPortalDetails != null) {
|
|
76
|
+
await context.clearCookies();
|
|
77
|
+
const {
|
|
78
|
+
email,
|
|
79
|
+
password
|
|
80
|
+
} = testPortalDetails;
|
|
81
|
+
await (0, _auth.performLoginSteps)({
|
|
82
|
+
page,
|
|
83
|
+
authFilePrefix: email,
|
|
84
|
+
useremail: email,
|
|
85
|
+
password: password
|
|
86
|
+
}, async () => {
|
|
87
|
+
return await verifyPageIsLoaded(page);
|
|
88
|
+
}, testSetup.login);
|
|
89
|
+
process.env.actorInfo = JSON.stringify(testPortalDetails);
|
|
90
|
+
}
|
|
91
|
+
} catch (error) {
|
|
92
|
+
console.error('Error during page', error);
|
|
93
|
+
} finally {
|
|
105
94
|
await performDefaultPageSteps({
|
|
106
95
|
context,
|
|
107
96
|
$tags,
|
|
@@ -8,7 +8,6 @@ exports.default = void 0;
|
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
var _fileMutex = _interopRequireDefault(require("../fileMutex"));
|
|
10
10
|
var _fileMutexConfig = require("../../constants/fileMutexConfig");
|
|
11
|
-
var _accountLogin = _interopRequireDefault(require("./accountLogin"));
|
|
12
11
|
var _checkAuthCookies = require("./checkAuthCookies");
|
|
13
12
|
var _checkAuthDirectory = require("../checkAuthDirectory");
|
|
14
13
|
/* eslint-disable no-console */
|
|
@@ -18,7 +17,7 @@ async function performLoginSteps({
|
|
|
18
17
|
authFilePrefix,
|
|
19
18
|
useremail,
|
|
20
19
|
password
|
|
21
|
-
}, isLoggedIn) {
|
|
20
|
+
}, isLoggedIn, accountLogin) {
|
|
22
21
|
const authFile = _path.default.resolve(_path.default.join((0, _checkAuthCookies.getAuthFileDirectory)(), `${authFilePrefix}-cookies.json`));
|
|
23
22
|
const lockFileName = useremail.replace(/[@.]/g, '_');
|
|
24
23
|
const fileMutex = new _fileMutex.default((0, _checkAuthDirectory.getLockDirectoryPath)(), lockFileName, _fileMutexConfig.LOGIN_MUTEX_TIMEOUT);
|
|
@@ -29,7 +28,7 @@ async function performLoginSteps({
|
|
|
29
28
|
await Promise.race([page.waitForNavigation(), page.waitForLoadState('networkidle'), page.waitForTimeout(5000)]);
|
|
30
29
|
const isAlreadyLoggedIn = await isLoggedIn(page);
|
|
31
30
|
if (!isAlreadyLoggedIn) {
|
|
32
|
-
await (
|
|
31
|
+
await accountLogin(page, useremail, password);
|
|
33
32
|
await page.goto(process.env.domain);
|
|
34
33
|
await isLoggedIn(page);
|
|
35
34
|
await page.context().storageState({
|
|
@@ -25,7 +25,8 @@ const {
|
|
|
25
25
|
featureFilesFolder,
|
|
26
26
|
stepDefinitionsFolder,
|
|
27
27
|
testIdAttribute,
|
|
28
|
-
globalTimeout
|
|
28
|
+
globalTimeout,
|
|
29
|
+
customReporter
|
|
29
30
|
} = uatConfig;
|
|
30
31
|
const projects = (0, _configUtils.getProjects)({
|
|
31
32
|
browsers,
|
|
@@ -57,7 +58,7 @@ function getPlaywrightConfig() {
|
|
|
57
58
|
globalTimeout: globalTimeout || 3600000,
|
|
58
59
|
outputDir: _path.default.join(process.cwd(), 'uat', 'test-results'),
|
|
59
60
|
fullyParallel: true,
|
|
60
|
-
reporter: [['html', {
|
|
61
|
+
reporter: [customReporter ? customReporter : ['line'], ['html', {
|
|
61
62
|
outputFolder: reportPath,
|
|
62
63
|
open: openReportOn
|
|
63
64
|
}], ['list'], ['./custom-reporter.js']],
|