@spscommerce/e2e-core 2.1.2 → 2.2.2
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/.eslintrc.js +0 -4
- package/lib/globalSetup.js +45 -114
- package/lib/globalSetup.js.map +1 -1
- package/lib/globalTeardown.js +19 -58
- package/lib/globalTeardown.js.map +1 -1
- package/lib/index.js +25 -4
- package/lib/index.js.map +1 -1
- package/lib/loggerSetup.js +53 -103
- package/lib/loggerSetup.js.map +1 -1
- package/lib/matchersSetup.js +10 -5
- package/lib/matchersSetup.js.map +1 -1
- package/package.json +1 -1
- package/playwright.config.js +93 -0
- package/{helpers → src}/globalSetup.ts +0 -0
- package/{helpers → src}/globalTeardown.ts +0 -0
- package/{helpers → src}/index.ts +0 -0
- package/{helpers → src}/loggerSetup.ts +0 -0
- package/{helpers → src}/matchersSetup.ts +0 -0
- package/tsconfig.json +3 -3
- package/playwright.config.ts +0 -91
- package/results-e2e/reports/TEST-result.xml +0 -2
package/.eslintrc.js
CHANGED
|
@@ -6,8 +6,6 @@ module.exports = {
|
|
|
6
6
|
},
|
|
7
7
|
"extends": [
|
|
8
8
|
"eslint:recommended",
|
|
9
|
-
"plugin:jest/recommended",
|
|
10
|
-
"plugin:jest-playwright/recommended",
|
|
11
9
|
"plugin:@typescript-eslint/recommended"
|
|
12
10
|
],
|
|
13
11
|
"parser": "@typescript-eslint/parser",
|
|
@@ -17,11 +15,9 @@ module.exports = {
|
|
|
17
15
|
},
|
|
18
16
|
"plugins": [
|
|
19
17
|
"@typescript-eslint",
|
|
20
|
-
"jest"
|
|
21
18
|
],
|
|
22
19
|
"rules": {
|
|
23
20
|
"@typescript-eslint/no-explicit-any": "off",
|
|
24
21
|
"@typescript-eslint/no-var-requires": "off",
|
|
25
|
-
"jest/valid-expect": "off",
|
|
26
22
|
}
|
|
27
23
|
}
|
package/lib/globalSetup.js
CHANGED
|
@@ -1,119 +1,50 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
4
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const test_1 = require("@playwright/test");
|
|
9
|
+
async function globalSetup() {
|
|
10
|
+
// Remove custom sub-folders for test artifacts
|
|
11
|
+
const resultsFolder = path_1.default.join(process.cwd(), 'results-e2e/');
|
|
12
|
+
if (fs_1.default.existsSync(resultsFolder)) {
|
|
13
|
+
for (const subFolder of fs_1.default.readdirSync(resultsFolder)) {
|
|
14
|
+
if (!subFolder.includes('auth')) {
|
|
15
|
+
fs_1.default.rmSync(resultsFolder + subFolder, { recursive: true, force: true });
|
|
31
16
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Launch browser and log in if storageState.json does not exist
|
|
20
|
+
const storageFile = path_1.default.join(process.cwd(), 'results-e2e/auth/storageState.json');
|
|
21
|
+
const traceFile = path_1.default.join(process.cwd(), 'results-e2e/auth/globalSetup.zip');
|
|
22
|
+
if (!fs_1.default.existsSync(storageFile)) {
|
|
23
|
+
const browser = await test_1.chromium.launch({ headless: false }); // { headless: false }
|
|
24
|
+
const context = await browser.newContext();
|
|
25
|
+
await context.tracing.start({ screenshots: true, snapshots: true });
|
|
26
|
+
const page = await context.newPage();
|
|
27
|
+
try {
|
|
28
|
+
await page.goto(process.env.BASEURL);
|
|
29
|
+
await page.waitForURL(/https:\/\/auth.*/);
|
|
30
|
+
await page.fill('input[type="email"]', process.env.USER_EMAIL);
|
|
31
|
+
await page.click('button#btn-next');
|
|
32
|
+
await page.fill('input[type="password"]', process.env.USER_PASSWORD);
|
|
33
|
+
await page.click('button#btn-login');
|
|
34
|
+
await page.waitForURL(/launchpad/);
|
|
35
|
+
await page.context().storageState({ path: storageFile });
|
|
36
|
+
}
|
|
37
|
+
catch (e) {
|
|
38
|
+
console.log(e);
|
|
39
|
+
await context.tracing.stop({ path: traceFile });
|
|
40
|
+
throw new Error('Error occurred while running globalSetup.ts file.');
|
|
41
|
+
}
|
|
42
|
+
await browser.close();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const stat = fs_1.default.statSync(storageFile);
|
|
46
|
+
console.log(stat);
|
|
35
47
|
}
|
|
36
|
-
};
|
|
37
|
-
import fs from 'fs';
|
|
38
|
-
import path from 'path';
|
|
39
|
-
import { chromium } from '@playwright/test';
|
|
40
|
-
function globalSetup() {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
42
|
-
var resultsFolder, _i, _a, subFolder, storageFile, traceFile, browser, context, page, e_1, stat;
|
|
43
|
-
return __generator(this, function (_b) {
|
|
44
|
-
switch (_b.label) {
|
|
45
|
-
case 0:
|
|
46
|
-
resultsFolder = path.join(process.cwd(), 'results-e2e/');
|
|
47
|
-
if (fs.existsSync(resultsFolder)) {
|
|
48
|
-
for (_i = 0, _a = fs.readdirSync(resultsFolder); _i < _a.length; _i++) {
|
|
49
|
-
subFolder = _a[_i];
|
|
50
|
-
if (!subFolder.includes('auth')) {
|
|
51
|
-
fs.rmSync(resultsFolder + subFolder, { recursive: true, force: true });
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
storageFile = path.join(process.cwd(), 'results-e2e/auth/storageState.json');
|
|
56
|
-
traceFile = path.join(process.cwd(), 'results-e2e/auth/globalSetup.zip');
|
|
57
|
-
if (!!fs.existsSync(storageFile)) return [3 /*break*/, 18];
|
|
58
|
-
return [4 /*yield*/, chromium.launch({ headless: false })];
|
|
59
|
-
case 1:
|
|
60
|
-
browser = _b.sent();
|
|
61
|
-
return [4 /*yield*/, browser.newContext()];
|
|
62
|
-
case 2:
|
|
63
|
-
context = _b.sent();
|
|
64
|
-
return [4 /*yield*/, context.tracing.start({ screenshots: true, snapshots: true })];
|
|
65
|
-
case 3:
|
|
66
|
-
_b.sent();
|
|
67
|
-
return [4 /*yield*/, context.newPage()];
|
|
68
|
-
case 4:
|
|
69
|
-
page = _b.sent();
|
|
70
|
-
_b.label = 5;
|
|
71
|
-
case 5:
|
|
72
|
-
_b.trys.push([5, 14, , 16]);
|
|
73
|
-
return [4 /*yield*/, page.goto(process.env.BASEURL)];
|
|
74
|
-
case 6:
|
|
75
|
-
_b.sent();
|
|
76
|
-
return [4 /*yield*/, page.waitForURL(/https:\/\/auth.*/)];
|
|
77
|
-
case 7:
|
|
78
|
-
_b.sent();
|
|
79
|
-
return [4 /*yield*/, page.fill('input[type="email"]', process.env.USER_EMAIL)];
|
|
80
|
-
case 8:
|
|
81
|
-
_b.sent();
|
|
82
|
-
return [4 /*yield*/, page.click('button#btn-next')];
|
|
83
|
-
case 9:
|
|
84
|
-
_b.sent();
|
|
85
|
-
return [4 /*yield*/, page.fill('input[type="password"]', process.env.USER_PASSWORD)];
|
|
86
|
-
case 10:
|
|
87
|
-
_b.sent();
|
|
88
|
-
return [4 /*yield*/, page.click('button#btn-login')];
|
|
89
|
-
case 11:
|
|
90
|
-
_b.sent();
|
|
91
|
-
return [4 /*yield*/, page.waitForURL(/launchpad/)];
|
|
92
|
-
case 12:
|
|
93
|
-
_b.sent();
|
|
94
|
-
return [4 /*yield*/, page.context().storageState({ path: storageFile })];
|
|
95
|
-
case 13:
|
|
96
|
-
_b.sent();
|
|
97
|
-
return [3 /*break*/, 16];
|
|
98
|
-
case 14:
|
|
99
|
-
e_1 = _b.sent();
|
|
100
|
-
console.log(e_1);
|
|
101
|
-
return [4 /*yield*/, context.tracing.stop({ path: traceFile })];
|
|
102
|
-
case 15:
|
|
103
|
-
_b.sent();
|
|
104
|
-
throw new Error('Error occurred while running globalSetup.ts file.');
|
|
105
|
-
case 16: return [4 /*yield*/, browser.close()];
|
|
106
|
-
case 17:
|
|
107
|
-
_b.sent();
|
|
108
|
-
return [3 /*break*/, 19];
|
|
109
|
-
case 18:
|
|
110
|
-
stat = fs.statSync(storageFile);
|
|
111
|
-
console.log(stat);
|
|
112
|
-
_b.label = 19;
|
|
113
|
-
case 19: return [2 /*return*/];
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
48
|
}
|
|
118
|
-
|
|
49
|
+
exports.default = globalSetup;
|
|
119
50
|
//# sourceMappingURL=globalSetup.js.map
|
package/lib/globalSetup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalSetup.js","sourceRoot":"","sources":["../
|
|
1
|
+
{"version":3,"file":"globalSetup.js","sourceRoot":"","sources":["../src/globalSetup.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,2CAA4C;AAE5C,KAAK,UAAU,WAAW;IACtB,+CAA+C;IAC/C,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,cAAc,CAAC,CAAC;IAC/D,IAAI,YAAE,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE;QAC9B,KAAK,MAAM,SAAS,IAAI,YAAE,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE;YACnD,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBAAE,YAAE,CAAC,MAAM,CAAC,aAAa,GAAG,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;aAAE;SAC/G;KACJ;IACD,gEAAgE;IAChE,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,oCAAoC,CAAC,CAAC;IACnF,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kCAAkC,CAAC,CAAC;IAC/E,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;QAC7B,MAAM,OAAO,GAAG,MAAM,eAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,sBAAsB;QAClF,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;QAC3C,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACpE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI;YACA,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrC,MAAM,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;YAC1C,MAAM,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC/D,MAAM,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;YACpC,MAAM,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;YACrE,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;YACrC,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;SAAM;QACH,MAAM,IAAI,GAAG,YAAE,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;KACrB;AACL,CAAC;AAED,kBAAe,WAAW,CAAC"}
|
package/lib/globalTeardown.js
CHANGED
|
@@ -1,63 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
4
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
async function globalTeardown() {
|
|
9
|
+
const oldFolder = path_1.default.join(process.cwd(), 'results-e2e-raw/');
|
|
10
|
+
const newFolder = path_1.default.join(process.cwd(), 'results-e2e/screenshots/');
|
|
11
|
+
fs_1.default.mkdirSync(newFolder, { recursive: true });
|
|
12
|
+
if (fs_1.default.existsSync(oldFolder)) {
|
|
13
|
+
for (const oldSubFolder of fs_1.default.readdirSync(oldFolder)) {
|
|
14
|
+
for (const oldFile of fs_1.default.readdirSync(path_1.default.join(oldFolder, oldSubFolder))) {
|
|
15
|
+
const oldFilePath = `${oldFolder}/${oldSubFolder}/${oldFile}`;
|
|
16
|
+
const newFile = "FFUI_" + oldSubFolder.substring(oldSubFolder.indexOf("FFUI-")).split('-').slice(1, -1).join('_').replace('_', ' ');
|
|
17
|
+
const newFilePath = `${newFolder}/${newFile}.${oldFile.split('.').pop()}`;
|
|
18
|
+
fs_1.default.copyFileSync(oldFilePath, newFilePath);
|
|
31
19
|
}
|
|
32
|
-
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
20
|
+
}
|
|
35
21
|
}
|
|
36
|
-
};
|
|
37
|
-
import fs from 'fs';
|
|
38
|
-
import path from 'path';
|
|
39
|
-
function globalTeardown() {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
41
|
-
var oldFolder, newFolder, _i, _a, oldSubFolder, _b, _c, oldFile, oldFilePath, newFile, newFilePath;
|
|
42
|
-
return __generator(this, function (_d) {
|
|
43
|
-
oldFolder = path.join(process.cwd(), 'results-e2e-raw/');
|
|
44
|
-
newFolder = path.join(process.cwd(), 'results-e2e/screenshots/');
|
|
45
|
-
fs.mkdirSync(newFolder, { recursive: true });
|
|
46
|
-
if (fs.existsSync(oldFolder)) {
|
|
47
|
-
for (_i = 0, _a = fs.readdirSync(oldFolder); _i < _a.length; _i++) {
|
|
48
|
-
oldSubFolder = _a[_i];
|
|
49
|
-
for (_b = 0, _c = fs.readdirSync(path.join(oldFolder, oldSubFolder)); _b < _c.length; _b++) {
|
|
50
|
-
oldFile = _c[_b];
|
|
51
|
-
oldFilePath = "".concat(oldFolder, "/").concat(oldSubFolder, "/").concat(oldFile);
|
|
52
|
-
newFile = "FFUI_" + oldSubFolder.substring(oldSubFolder.indexOf("FFUI-")).split('-').slice(1, -1).join('_').replace('_', ' ');
|
|
53
|
-
newFilePath = "".concat(newFolder, "/").concat(newFile, ".").concat(oldFile.split('.').pop());
|
|
54
|
-
fs.copyFileSync(oldFilePath, newFilePath);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return [2 /*return*/];
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
22
|
}
|
|
62
|
-
|
|
23
|
+
exports.default = globalTeardown;
|
|
63
24
|
//# sourceMappingURL=globalTeardown.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalTeardown.js","sourceRoot":"","sources":["../
|
|
1
|
+
{"version":3,"file":"globalTeardown.js","sourceRoot":"","sources":["../src/globalTeardown.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAExB,KAAK,UAAU,cAAc;IACzB,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,OAAO,GAAG,YAAY,CAAC,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;gBACpI,MAAM,WAAW,GAAG,GAAG,SAAS,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC;gBAC1E,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;aAC7C;SACJ;KACJ;AACL,CAAC;AAED,kBAAe,cAAc,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.expect = void 0;
|
|
21
|
+
__exportStar(require("./globalSetup"), exports);
|
|
22
|
+
__exportStar(require("./globalTeardown"), exports);
|
|
23
|
+
__exportStar(require("./loggerSetup"), exports);
|
|
24
|
+
var matchersSetup_1 = require("./matchersSetup");
|
|
25
|
+
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return __importDefault(matchersSetup_1).default; } });
|
|
5
26
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,mDAAiC;AACjC,gDAA8B;AAC9B,iDAAoD;AAA3C,wHAAA,OAAO,OAAU"}
|
package/lib/loggerSetup.js
CHANGED
|
@@ -1,109 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
4
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.disableLogger = exports.enableLogger = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
let access;
|
|
10
|
+
async function enableLogger(file, page) {
|
|
11
|
+
// file:
|
|
12
|
+
// [
|
|
13
|
+
// '1.Acceptance/HealthCheckFlow.test.ts',
|
|
14
|
+
// 'Preconditions_block', // optional
|
|
15
|
+
// 'HealthCheckFlow',
|
|
16
|
+
// 'Transactions_tab_is_opened_with_loaded_list_content'
|
|
17
|
+
// ]
|
|
18
|
+
const suite = file[1];
|
|
19
|
+
const test = file.reverse()[0];
|
|
20
|
+
const testName = `${suite} ${test}`;
|
|
21
|
+
const logPathPerSuite = path_1.default.join(process.cwd(), 'results-e2e/logs');
|
|
22
|
+
// Create folder per suite for error files
|
|
23
|
+
fs_1.default.mkdirSync(logPathPerSuite, { recursive: true });
|
|
24
|
+
// Create a writable stream for each file per test
|
|
25
|
+
access = fs_1.default.createWriteStream(`${logPathPerSuite}/${testName}.log`);
|
|
26
|
+
process.stdout.write = process.stderr.write = access.write.bind(access);
|
|
27
|
+
// Write the GitHub link of the currently running test to the beginning of each log file
|
|
28
|
+
console.log(`
|
|
29
|
+
https://github.com/SPSCommerce/${process.env.REPONAME}/search?q=${test}`);
|
|
30
|
+
// Listen for errors
|
|
31
|
+
page
|
|
32
|
+
.on('console', async (message) => {
|
|
33
|
+
if (message.type() === 'error') {
|
|
34
|
+
if (message.text() === 'JSHandle@error') {
|
|
35
|
+
for (const arg of message.args())
|
|
36
|
+
console.log(await arg.jsonValue());
|
|
31
37
|
}
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var _this = this;
|
|
44
|
-
return __generator(this, function (_a) {
|
|
45
|
-
suite = file[1];
|
|
46
|
-
test = file.reverse()[0];
|
|
47
|
-
testName = "".concat(suite, " ").concat(test);
|
|
48
|
-
logPathPerSuite = path.join(process.cwd(), 'results-e2e/logs');
|
|
49
|
-
// Create folder per suite for error files
|
|
50
|
-
fs.mkdirSync(logPathPerSuite, { recursive: true });
|
|
51
|
-
// Create a writable stream for each file per test
|
|
52
|
-
access = fs.createWriteStream("".concat(logPathPerSuite, "/").concat(testName, ".log"));
|
|
53
|
-
process.stdout.write = process.stderr.write = access.write.bind(access);
|
|
54
|
-
// Write the GitHub link of the currently running test to the beginning of each log file
|
|
55
|
-
console.log("\n https://github.com/SPSCommerce/".concat(process.env.REPONAME, "/search?q=").concat(test));
|
|
56
|
-
// Listen for errors
|
|
57
|
-
page
|
|
58
|
-
.on('console', function (message) { return __awaiter(_this, void 0, void 0, function () {
|
|
59
|
-
var _i, _a, arg, _b, _c;
|
|
60
|
-
return __generator(this, function (_d) {
|
|
61
|
-
switch (_d.label) {
|
|
62
|
-
case 0:
|
|
63
|
-
if (!(message.type() === 'error')) return [3 /*break*/, 5];
|
|
64
|
-
if (!(message.text() === 'JSHandle@error')) return [3 /*break*/, 4];
|
|
65
|
-
_i = 0, _a = message.args();
|
|
66
|
-
_d.label = 1;
|
|
67
|
-
case 1:
|
|
68
|
-
if (!(_i < _a.length)) return [3 /*break*/, 4];
|
|
69
|
-
arg = _a[_i];
|
|
70
|
-
_c = (_b = console).log;
|
|
71
|
-
return [4 /*yield*/, arg.jsonValue()];
|
|
72
|
-
case 2:
|
|
73
|
-
_c.apply(_b, [_d.sent()]);
|
|
74
|
-
_d.label = 3;
|
|
75
|
-
case 3:
|
|
76
|
-
_i++;
|
|
77
|
-
return [3 /*break*/, 1];
|
|
78
|
-
case 4:
|
|
79
|
-
console.log("--Console-msg--".concat(message.type(), ": ").concat(message.text()));
|
|
80
|
-
_d.label = 5;
|
|
81
|
-
case 5: return [2 /*return*/];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}); })
|
|
85
|
-
.on('requestfailed', function (request) {
|
|
86
|
-
return console.log("--Failed-request--".concat(request.failure().errorText, ": ").concat(request.url()));
|
|
87
|
-
})
|
|
88
|
-
.on("pageerror", function (err) {
|
|
89
|
-
console.log("--Page-error--".concat(err.message));
|
|
90
|
-
})
|
|
91
|
-
.on('response', function (response) {
|
|
92
|
-
if (response.status() >= 400) {
|
|
93
|
-
console.log("--4XX/5XX-response--".concat(response.status(), ": ").concat(response.url()));
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
return [2 /*return*/];
|
|
97
|
-
});
|
|
38
|
+
console.log(`--Console-msg--${message.type()}: ${message.text()}`);
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
.on('requestfailed', request => console.log(`--Failed-request--${request.failure().errorText}: ${request.url()}`))
|
|
42
|
+
.on("pageerror", (err) => {
|
|
43
|
+
console.log(`--Page-error--${err.message}`);
|
|
44
|
+
})
|
|
45
|
+
.on('response', (response) => {
|
|
46
|
+
if (response.status() >= 400) {
|
|
47
|
+
console.log(`--4XX/5XX-response--${response.status()}: ${response.url()}`);
|
|
48
|
+
}
|
|
98
49
|
});
|
|
50
|
+
return;
|
|
99
51
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return [2 /*return*/];
|
|
106
|
-
});
|
|
107
|
-
});
|
|
52
|
+
exports.enableLogger = enableLogger;
|
|
53
|
+
async function disableLogger() {
|
|
54
|
+
// Finish error writing
|
|
55
|
+
access && access.end();
|
|
56
|
+
return;
|
|
108
57
|
}
|
|
58
|
+
exports.disableLogger = disableLogger;
|
|
109
59
|
//# sourceMappingURL=loggerSetup.js.map
|
package/lib/loggerSetup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggerSetup.js","sourceRoot":"","sources":["../
|
|
1
|
+
{"version":3,"file":"loggerSetup.js","sourceRoot":"","sources":["../src/loggerSetup.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,IAAI,MAAW,CAAC;AAET,KAAK,UAAU,YAAY,CAAC,IAAc,EAAE,IAAU;IACzD,QAAQ;IACR,IAAI;IACJ,8CAA8C;IAC9C,0CAA0C;IAC1C,yBAAyB;IACzB,4DAA4D;IAC5D,IAAI;IACJ,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACtB,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,GAAG,KAAK,IAAI,IAAI,EAAE,CAAC;IACpC,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAkB,CAAC,CAAC;IAErE,2CAA2C;IAC3C,YAAE,CAAC,SAAS,CAAC,eAAe,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEnD,kDAAkD;IAClD,MAAM,GAAG,YAAE,CAAC,iBAAiB,CAAC,GAAG,eAAe,IAAI,QAAQ,MAAM,CAAC,CAAA;IACnE,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAExE,wFAAwF;IACxF,OAAO,CAAC,GAAG,CAAC;qCACqB,OAAO,CAAC,GAAG,CAAC,QAAQ,aAAa,IAAI,EAAE,CAAC,CAAC;IAE1E,oBAAoB;IACpB,IAAI;SACC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;QAC3B,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,OAAO,EAAE;YAC5B,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,gBAAgB,EAAE;gBACrC,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,IAAI,EAAE;oBAC5B,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC;aAC1C;YACD,OAAO,CAAC,GAAG,CAAC,kBAAkB,OAAO,CAAC,IAAI,EAAE,KAAK,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACtE;IACL,CAAC,CAAC;SACD,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,EAAE,CAC3B,OAAO,CAAC,GAAG,CAAC,qBAAqB,OAAO,CAAC,OAAO,EAAE,CAAC,SAAS,KAAK,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;SACrF,EAAE,CAAC,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE;QACrB,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,CAAC,OAAO,EAAE,CAAC,CAAA;IAC/C,CAAC,CAAC;SACD,EAAE,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE;QACzB,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,GAAG,EAAE;YAC1B,OAAO,CAAC,GAAG,CAAC,uBAAuB,QAAQ,CAAC,MAAM,EAAE,KAAK,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;SAC9E;IACL,CAAC,CAAC,CAAA;IACN,OAAO;AACX,CAAC;AA9CD,oCA8CC;AAEM,KAAK,UAAU,aAAa;IAC/B,uBAAuB;IACvB,MAAM,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;IACvB,OAAO;AACX,CAAC;AAJD,sCAIC"}
|
package/lib/matchersSetup.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const test_1 = require("@playwright/test");
|
|
7
|
+
const withMessage_js_1 = __importDefault(require("@alex_neo/jest-expect-message/dist/withMessage.js"));
|
|
8
|
+
const expect = (0, withMessage_js_1.default)(test_1.test.expect);
|
|
9
|
+
const matchers = require('jest-extended');
|
|
5
10
|
expect.extend(matchers);
|
|
6
|
-
|
|
11
|
+
exports.default = expect;
|
|
7
12
|
//# sourceMappingURL=matchersSetup.js.map
|
package/lib/matchersSetup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchersSetup.js","sourceRoot":"","sources":["../
|
|
1
|
+
{"version":3,"file":"matchersSetup.js","sourceRoot":"","sources":["../src/matchersSetup.ts"],"names":[],"mappings":";;;;;AAAA,2CAAwC;AACxC,uGAA4E;AAE5E,MAAM,MAAM,GAAG,IAAA,wBAAW,EAAC,WAAI,CAAC,MAAM,CAAC,CAAC;AAExC,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;AAC1C,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAExB,kBAAe,MAAM,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
|
|
3
|
+
const reportName = process.env.SUITE ? `${process.env.SUITE}.xml` : `TEST-result.xml`;
|
|
4
|
+
|
|
5
|
+
let browserProject = [];
|
|
6
|
+
switch (process.env.BROWSER) {
|
|
7
|
+
case 'chromium':
|
|
8
|
+
case 'firefox':
|
|
9
|
+
case 'webkit':
|
|
10
|
+
browserProject = [{
|
|
11
|
+
name: process.env.BROWSER,
|
|
12
|
+
use: {
|
|
13
|
+
browserName: process.env.BROWSER,
|
|
14
|
+
},
|
|
15
|
+
}];
|
|
16
|
+
break;
|
|
17
|
+
case 'msedge':
|
|
18
|
+
case 'chrome':
|
|
19
|
+
browserProject = [{
|
|
20
|
+
name: process.env.BROWSER,
|
|
21
|
+
use: {
|
|
22
|
+
channel: process.env.BROWSER,
|
|
23
|
+
},
|
|
24
|
+
}];
|
|
25
|
+
break;
|
|
26
|
+
default:
|
|
27
|
+
browserProject = [{
|
|
28
|
+
name: 'chromium',
|
|
29
|
+
use: {
|
|
30
|
+
browserName: 'chromium',
|
|
31
|
+
},
|
|
32
|
+
}];
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const domain = 'commerce.spscommerce.com';
|
|
37
|
+
process.env.BASEURL = process.env.URL && process.env.URL === 'prod' ? 'https://' + domain : 'https://test.' + domain;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* See https://playwright.dev/docs/test-configuration.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
// @ts-check
|
|
44
|
+
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
|
45
|
+
const config = {
|
|
46
|
+
testDir: process.env.TEST_DIR,
|
|
47
|
+
|
|
48
|
+
/* Maximum time one test can run for. */
|
|
49
|
+
timeout: +process.env.TIMEOUT || 30000,
|
|
50
|
+
expect: {
|
|
51
|
+
/**
|
|
52
|
+
* Maximum time expect() should wait for the condition to be met.
|
|
53
|
+
* For example in `await expect(locator).toHaveText();`
|
|
54
|
+
*/
|
|
55
|
+
timeout: 5000
|
|
56
|
+
},
|
|
57
|
+
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
58
|
+
forbidOnly: !!process.env.CI,
|
|
59
|
+
/* Retry on CI only */
|
|
60
|
+
retries: +process.env.RETRIES || 0,
|
|
61
|
+
/* Opt out of parallel tests on CI. */
|
|
62
|
+
workers: +process.env.WORKERS || 1,
|
|
63
|
+
/* Stop test suite execution after reaching this number of failed tests and skip any tests that were not executed yet. */
|
|
64
|
+
maxFailures: process.env.CI ? 5 : 0,
|
|
65
|
+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
66
|
+
reporter: [
|
|
67
|
+
['junit', { outputFile: path.join(process.cwd(), `results-e2e/reports/${reportName}`) }],
|
|
68
|
+
['list']
|
|
69
|
+
],
|
|
70
|
+
globalSetup: require.resolve('./lib/globalSetup'),
|
|
71
|
+
globalTeardown: require.resolve('./lib/globalTeardown'),
|
|
72
|
+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
73
|
+
use: {
|
|
74
|
+
storageState: path.join(process.cwd(), 'results-e2e/auth/storageState.json'),
|
|
75
|
+
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
|
76
|
+
actionTimeout: 30000,
|
|
77
|
+
/* Collect screenshot after each test failure. See https://playwright.dev/docs/test-configuration#automatic-screenshots */
|
|
78
|
+
screenshot: 'only-on-failure',
|
|
79
|
+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
80
|
+
trace: process.env.TRACER ? 'retain-on-failure' : 'off',
|
|
81
|
+
// Run in headless mode by default (if process.env.HEADLESS is not specified)
|
|
82
|
+
headless: !process.env.HEADLESS || process.env.HEADLESS === 'true' ? true : false,
|
|
83
|
+
ignoreHTTPSErrors: true,
|
|
84
|
+
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
85
|
+
// baseURL: 'http://localhost:3000',
|
|
86
|
+
},
|
|
87
|
+
/* Configure projects for major browsers */
|
|
88
|
+
projects: browserProject,
|
|
89
|
+
/* Folder for test artifacts such as screenshots, videos, traces, etc. (cleaned at the start) */
|
|
90
|
+
outputDir: path.join(process.cwd(), 'results-e2e-raw/')
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
module.exports = config;
|
|
File without changes
|
|
File without changes
|
package/{helpers → src}/index.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/tsconfig.json
CHANGED
package/playwright.config.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { PlaywrightTestConfig } from '@playwright/test';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
|
|
4
|
-
const reportName = process.env.SUITE ? `${process.env.SUITE}.xml` : `TEST-result.xml`;
|
|
5
|
-
|
|
6
|
-
let browserProject = [];
|
|
7
|
-
switch (process.env.BROWSER) {
|
|
8
|
-
case 'chromium':
|
|
9
|
-
case 'firefox':
|
|
10
|
-
case 'webkit':
|
|
11
|
-
browserProject = [{
|
|
12
|
-
name: process.env.BROWSER,
|
|
13
|
-
use: {
|
|
14
|
-
browserName: process.env.BROWSER,
|
|
15
|
-
},
|
|
16
|
-
}];
|
|
17
|
-
break;
|
|
18
|
-
case 'msedge':
|
|
19
|
-
case 'chrome':
|
|
20
|
-
browserProject = [{
|
|
21
|
-
name: process.env.BROWSER,
|
|
22
|
-
use: {
|
|
23
|
-
channel: process.env.BROWSER,
|
|
24
|
-
},
|
|
25
|
-
}];
|
|
26
|
-
break;
|
|
27
|
-
default:
|
|
28
|
-
browserProject = [{
|
|
29
|
-
name: 'chromium',
|
|
30
|
-
use: {
|
|
31
|
-
browserName: 'chromium',
|
|
32
|
-
},
|
|
33
|
-
}];
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const domain = 'commerce.spscommerce.com';
|
|
38
|
-
process.env.BASEURL = process.env.URL && process.env.URL === 'prod' ? 'https://' + domain : 'https://test.' + domain;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* See https://playwright.dev/docs/test-configuration.
|
|
42
|
-
*/
|
|
43
|
-
const config: PlaywrightTestConfig = {
|
|
44
|
-
testDir: '../tests-e2e',
|
|
45
|
-
//testDir: './tests-e2e',
|
|
46
|
-
/* Maximum time one test can run for. */
|
|
47
|
-
timeout: +process.env.TIMEOUT || 30000,
|
|
48
|
-
expect: {
|
|
49
|
-
/**
|
|
50
|
-
* Maximum time expect() should wait for the condition to be met.
|
|
51
|
-
* For example in `await expect(locator).toHaveText();`
|
|
52
|
-
*/
|
|
53
|
-
timeout: 5000
|
|
54
|
-
},
|
|
55
|
-
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
56
|
-
forbidOnly: !!process.env.CI,
|
|
57
|
-
/* Retry on CI only */
|
|
58
|
-
retries: +process.env.RETRIES || 0,
|
|
59
|
-
/* Opt out of parallel tests on CI. */
|
|
60
|
-
workers: +process.env.WORKERS || 1,
|
|
61
|
-
/* Stop test suite execution after reaching this number of failed tests and skip any tests that were not executed yet. */
|
|
62
|
-
maxFailures: process.env.CI ? 5 : 0,
|
|
63
|
-
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
64
|
-
reporter: [
|
|
65
|
-
['junit', { outputFile: path.join(process.cwd(), `results-e2e/reports/${reportName}`) }],
|
|
66
|
-
['list']
|
|
67
|
-
],
|
|
68
|
-
globalSetup: './helpers/globalSetup',
|
|
69
|
-
globalTeardown: './helpers/globalTeardown',
|
|
70
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
71
|
-
use: {
|
|
72
|
-
storageState: path.join(process.cwd(), 'results-e2e/auth/storageState.json'),
|
|
73
|
-
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
|
|
74
|
-
actionTimeout: 30000,
|
|
75
|
-
/* Collect screenshot after each test failure. See https://playwright.dev/docs/test-configuration#automatic-screenshots */
|
|
76
|
-
screenshot: 'only-on-failure',
|
|
77
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
78
|
-
trace: process.env.TRACER ? 'retain-on-failure' : 'off',
|
|
79
|
-
// Run in headless mode by default (if process.env.HEADLESS is not specified)
|
|
80
|
-
headless: !process.env.HEADLESS || process.env.HEADLESS === 'true' ? true : false,
|
|
81
|
-
ignoreHTTPSErrors: true,
|
|
82
|
-
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
83
|
-
// baseURL: 'http://localhost:3000',
|
|
84
|
-
},
|
|
85
|
-
/* Configure projects for major browsers */
|
|
86
|
-
projects: browserProject,
|
|
87
|
-
/* Folder for test artifacts such as screenshots, videos, traces, etc. (cleaned at the start) */
|
|
88
|
-
outputDir: path.join(process.cwd(), 'results-e2e-raw/'),
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
export default config;
|