@spscommerce/e2e-core 2.4.10 → 2.4.12
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/.dockerignore +3 -3
- package/.yarnrc.yml +1 -0
- package/Dockerfile +1 -0
- package/Example.test.ts +1 -1
- package/README.md +8 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/index.js.map +1 -1
- package/lib/reporters/junitFix.d.ts +10 -0
- package/lib/reporters/junitFix.js +24 -0
- package/lib/reporters/junitFix.js.map +1 -0
- package/lib/reporters/screenshots.d.ts +5 -0
- package/lib/reporters/screenshots.js +22 -0
- package/lib/reporters/screenshots.js.map +1 -0
- package/package.json +7 -6
- package/playwright.config.js +4 -3
- package/src/index.ts +0 -1
- package/src/reporters/junitFix.ts +29 -0
- package/src/reporters/screenshots.ts +24 -0
- package/lib/globalTeardown.d.ts +0 -1
- package/lib/globalTeardown.js +0 -32
- package/lib/globalTeardown.js.map +0 -1
- package/src/globalTeardown.ts +0 -26
package/.dockerignore
CHANGED
package/.yarnrc.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodeLinker: node-modules
|
package/Dockerfile
CHANGED
|
@@ -5,6 +5,7 @@ ARG BROWSER
|
|
|
5
5
|
RUN mkdir e2e
|
|
6
6
|
WORKDIR /e2e
|
|
7
7
|
COPY . .
|
|
8
|
+
RUN corepack enable && corepack prepare yarn@4.4.0 --activate
|
|
8
9
|
RUN yarn
|
|
9
10
|
RUN if [ "$BROWSER" = "edge" ]; then npx playwright install msedge; fi
|
|
10
11
|
RUN if [ "$BROWSER" = "chrome" ]; then npx playwright install chrome; fi
|
package/Example.test.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { enableLogger, disableLogger } from './src/loggerSetup';
|
|
|
4
4
|
|
|
5
5
|
test.describe('SPS_Example', () => {
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
test.describe.configure({ retries: 1 });
|
|
8
8
|
|
|
9
9
|
test.beforeEach(async ({ page }, testInfo) => {
|
|
10
10
|
process.env.CI && await enableLogger(testInfo.titlePath, page);
|
package/README.md
CHANGED
|
@@ -129,7 +129,14 @@ RUN if [ "$BROWSER" = "chrome" ]; then npx playwright install chrome; fi
|
|
|
129
129
|
|
|
130
130
|
## Publish package
|
|
131
131
|
If you want to publish your package to the npm registry and have changed any files from `src` folder, you must build the package first. Run the following command: `yarn build`.
|
|
132
|
-
After that, push changed files from the `lib` and `src` folders to your PR.
|
|
132
|
+
After that, push changed files from the `lib` and `src` folders to your PR. You need to follow the [pattern](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716) of the semantic commit messages (should begin from __fix:__ or __feat:__), like:
|
|
133
|
+
```
|
|
134
|
+
fix: Update Dockerfile to restore build process
|
|
135
|
+
```
|
|
136
|
+
or
|
|
137
|
+
```
|
|
138
|
+
feat: Bump @playwright/test package to the last version
|
|
139
|
+
```
|
|
133
140
|
|
|
134
141
|
## Run tests in CI (Azure Pipelines)
|
|
135
142
|
In order to add an Azure Pipeline for your framework, head over to https://dev.azure.com/spscommerce/ and find your team. You can create a new pipeline by selecting your Git repository. For more information on getting started with Azure, visit https://github.com/SPSCommerce/azure-pipelines-config.
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -19,7 +19,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.expect = void 0;
|
|
21
21
|
__exportStar(require("./globalSetup"), exports);
|
|
22
|
-
__exportStar(require("./globalTeardown"), exports);
|
|
23
22
|
__exportStar(require("./loggerSetup"), exports);
|
|
24
23
|
var matchersSetup_1 = require("./matchersSetup");
|
|
25
24
|
Object.defineProperty(exports, "expect", { enumerable: true, get: function () { return __importDefault(matchersSetup_1).default; } });
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,gDAA8B;AAC9B,iDAAoD;AAA3C,wHAAA,OAAO,OAAU"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Reporter } from '@playwright/test/reporter';
|
|
2
|
+
interface JUnitFixOptions {
|
|
3
|
+
reportJunitFile?: string;
|
|
4
|
+
}
|
|
5
|
+
declare class JunitFixReporter implements Reporter {
|
|
6
|
+
private readonly reportJunitFile;
|
|
7
|
+
constructor(options: JUnitFixOptions);
|
|
8
|
+
onEnd(): void;
|
|
9
|
+
}
|
|
10
|
+
export default JunitFixReporter;
|
|
@@ -0,0 +1,24 @@
|
|
|
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 fs_1 = __importDefault(require("fs"));
|
|
7
|
+
class JunitFixReporter {
|
|
8
|
+
reportJunitFile;
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.reportJunitFile = options.reportJunitFile;
|
|
11
|
+
}
|
|
12
|
+
onEnd() {
|
|
13
|
+
const report = fs_1.default.readFileSync(this.reportJunitFile);
|
|
14
|
+
const reportFixed = String(report).replaceAll(/<testcase(\s+)name="([^"]+?)"/gi, (_all, spaces, name) => {
|
|
15
|
+
// Replace 'test case > test name' to the 'test name test case'
|
|
16
|
+
if (name)
|
|
17
|
+
name = name.replaceAll(/ › /g, ' ');
|
|
18
|
+
return `<testcase${spaces}name="${name}"`;
|
|
19
|
+
});
|
|
20
|
+
fs_1.default.writeFileSync(this.reportJunitFile, reportFixed);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.default = JunitFixReporter;
|
|
24
|
+
//# sourceMappingURL=junitFix.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"junitFix.js","sourceRoot":"","sources":["../../src/reporters/junitFix.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AAOpB,MAAM,gBAAgB;IACH,eAAe,CAAU;IAE1C,YAAY,OAAwB;QAClC,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IACjD,CAAC;IAED,KAAK;QACH,MAAM,MAAM,GAAG,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACrD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,CAC3C,iCAAiC,EACjC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YACrB,+DAA+D;YAC/D,IAAI,IAAI;gBAAE,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAC9C,OAAO,YAAY,MAAM,SAAS,IAAI,GAAG,CAAC;QAC5C,CAAC,CACF,CAAC;QACF,YAAE,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IACtD,CAAC;CACF;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 fs_1 = __importDefault(require("fs"));
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
// Simple reporter for copy attachments to the screenshots folder
|
|
9
|
+
class ScreenshotsReporter {
|
|
10
|
+
onTestEnd(test, result) {
|
|
11
|
+
const screenshotsDirName = path_1.default.join(process.cwd(), 'results-e2e/screenshots/');
|
|
12
|
+
result.attachments.forEach(attachment => {
|
|
13
|
+
// Create folder if un-exists
|
|
14
|
+
if (!fs_1.default.existsSync(screenshotsDirName))
|
|
15
|
+
fs_1.default.mkdirSync(screenshotsDirName, { recursive: true });
|
|
16
|
+
// Copy file as '<description> <test name>.<file ext>'
|
|
17
|
+
fs_1.default.copyFileSync(attachment.path, path_1.default.join(screenshotsDirName, `${test.titlePath().at(-2)} ${test.title}${path_1.default.extname(attachment.path)}`));
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = ScreenshotsReporter;
|
|
22
|
+
//# sourceMappingURL=screenshots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshots.js","sourceRoot":"","sources":["../../src/reporters/screenshots.ts"],"names":[],"mappings":";;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,iEAAiE;AACjE,MAAM,mBAAmB;IACvB,SAAS,CAAC,IAAc,EAAE,MAAkB;QAC1C,MAAM,kBAAkB,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,0BAA0B,CAAC,CAAC;QAChF,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;YACtC,6BAA6B;YAC7B,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC;gBAAE,YAAE,CAAC,SAAS,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9F,sDAAsD;YACtD,YAAE,CAAC,YAAY,CACb,UAAU,CAAC,IAAI,EACf,cAAI,CAAC,IAAI,CACP,kBAAkB,EAClB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAC3E,CACF,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAED,kBAAe,mBAAmB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/e2e-core",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.12",
|
|
4
4
|
"description": "An automation test framework which is based on Playwright.",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -26,12 +26,13 @@
|
|
|
26
26
|
"license": "UNLICENSED",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@playwright/test": "1.46.1",
|
|
29
|
-
"@typescript-eslint/eslint-plugin": "
|
|
30
|
-
"@typescript-eslint/parser": "
|
|
31
|
-
"dotenv": "16.
|
|
32
|
-
"eslint": "
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "6.21.0",
|
|
30
|
+
"@typescript-eslint/parser": "6.21.0",
|
|
31
|
+
"dotenv": "16.4.5",
|
|
32
|
+
"eslint": "8.20.0",
|
|
33
33
|
"jest-expect-message": "1.0.4",
|
|
34
34
|
"jest-extended": "1.2.0",
|
|
35
35
|
"typescript": "4.7.4"
|
|
36
|
-
}
|
|
36
|
+
},
|
|
37
|
+
"packageManager": "yarn@4.4.0+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb"
|
|
37
38
|
}
|
package/playwright.config.js
CHANGED
|
@@ -121,12 +121,13 @@ const config = {
|
|
|
121
121
|
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
|
|
122
122
|
reporter: [
|
|
123
123
|
['junit', { outputFile: path.join(process.cwd(), `results-e2e/reports/${reportName}`) }],
|
|
124
|
-
['list']
|
|
124
|
+
['list'],
|
|
125
|
+
// Special reporters to transform video-s/screen-s to the form what can be displayed in the TestingInspector attachments
|
|
126
|
+
[path.resolve(__dirname, './src/reporters/screenshots.ts')],
|
|
127
|
+
[path.resolve(__dirname, './src/reporters/junitFix.ts'), { reportJunitFile: `results-e2e/reports/${reportName}` }],
|
|
125
128
|
],
|
|
126
129
|
/* Global setup file must export a single function. This function will be run once before all the tests */
|
|
127
130
|
globalSetup: require.resolve('./lib/globalSetup'),
|
|
128
|
-
/* Similarly, run something once after all the tests. */
|
|
129
|
-
globalTeardown: require.resolve('./lib/globalTeardown'),
|
|
130
131
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions */
|
|
131
132
|
use: {
|
|
132
133
|
storageState: !process.env.SKIP_AUTH ? storageStatePath : undefined,
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import type { Reporter } from '@playwright/test/reporter';
|
|
3
|
+
|
|
4
|
+
interface JUnitFixOptions {
|
|
5
|
+
reportJunitFile?: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
class JunitFixReporter implements Reporter {
|
|
9
|
+
private readonly reportJunitFile!: string;
|
|
10
|
+
|
|
11
|
+
constructor(options: JUnitFixOptions) {
|
|
12
|
+
this.reportJunitFile = options.reportJunitFile;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
onEnd() {
|
|
16
|
+
const report = fs.readFileSync(this.reportJunitFile);
|
|
17
|
+
const reportFixed = String(report).replaceAll(
|
|
18
|
+
/<testcase(\s+)name="([^"]+?)"/gi,
|
|
19
|
+
(_all, spaces, name) => {
|
|
20
|
+
// Replace 'test case > test name' to the 'test name test case'
|
|
21
|
+
if (name) name = name.replaceAll(/ › /g, ' ');
|
|
22
|
+
return `<testcase${spaces}name="${name}"`;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
fs.writeFileSync(this.reportJunitFile, reportFixed);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default JunitFixReporter;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import type { Reporter, TestCase, TestResult } from '@playwright/test/reporter';
|
|
4
|
+
|
|
5
|
+
// Simple reporter for copy attachments to the screenshots folder
|
|
6
|
+
class ScreenshotsReporter implements Reporter {
|
|
7
|
+
onTestEnd(test: TestCase, result: TestResult) {
|
|
8
|
+
const screenshotsDirName = path.join(process.cwd(), 'results-e2e/screenshots/');
|
|
9
|
+
result.attachments.forEach(attachment => {
|
|
10
|
+
// Create folder if un-exists
|
|
11
|
+
if (!fs.existsSync(screenshotsDirName)) fs.mkdirSync(screenshotsDirName, { recursive: true });
|
|
12
|
+
// Copy file as '<description> <test name>.<file ext>'
|
|
13
|
+
fs.copyFileSync(
|
|
14
|
+
attachment.path,
|
|
15
|
+
path.join(
|
|
16
|
+
screenshotsDirName,
|
|
17
|
+
`${test.titlePath().at(-2)} ${test.title}${path.extname(attachment.path)}`
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default ScreenshotsReporter;
|
package/lib/globalTeardown.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function globalTeardown(): Promise<void>;
|
package/lib/globalTeardown.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
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 fs_1 = __importDefault(require("fs"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const playwright_config_js_1 = __importDefault(require("../playwright.config.js"));
|
|
9
|
-
async function globalTeardown() {
|
|
10
|
-
const currentProjectNames = playwright_config_js_1.default.projects.map((project) => project.name);
|
|
11
|
-
const oldFolder = path_1.default.join(process.cwd(), 'results-e2e-raw/');
|
|
12
|
-
const newFolder = path_1.default.join(process.cwd(), 'results-e2e/screenshots/');
|
|
13
|
-
fs_1.default.mkdirSync(newFolder, { recursive: true });
|
|
14
|
-
if (fs_1.default.existsSync(oldFolder)) {
|
|
15
|
-
for (const oldSubFolder of fs_1.default.readdirSync(oldFolder)) {
|
|
16
|
-
for (const oldFile of fs_1.default.readdirSync(path_1.default.join(oldFolder, oldSubFolder))) {
|
|
17
|
-
const oldFilePath = `${oldFolder}/${oldSubFolder}/${oldFile}`;
|
|
18
|
-
const newFile = "SPS_" + oldSubFolder
|
|
19
|
-
.substring(oldSubFolder.indexOf("SPS") + 4)
|
|
20
|
-
.split('-')
|
|
21
|
-
.filter(e => !currentProjectNames.includes(e) && !e.includes('retry'))
|
|
22
|
-
.join('_')
|
|
23
|
-
.replace('_', ' ');
|
|
24
|
-
const newFilePath = `${newFolder}/${newFile}.${oldFile.split('.').pop()}`;
|
|
25
|
-
fs_1.default.copyFileSync(oldFilePath, newFilePath);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
exports.default = globalTeardown;
|
|
32
|
-
//# sourceMappingURL=globalTeardown.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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,YAAE,CAAC,YAAY,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;aAC7C;SACJ;KACJ;IACD,OAAO;AACX,CAAC;AArBD,iCAqBC"}
|
package/src/globalTeardown.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import config from '../playwright.config.js';
|
|
4
|
-
|
|
5
|
-
export default async function globalTeardown(): Promise<void> {
|
|
6
|
-
const currentProjectNames = config.projects.map((project: { name: string; }) => project.name);
|
|
7
|
-
const oldFolder = path.join(process.cwd(), 'results-e2e-raw/');
|
|
8
|
-
const newFolder = path.join(process.cwd(), 'results-e2e/screenshots/');
|
|
9
|
-
fs.mkdirSync(newFolder, { recursive: true });
|
|
10
|
-
if (fs.existsSync(oldFolder)) {
|
|
11
|
-
for (const oldSubFolder of fs.readdirSync(oldFolder)) {
|
|
12
|
-
for (const oldFile of fs.readdirSync(path.join(oldFolder, oldSubFolder))) {
|
|
13
|
-
const oldFilePath = `${oldFolder}/${oldSubFolder}/${oldFile}`;
|
|
14
|
-
const newFile = "SPS_" + oldSubFolder
|
|
15
|
-
.substring(oldSubFolder.indexOf("SPS") + 4)
|
|
16
|
-
.split('-')
|
|
17
|
-
.filter(e => !currentProjectNames.includes(e) && !e.includes('retry'))
|
|
18
|
-
.join('_')
|
|
19
|
-
.replace('_', ' ');
|
|
20
|
-
const newFilePath = `${newFolder}/${newFile}.${oldFile.split('.').pop()}`;
|
|
21
|
-
fs.copyFileSync(oldFilePath, newFilePath);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return;
|
|
26
|
-
}
|