@spscommerce/e2e-core 2.3.0 → 2.3.3
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/lib/globalTeardown.js +6 -2
- package/lib/globalTeardown.js.map +1 -1
- package/package.json +1 -1
- package/playwright.config.js +23 -2
- package/src/globalTeardown.ts +6 -2
package/lib/globalTeardown.js
CHANGED
|
@@ -5,7 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const fs_1 = __importDefault(require("fs"));
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const playwright_config_js_1 = __importDefault(require("../playwright.config.js"));
|
|
8
9
|
async function globalTeardown() {
|
|
10
|
+
const currentProjectNames = playwright_config_js_1.default.projects.map((project) => project.name);
|
|
9
11
|
const oldFolder = path_1.default.join(process.cwd(), 'results-e2e-raw/');
|
|
10
12
|
const newFolder = path_1.default.join(process.cwd(), 'results-e2e/screenshots/');
|
|
11
13
|
fs_1.default.mkdirSync(newFolder, { recursive: true });
|
|
@@ -16,11 +18,13 @@ async function globalTeardown() {
|
|
|
16
18
|
const newFile = "SPS_" + oldSubFolder
|
|
17
19
|
.substring(oldSubFolder.indexOf("SPS") + 4)
|
|
18
20
|
.split('-')
|
|
19
|
-
.filter(e => !
|
|
21
|
+
.filter(e => !currentProjectNames.includes(e) && !e.includes('retry'))
|
|
20
22
|
.join('_')
|
|
21
23
|
.replace('_', ' ');
|
|
22
24
|
const newFilePath = `${newFolder}/${newFile}.${oldFile.split('.').pop()}`;
|
|
23
|
-
fs_1.default.
|
|
25
|
+
if (!fs_1.default.existsSync(newFilePath)) {
|
|
26
|
+
fs_1.default.copyFileSync(oldFilePath, newFilePath);
|
|
27
|
+
}
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalTeardown.js","sourceRoot":"","sources":["../src/globalTeardown.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;
|
|
1
|
+
{"version":3,"file":"globalTeardown.js","sourceRoot":"","sources":["../src/globalTeardown.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,mFAA6C;AAE9B,KAAK,UAAU,cAAc;IACxC,MAAM,mBAAmB,GAAG,8BAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAA0B,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,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;qBAChC,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;qBAC1C,KAAK,CAAC,GAAG,CAAC;qBACV,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;qBACrE,IAAI,CAAC,GAAG,CAAC;qBACT,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACvB,MAAM,WAAW,GAAG,GAAG,SAAS,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;gBAC1E,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;oBAC7B,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;iBAC7C;aACJ;SACJ;KACJ;IACD,OAAO;AACX,CAAC;AAvBD,iCAuBC"}
|
package/package.json
CHANGED
package/playwright.config.js
CHANGED
|
@@ -7,13 +7,15 @@ if (process.env.CONFIG_PATH) {
|
|
|
7
7
|
|
|
8
8
|
const reportName = process.env.SUITE ? `${process.env.SUITE}.xml` : `TEST-result.xml`;
|
|
9
9
|
|
|
10
|
-
const customViewport = process.env.VIEWPORT ? JSON.parse(process.env.VIEWPORT) : { width: 1536, height:
|
|
10
|
+
const customViewport = process.env.VIEWPORT ? JSON.parse(process.env.VIEWPORT) : { width: 1536, height: 844 };
|
|
11
11
|
|
|
12
12
|
let browserProject = [];
|
|
13
13
|
switch (process.env.BROWSER) {
|
|
14
14
|
case 'firefox':
|
|
15
15
|
browserProject = [{
|
|
16
16
|
name: 'firefox',
|
|
17
|
+
testIgnore: /.*Inventory.*/,
|
|
18
|
+
testMatch: /.*(test|spec)\.(js|ts|mjs)/,
|
|
17
19
|
use: {
|
|
18
20
|
...devices['Desktop Firefox'],
|
|
19
21
|
userAgent: devices['Desktop Firefox'].userAgent + ' SPS auto test run',
|
|
@@ -24,6 +26,8 @@ switch (process.env.BROWSER) {
|
|
|
24
26
|
case 'webkit':
|
|
25
27
|
browserProject = [{
|
|
26
28
|
name: 'webkit',
|
|
29
|
+
testIgnore: /.*Inventory.*/,
|
|
30
|
+
testMatch: /.*(test|spec)\.(js|ts|mjs)/,
|
|
27
31
|
use: {
|
|
28
32
|
...devices['Desktop Safari'],
|
|
29
33
|
userAgent: devices['Desktop Safari'].userAgent + ' SPS auto test run',
|
|
@@ -34,6 +38,8 @@ switch (process.env.BROWSER) {
|
|
|
34
38
|
case 'edge':
|
|
35
39
|
browserProject = [{
|
|
36
40
|
name: 'msedge',
|
|
41
|
+
testIgnore: /.*Inventory.*/,
|
|
42
|
+
testMatch: /.*(test|spec)\.(js|ts|mjs)/,
|
|
37
43
|
use: {
|
|
38
44
|
channel: 'msedge',
|
|
39
45
|
...devices['Desktop Edge'],
|
|
@@ -45,6 +51,8 @@ switch (process.env.BROWSER) {
|
|
|
45
51
|
default:
|
|
46
52
|
browserProject = [{
|
|
47
53
|
name: 'chromium',
|
|
54
|
+
testIgnore: /.*Inventory.*/,
|
|
55
|
+
testMatch: /.*(test|spec)\.(js|ts|mjs)/,
|
|
48
56
|
use: {
|
|
49
57
|
channel: 'chrome',
|
|
50
58
|
...devices['Desktop Chrome'],
|
|
@@ -54,6 +62,19 @@ switch (process.env.BROWSER) {
|
|
|
54
62
|
}];
|
|
55
63
|
break;
|
|
56
64
|
}
|
|
65
|
+
// Added a specific no-retry suite workaround till the following request is done:
|
|
66
|
+
// https://github.com/microsoft/playwright/issues/10825
|
|
67
|
+
browserProject.push(
|
|
68
|
+
{
|
|
69
|
+
name: 'Inventory',
|
|
70
|
+
testMatch: /.*Inventory.*(test|spec)\.(js|ts|mjs)/,
|
|
71
|
+
retries: 0,
|
|
72
|
+
use: {
|
|
73
|
+
...devices['Desktop Firefox'],
|
|
74
|
+
userAgent: devices['Desktop Firefox'].userAgent + ' SPS auto test run',
|
|
75
|
+
viewport: customViewport,
|
|
76
|
+
},
|
|
77
|
+
})
|
|
57
78
|
|
|
58
79
|
const storageStatePath = process.env.ENV && process.env.ENV.includes('prod')
|
|
59
80
|
? path.join(process.cwd(), 'results-e2e/auth/storageStateProd.json')
|
|
@@ -77,7 +98,7 @@ const config = {
|
|
|
77
98
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
78
99
|
forbidOnly: !!process.env.CI,
|
|
79
100
|
/* Retry on CI only */
|
|
80
|
-
retries:
|
|
101
|
+
retries: 1,//+process.env.RETRIES || 0,
|
|
81
102
|
/* Opt out of parallel tests on CI. */
|
|
82
103
|
workers: +process.env.WORKERS || 1,
|
|
83
104
|
/* Stop test suite execution after reaching this number of failed tests and skip any tests that were not executed yet. */
|
package/src/globalTeardown.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import config from '../playwright.config.js';
|
|
3
4
|
|
|
4
5
|
export default async function globalTeardown(): Promise<void> {
|
|
6
|
+
const currentProjectNames = config.projects.map((project: { name: string; }) => project.name);
|
|
5
7
|
const oldFolder = path.join(process.cwd(), 'results-e2e-raw/');
|
|
6
8
|
const newFolder = path.join(process.cwd(), 'results-e2e/screenshots/');
|
|
7
9
|
fs.mkdirSync(newFolder, { recursive: true });
|
|
@@ -12,11 +14,13 @@ export default async function globalTeardown(): Promise<void> {
|
|
|
12
14
|
const newFile = "SPS_" + oldSubFolder
|
|
13
15
|
.substring(oldSubFolder.indexOf("SPS") + 4)
|
|
14
16
|
.split('-')
|
|
15
|
-
.filter(e => !
|
|
17
|
+
.filter(e => !currentProjectNames.includes(e) && !e.includes('retry'))
|
|
16
18
|
.join('_')
|
|
17
19
|
.replace('_', ' ');
|
|
18
20
|
const newFilePath = `${newFolder}/${newFile}.${oldFile.split('.').pop()}`;
|
|
19
|
-
fs.
|
|
21
|
+
if (!fs.existsSync(newFilePath)) {
|
|
22
|
+
fs.copyFileSync(oldFilePath, newFilePath);
|
|
23
|
+
}
|
|
20
24
|
}
|
|
21
25
|
}
|
|
22
26
|
}
|