@spscommerce/e2e-core 2.2.14 → 2.3.0
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 +1 -3
- package/lib/globalSetup.js +13 -5
- package/lib/globalSetup.js.map +1 -1
- package/lib/globalTeardown.js +2 -2
- package/lib/globalTeardown.js.map +1 -1
- package/package.json +1 -1
- package/playwright.config.js +31 -11
- package/src/globalSetup.ts +15 -5
- package/src/globalTeardown.ts +2 -2
package/README.md
CHANGED
|
@@ -77,9 +77,7 @@ If CI is set to true, the forbidOnly and maxFailures options are applied.
|
|
|
77
77
|
- maxFailures: Stop test suite execution after reaching 5 failed tests and skip any tests that were not executed yet.
|
|
78
78
|
|
|
79
79
|
### Authentication
|
|
80
|
-
Authentication flow was implemented in the e2e-core library. When tests are
|
|
81
|
-
> Attention:
|
|
82
|
-
> While local debugging, the storageState might get expired. User will be redirected to the login page. If it happens, please delete an auth folder in order to invoke an auth state again.
|
|
80
|
+
Authentication flow was implemented in the e2e-core library. When tests are launnhed for the first time, it takes some time for the authentication state to be invoked. If ENV variable is not set, the storageState is created for the test environment, otherwise set URL to 'prod'. After auth state is invoked, it appears in the results-e2e/auth folder. All the next test runs will use an already created storageState.json file.
|
|
83
81
|
|
|
84
82
|
### Global setup
|
|
85
83
|
To set something up once before running all tests, create a JS file and link it via SETUP_PATH variable in the `package.json`. Global setup file must export a single function that runs once before all the tests.
|
package/lib/globalSetup.js
CHANGED
|
@@ -30,7 +30,14 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
30
30
|
const path_1 = __importDefault(require("path"));
|
|
31
31
|
const test_1 = require("@playwright/test");
|
|
32
32
|
const domain = 'commerce.spscommerce.com';
|
|
33
|
-
|
|
33
|
+
let baseUrl = 'https://test.' + domain;
|
|
34
|
+
let storageFile = path_1.default.join(process.cwd(), `results-e2e/auth/storageStateTest.json`);
|
|
35
|
+
let traceFile = path_1.default.join(process.cwd(), 'results-e2e/auth/globalSetupTest.zip');
|
|
36
|
+
if (process.env.ENV && process.env.ENV.includes('prod')) {
|
|
37
|
+
baseUrl = 'https://' + domain;
|
|
38
|
+
storageFile = path_1.default.join(process.cwd(), `results-e2e/auth/storageStateProd.json`);
|
|
39
|
+
traceFile = path_1.default.join(process.cwd(), 'results-e2e/auth/globalSetupProd.zip');
|
|
40
|
+
}
|
|
34
41
|
async function globalSetup() {
|
|
35
42
|
// Remove custom sub-folders for test artifacts
|
|
36
43
|
const resultsFolder = path_1.default.join(process.cwd(), 'results-e2e/');
|
|
@@ -41,10 +48,11 @@ async function globalSetup() {
|
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
|
-
// Launch browser and log in if storageState.json does not exist
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
// Launch browser and log in if storageState.json does not exist OR auth expires soon
|
|
52
|
+
const currentTS = new Date().getTime();
|
|
53
|
+
if (!fs_1.default.existsSync(storageFile) ||
|
|
54
|
+
(fs_1.default.existsSync(storageFile) &&
|
|
55
|
+
((JSON.parse(fs_1.default.readFileSync(storageFile, 'utf8')).origins[0].localStorage.find(o => o.name === 'expires_at').value - currentTS) / 60000) < 30)) {
|
|
48
56
|
const browser = await test_1.chromium.launch({ headless: false }); // { headless: false }
|
|
49
57
|
const context = await browser.newContext();
|
|
50
58
|
await context.tracing.start({ screenshots: true, snapshots: true });
|
package/lib/globalSetup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalSetup.js","sourceRoot":"","sources":["../src/globalSetup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,2CAA4C;AAE5C,MAAM,MAAM,GAAG,0BAA0B,CAAC;AAC1C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,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MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YACrC,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;YACzC,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE;gBACnC,MAAM,IAAI,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;aAC7C;YACD,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;YACnC,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;SAC5D;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACf,MAAM,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;SACxE;QACD,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;KACzB;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;QACxB,IAAI,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YACvC,wDAAa,OAAO,CAAC,GAAG,CAAC,UAAU,GAAC,CAAC;SACxC;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,aAAa,CAAC,CAAC;SAC3D;KACJ;IACD,OAAO;AACX,CAAC;AA9CD,8BA8CC"}
|
package/lib/globalTeardown.js
CHANGED
|
@@ -13,8 +13,8 @@ async function globalTeardown() {
|
|
|
13
13
|
for (const oldSubFolder of fs_1.default.readdirSync(oldFolder)) {
|
|
14
14
|
for (const oldFile of fs_1.default.readdirSync(path_1.default.join(oldFolder, oldSubFolder))) {
|
|
15
15
|
const oldFilePath = `${oldFolder}/${oldSubFolder}/${oldFile}`;
|
|
16
|
-
const newFile = "SPS_" + oldSubFolder
|
|
17
|
-
.indexOf("SPS
|
|
16
|
+
const newFile = "SPS_" + oldSubFolder
|
|
17
|
+
.substring(oldSubFolder.indexOf("SPS") + 4)
|
|
18
18
|
.split('-')
|
|
19
19
|
.filter(e => !e.includes(process.env.BROWSER) && !e.includes('chromium') && !e.includes('retry'))
|
|
20
20
|
.join('_')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalTeardown.js","sourceRoot":"","sources":["../src/globalTeardown.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAET,KAAK,UAAU,cAAc;IACxC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,0BAA0B,CAAC,CAAC;IACvE,YAAE,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,IAAI,YAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC1B,KAAK,MAAM,YAAY,IAAI,YAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;YAClD,KAAK,MAAM,OAAO,IAAI,YAAE,CAAC,WAAW,CAAC,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC,EAAE;gBACtE,MAAM,WAAW,GAAG,GAAG,SAAS,IAAI,YAAY,IAAI,OAAO,EAAE,CAAC;gBAC9D,MAAM,OAAO,GAAG,MAAM,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"globalTeardown.js","sourceRoot":"","sources":["../src/globalTeardown.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAET,KAAK,UAAU,cAAc;IACxC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC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BC"}
|
package/package.json
CHANGED
package/playwright.config.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const { devices } = require('@playwright/test');
|
|
2
3
|
|
|
3
4
|
if (process.env.CONFIG_PATH) {
|
|
4
5
|
require('dotenv').config({ path: process.env.CONFIG_PATH });
|
|
@@ -6,24 +7,38 @@ if (process.env.CONFIG_PATH) {
|
|
|
6
7
|
|
|
7
8
|
const reportName = process.env.SUITE ? `${process.env.SUITE}.xml` : `TEST-result.xml`;
|
|
8
9
|
|
|
10
|
+
const customViewport = process.env.VIEWPORT ? JSON.parse(process.env.VIEWPORT) : { width: 1536, height: 960 };
|
|
11
|
+
|
|
9
12
|
let browserProject = [];
|
|
10
13
|
switch (process.env.BROWSER) {
|
|
11
|
-
case 'chromium':
|
|
12
14
|
case 'firefox':
|
|
15
|
+
browserProject = [{
|
|
16
|
+
name: 'firefox',
|
|
17
|
+
use: {
|
|
18
|
+
...devices['Desktop Firefox'],
|
|
19
|
+
userAgent: devices['Desktop Firefox'].userAgent + ' SPS auto test run',
|
|
20
|
+
viewport: customViewport,
|
|
21
|
+
},
|
|
22
|
+
}];
|
|
23
|
+
break;
|
|
13
24
|
case 'webkit':
|
|
14
25
|
browserProject = [{
|
|
15
|
-
name:
|
|
26
|
+
name: 'webkit',
|
|
16
27
|
use: {
|
|
17
|
-
|
|
28
|
+
...devices['Desktop Safari'],
|
|
29
|
+
userAgent: devices['Desktop Safari'].userAgent + ' SPS auto test run',
|
|
30
|
+
viewport: customViewport,
|
|
18
31
|
},
|
|
19
32
|
}];
|
|
20
33
|
break;
|
|
21
|
-
case '
|
|
22
|
-
case 'chrome':
|
|
34
|
+
case 'edge':
|
|
23
35
|
browserProject = [{
|
|
24
|
-
name:
|
|
36
|
+
name: 'msedge',
|
|
25
37
|
use: {
|
|
26
|
-
channel:
|
|
38
|
+
channel: 'msedge',
|
|
39
|
+
...devices['Desktop Edge'],
|
|
40
|
+
userAgent: devices['Desktop Edge'].userAgent + ' SPS auto test run',
|
|
41
|
+
viewport: customViewport,
|
|
27
42
|
},
|
|
28
43
|
}];
|
|
29
44
|
break;
|
|
@@ -31,12 +46,19 @@ switch (process.env.BROWSER) {
|
|
|
31
46
|
browserProject = [{
|
|
32
47
|
name: 'chromium',
|
|
33
48
|
use: {
|
|
34
|
-
|
|
49
|
+
channel: 'chrome',
|
|
50
|
+
...devices['Desktop Chrome'],
|
|
51
|
+
userAgent: devices['Desktop Chrome'].userAgent + ' SPS auto test run',
|
|
52
|
+
viewport: customViewport,
|
|
35
53
|
},
|
|
36
54
|
}];
|
|
37
55
|
break;
|
|
38
56
|
}
|
|
39
57
|
|
|
58
|
+
const storageStatePath = process.env.ENV && process.env.ENV.includes('prod')
|
|
59
|
+
? path.join(process.cwd(), 'results-e2e/auth/storageStateProd.json')
|
|
60
|
+
: path.join(process.cwd(), 'results-e2e/auth/storageStateTest.json');
|
|
61
|
+
|
|
40
62
|
/**
|
|
41
63
|
* See https://playwright.dev/docs/test-configuration.
|
|
42
64
|
*/
|
|
@@ -71,7 +93,7 @@ const config = {
|
|
|
71
93
|
globalTeardown: require.resolve('./lib/globalTeardown'),
|
|
72
94
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
73
95
|
use: {
|
|
74
|
-
storageState: path.join(process.cwd(), 'results-e2e/auth/storageState.json'),
|
|
96
|
+
storageState: storageStatePath,//path.join(process.cwd(), 'results-e2e/auth/storageState.json'),
|
|
75
97
|
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
|
76
98
|
actionTimeout: +process.env.ACTION_TIMEOUT || 30000,
|
|
77
99
|
/* Collect screenshot after each test failure. See https://playwright.dev/docs/test-configuration#automatic-screenshots */
|
|
@@ -80,8 +102,6 @@ const config = {
|
|
|
80
102
|
trace: process.env.TRACER && (process.env.TRACER.toString().toLowerCase() === 'true') ? 'retain-on-failure' : 'off',
|
|
81
103
|
/* Run in headless mode by default (if process.env.HEADLESS is not specified). */
|
|
82
104
|
headless: !process.env.HEADLESS || process.env.HEADLESS === 'true' ? true : false,
|
|
83
|
-
/* Emulates consistent viewport for each page. */
|
|
84
|
-
viewport: process.env.VIEWPORT ? JSON.parse(process.env.VIEWPORT) : { width: 1536, height: 960 },
|
|
85
105
|
/* Whether to ignore HTTPS errors when sending network requests. */
|
|
86
106
|
ignoreHTTPSErrors: true,
|
|
87
107
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
package/src/globalSetup.ts
CHANGED
|
@@ -3,7 +3,15 @@ import path from 'path';
|
|
|
3
3
|
import { chromium } from '@playwright/test';
|
|
4
4
|
|
|
5
5
|
const domain = 'commerce.spscommerce.com';
|
|
6
|
-
|
|
6
|
+
let baseUrl = 'https://test.' + domain;
|
|
7
|
+
let storageFile = path.join(process.cwd(), `results-e2e/auth/storageStateTest.json`);
|
|
8
|
+
let traceFile = path.join(process.cwd(), 'results-e2e/auth/globalSetupTest.zip');
|
|
9
|
+
|
|
10
|
+
if (process.env.ENV && process.env.ENV.includes('prod')) {
|
|
11
|
+
baseUrl = 'https://' + domain;
|
|
12
|
+
storageFile = path.join(process.cwd(), `results-e2e/auth/storageStateProd.json`);
|
|
13
|
+
traceFile = path.join(process.cwd(), 'results-e2e/auth/globalSetupProd.zip');
|
|
14
|
+
}
|
|
7
15
|
|
|
8
16
|
export default async function globalSetup(): Promise<void> {
|
|
9
17
|
// Remove custom sub-folders for test artifacts
|
|
@@ -13,10 +21,12 @@ export default async function globalSetup(): Promise<void> {
|
|
|
13
21
|
if (!subFolder.includes('auth')) { fs.rmSync(resultsFolder + subFolder, { recursive: true, force: true }); }
|
|
14
22
|
}
|
|
15
23
|
}
|
|
16
|
-
// Launch browser and log in if storageState.json does not exist
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
// Launch browser and log in if storageState.json does not exist OR auth expires soon
|
|
25
|
+
const currentTS = new Date().getTime();
|
|
26
|
+
if (!fs.existsSync(storageFile) ||
|
|
27
|
+
(fs.existsSync(storageFile) &&
|
|
28
|
+
((JSON.parse(fs.readFileSync(storageFile, 'utf8')).origins[0].localStorage.find(o => o.name === 'expires_at').value - currentTS) / 60000) < 30)
|
|
29
|
+
) {
|
|
20
30
|
const browser = await chromium.launch({ headless: false }); // { headless: false }
|
|
21
31
|
const context = await browser.newContext();
|
|
22
32
|
await context.tracing.start({ screenshots: true, snapshots: true });
|
package/src/globalTeardown.ts
CHANGED
|
@@ -9,8 +9,8 @@ export default async function globalTeardown(): Promise<void> {
|
|
|
9
9
|
for (const oldSubFolder of fs.readdirSync(oldFolder)) {
|
|
10
10
|
for (const oldFile of fs.readdirSync(path.join(oldFolder, oldSubFolder))) {
|
|
11
11
|
const oldFilePath = `${oldFolder}/${oldSubFolder}/${oldFile}`;
|
|
12
|
-
const newFile = "SPS_" + oldSubFolder
|
|
13
|
-
.indexOf("SPS
|
|
12
|
+
const newFile = "SPS_" + oldSubFolder
|
|
13
|
+
.substring(oldSubFolder.indexOf("SPS") + 4)
|
|
14
14
|
.split('-')
|
|
15
15
|
.filter(e => !e.includes(process.env.BROWSER) && !e.includes('chromium') && !e.includes('retry'))
|
|
16
16
|
.join('_')
|