@spscommerce/e2e-core 2.2.3 → 2.2.4
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 +146 -110
- package/package.json +2 -2
- package/playwright.config.js +8 -6
- package/src/globalTeardown.ts +1 -1
package/README.md
CHANGED
|
@@ -1,153 +1,189 @@
|
|
|
1
1
|
[](https://www.spscommerce.com)
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
|
|
3
|
+
# e2e-core
|
|
4
|
+
UI test automation core framework which is based on [Playwright](https://playwright.dev/) and created specifically for SPS Commerce internal UI projects.
|
|
5
5
|
|
|
6
|
-
##
|
|
7
|
-
1.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
3. You can also put in a PR against this repo if you fix a bug or come up with an improvement! In order to achieve it, clone the current project and make a commit for a bug fix or feature implementation.
|
|
12
|
-
|
|
13
|
-
## Initialize Node.js modules
|
|
14
|
-
Now it's time to `npm install` the node modules from `package.json` within the project's root directory:
|
|
15
|
-
```
|
|
16
|
-
npm install
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Credentials
|
|
20
|
-
Create .credentials.sh file with your SPS credentials in the root directory:
|
|
6
|
+
## Connect e2e-core subproject to an exisitng UI project
|
|
7
|
+
1. Create a new folder for an e2e subproject (e.g. tests-e2e/) with a separate `package.json` file there.
|
|
8
|
+
2. Add e2e-core and all other packages that you need for the e2e testing into `package.json`.
|
|
9
|
+
3. Go into the tests-e2e/ directory and install node modules from `package.json`.
|
|
10
|
+
4. Create .credentials.sh file in the tests-e2e/ directory with the external SPS user credentials.
|
|
21
11
|
```
|
|
22
12
|
export USER_EMAIL="EXAMPLE_USER"
|
|
23
13
|
export USER_PASSWORD="EXAMPLE_PASSWORD"
|
|
24
14
|
# Note: if USER_PASSWORD contains \ or " symbols, please add \ symbol before it.
|
|
25
15
|
```
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
16
|
+
> Attention:
|
|
17
|
+
> Internal SPS user login flow requires MFA step. Accounts with MFA cannot be fully automated, and need manual intervention.
|
|
18
|
+
> Follow the discussion: https://github.com/SPSCommerce/sps-atlas/discussions/111
|
|
30
19
|
|
|
31
|
-
|
|
20
|
+
5. Create .env file in the tests-e2e/ directory with an appropriate process.env variables listed below in the table. E.g.:
|
|
32
21
|
```
|
|
33
|
-
|
|
22
|
+
TIMEOUT=75000
|
|
23
|
+
WORKERS=6
|
|
34
24
|
```
|
|
35
|
-
|
|
36
|
-
## CLI options
|
|
37
|
-
|
|
38
25
|
| Variable | description | default | possible values |
|
|
39
26
|
| ------------------: | -------------------------------------------------- | ------------------------------ | ------------------------------------ |
|
|
40
27
|
| HEADLESS | launch browser in headless/headful mode | true | true, false |
|
|
41
28
|
| BROWSER | use + as a separator, e.g edge+firefox | chromium | chromium, firefox, webkit, edge |
|
|
42
|
-
| ENV | auth state is invoked for the defined env | test | test, prod
|
|
43
|
-
| SLOWMO | slow down an execution for debugging | 0 | [number_in_ms] |
|
|
29
|
+
| ENV | auth state is invoked for the defined env | test | test, prod |
|
|
44
30
|
| TIMEOUT | global timeout for each test | 30000 | [number_in_ms] |
|
|
45
|
-
| WORKERS | number of workers (test threads) |
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
| SUITE |
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
docker build -t ffui/e2e .
|
|
54
|
-
```
|
|
55
|
-
```
|
|
56
|
-
docker run -e USER_EMAIL -e USER_PASSWORD -it --rm --ipc=host --memory=6g --shm-size=1g ffui/e2e
|
|
57
|
-
```
|
|
58
|
-
```
|
|
59
|
-
USER_EMAIL=[your_email] USER_PASSWORD=[your_pwd] xvfb-run --auto-servernum npm run test
|
|
60
|
-
```
|
|
61
|
-
> Notes:
|
|
62
|
-
> - --ipc=host is used since Chrome can run out of memory without this flag [Docker doc](https://docs.docker.com/engine/reference/run/#ipc-settings---ipc)
|
|
63
|
-
> - --shm-size=1g is used since Docker runs a container with a /dev/shm shared memory space 64MB which is typically too small for Chromium and will cause Chromium to crash when rendering large pages
|
|
64
|
-
> - --auto-servernum usage is recommended in order to run command with a random display number
|
|
65
|
-
> - xvfb-run is used on Linux agents for headed execution since it requires Xvfb to be installed. Playwright official Docker image has Xvfb pre-installed
|
|
66
|
-
|
|
31
|
+
| WORKERS | number of workers (test threads) | 1 | [number] |
|
|
32
|
+
| TRACER | create PW actions trace file per each failed test | false | true, false |
|
|
33
|
+
| VIEWPORT | emulates consistent viewport for each page | { width: 1536, height: 960 } | [string] |
|
|
34
|
+
| CI | used in CI: forbidOnly and maxFailures are applied | false | true, false |
|
|
35
|
+
| SUITE | used in CI: report file name is created per suite | TEST-results.xml | [string] |
|
|
36
|
+
| TEST_DIR | used in package.json: tests directory path | - | [string] |
|
|
37
|
+
| CONFIG_PATH | used in package.json: .env file path | - | [string] |
|
|
38
|
+
| SETUP_PATH | used in package.json: globalSetup.js file path | - | [string] |
|
|
67
39
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
In order to show a trace file run the following commands:
|
|
71
|
-
```
|
|
72
|
-
cd [trace_file_path]
|
|
40
|
+
6. Setup the following "scripts" commands in the `package.json` according to your paths:
|
|
73
41
|
```
|
|
42
|
+
"test": ". .credentials.sh && CONFIG_PATH=$(pwd)/.env SETUP_PATH=$(pwd)/src/globalSetup.js TEST_DIR=$(pwd) HEADLESS=false playwright test --config=node_modules/@spscommerce/e2e-core/playwright.config.js",
|
|
43
|
+
"test:ci": "CONFIG_PATH=$(pwd)/.env SETUP_PATH=$(pwd)/src/helpers/urlSetup.js TEST_DIR=$(pwd) CI=true playwright test --config=node_modules/@spscommerce/e2e-core/playwright.config.js"
|
|
74
44
|
```
|
|
75
|
-
|
|
45
|
+
7. Add your first test file:
|
|
76
46
|
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# Configuration files
|
|
80
|
-
Jest and jest-playwright config files were written in CommonJS style (not ESM). For more details, please check the following GH issues:
|
|
81
|
-
|
|
82
|
-
https://github.com/facebook/jest/issues/9430
|
|
47
|
+
import { Page, test } from '@playwright/test';
|
|
48
|
+
import { enableLogger, disableLogger, expect } from '@spscommerce/e2e-core';
|
|
83
49
|
|
|
84
|
-
|
|
50
|
+
test.describe('SPS_MyFirstTest', () => {
|
|
85
51
|
|
|
52
|
+
test.beforeEach(async ({}, testInfo) => {
|
|
53
|
+
await enableLogger(testInfo.titlePath, page);
|
|
54
|
+
});
|
|
86
55
|
|
|
87
|
-
|
|
88
|
-
|
|
56
|
+
test.afterEach(async () => {
|
|
57
|
+
await disableLogger();
|
|
58
|
+
});
|
|
89
59
|
|
|
90
|
-
|
|
60
|
+
test('Transactions_is_opened_with_content', async () => {
|
|
61
|
+
await page.goto(https://test.commerce.spscommerce.com/);
|
|
62
|
+
await page.waitForTimeout(10000);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
```
|
|
66
|
+
> Attention:
|
|
67
|
+
> Start all the decribe block names with SPS_ prefix. If not, created screenshots and log files won't be attached to an appropriate test.
|
|
91
68
|
|
|
92
|
-
|
|
93
|
-
|
|
69
|
+
### Additional options
|
|
70
|
+
If CI is set to true, the forbidOnly and maxFailures options are applied.
|
|
71
|
+
- forbidOnly: Fail the build on CI if you accidentally left test.only in the source code
|
|
72
|
+
- maxFailures: Stop test suite execution after reaching 5 failed tests and skip any tests that were not executed yet.
|
|
94
73
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
- page <[Page]> - Playwright page instance (since a new context for every test file also creates a new page for it)
|
|
74
|
+
### Authentication
|
|
75
|
+
Authentication flow was implemented in the e2e-core library. When tests are laucnhed 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.
|
|
76
|
+
> Attention:
|
|
77
|
+
> 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.
|
|
100
78
|
|
|
101
|
-
|
|
79
|
+
### Global setup
|
|
80
|
+
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.
|
|
102
81
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
Global hooks are applied for each test suite before start. It is posible to override it for a specific suite directly in the test file.
|
|
82
|
+
### Results
|
|
83
|
+
After tests finishes, you can observe test results in the results-e2e/ folder:
|
|
84
|
+
- screenshot folder with screen and trace file (if TRACER=true) for each failed test
|
|
85
|
+
- log folder with log file for each test regardless its status
|
|
86
|
+
- reports folder with compatible junit xml files (Azure test results friendly format)
|
|
87
|
+
- auth folder with an invoked auth state
|
|
110
88
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
- delete "heavy" trace file after test is finished successfully
|
|
117
|
-
- skip all further tests in suite if at least one test in suite is failed (applicable for a long-scenario test flows)
|
|
89
|
+
### Tracer
|
|
90
|
+
You can observe the PW trace file in 3 ways:
|
|
91
|
+
- open a trace file via the terminal CLI: npx playwright show-trace [trace_file_path].zip
|
|
92
|
+
- use PW Trace Viewer web app: https://trace.playwright.dev/
|
|
93
|
+
- install "Playwright Trace Viewer for VSCode" extension: https://marketplace.visualstudio.com/items?itemName=ryanrosello-og.playwright-vscode-trace-viewer
|
|
118
94
|
|
|
119
|
-
|
|
95
|
+
## Dockerfile
|
|
96
|
+
PW provides an official Docker image. These image includes all the dependencies needed to run browsers in a Docker container, and also include the browsers themselves. Here is an example of the Dockerfile:
|
|
97
|
+
```
|
|
98
|
+
FROM mcr.microsoft.com/playwright:v1.21.1
|
|
120
99
|
|
|
121
|
-
|
|
122
|
-
Jest configuration in combination with [ts-jest](https://github.com/kulshekhar/ts-jest) is defined in the transform option in [jest.config.js](jest.config.js).
|
|
123
|
-
Types are used directly in [tsconfig.json](tsconfig.json) via types option.
|
|
100
|
+
ARG BROWSER
|
|
124
101
|
|
|
125
|
-
|
|
126
|
-
|
|
102
|
+
RUN mkdir e2e
|
|
103
|
+
WORKDIR /e2e
|
|
104
|
+
COPY . .
|
|
105
|
+
RUN npm install
|
|
106
|
+
RUN if [ "$BROWSER" = "msedge" ]; then npx playwright install msedge; fi
|
|
107
|
+
```
|
|
108
|
+
> Attention:
|
|
109
|
+
> Installed Playwright package version must match the Docker image version.
|
|
127
110
|
|
|
128
111
|
## Run tests in CI (Azure Pipelines)
|
|
129
112
|
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.
|
|
130
|
-
|
|
131
|
-
|
|
113
|
+
> Attention: Do not forget to set up USER_EMAIL and USER_PASSWORD variables in Azure UI.
|
|
114
|
+
Here is an example of a job in the yaml file:
|
|
115
|
+
```
|
|
116
|
+
jobs:
|
|
117
|
+
- job: TestRun
|
|
118
|
+
pool: BUILD-LINUX
|
|
119
|
+
timeoutInMinutes: 20
|
|
120
|
+
steps:
|
|
121
|
+
- task: DockerCmd@7
|
|
122
|
+
displayName: 'Test execution'
|
|
123
|
+
continueOnError: true
|
|
124
|
+
inputs:
|
|
125
|
+
dockerfile: 'Dockerfile'
|
|
126
|
+
dockerBuildArgs: '--build-arg BROWSER=${{parameters.browser}}'
|
|
127
|
+
dockerImage: 'ffui/e2e'
|
|
128
|
+
imageSource: 'Dockerfile'
|
|
129
|
+
dockerRunArgs: --ipc=host --memory=6g --shm-size=1g
|
|
130
|
+
awsAssumeRole: $(BuildRole)
|
|
131
|
+
dockerEnvVars: |
|
|
132
|
+
USER_PASSWORD=$(USER_PASSWORD)
|
|
133
|
+
USER_EMAIL=$(USER_EMAIL)
|
|
134
|
+
BROWSER=${{parameters.browser}}
|
|
135
|
+
URL=${{parameters.url}}
|
|
136
|
+
SUITE=$(suite)
|
|
137
|
+
CI=true
|
|
138
|
+
dockerCmd: |
|
|
139
|
+
npx playwright install
|
|
140
|
+
xvfb-run --auto-servernum npm run test:ci $(suite)
|
|
141
|
+
mountCustomVolume: true
|
|
142
|
+
externalMountLocation: '$(Build.ArtifactStagingDirectory)/results'
|
|
143
|
+
internalMountLocation: '/e2e/results-e2e'
|
|
144
|
+
- task: PublishTestResults@2
|
|
145
|
+
displayName: 'Publish test results'
|
|
146
|
+
inputs:
|
|
147
|
+
testResultsFiles: '**/*.xml'
|
|
148
|
+
searchFolder: '$(Build.ArtifactStagingDirectory)/results/reports/'
|
|
149
|
+
- task: TestingInspector@1
|
|
150
|
+
displayName: 'Publish log files and failed test screenshots'
|
|
151
|
+
inputs:
|
|
152
|
+
screenshotsFolder: '$(Build.ArtifactStagingDirectory)/results/screenshots'
|
|
153
|
+
logsFolder: '$(Build.ArtifactStagingDirectory)/results/logs'
|
|
154
|
+
- task: PublishBuildArtifacts@1
|
|
155
|
+
displayName: 'Upload test results artifacts'
|
|
156
|
+
condition: always()
|
|
157
|
+
inputs:
|
|
158
|
+
pathtoPublish: '$(Build.ArtifactStagingDirectory)/results'
|
|
159
|
+
artifactName: 'results'
|
|
160
|
+
publishLocation: 'Container'
|
|
161
|
+
- task: SlackNotification@1
|
|
162
|
+
displayName: Slack notification (qa channel)
|
|
163
|
+
condition: in(variables['Build.Reason'],'Manual')
|
|
164
|
+
inputs:
|
|
165
|
+
channel: 'azure-autotests-private'
|
|
166
|
+
defaultMessage: true
|
|
167
|
+
```
|
|
168
|
+
> Notes:
|
|
169
|
+
> - --ipc=host is used since Chrome can run out of memory without this flag [Docker doc](https://docs.docker.com/engine/reference/run/#ipc-settings---ipc)
|
|
170
|
+
> - --shm-size=1g is used since Docker runs a container with a /dev/shm shared memory space 64MB which is typically too small for Chromium and will cause Chromium to crash when rendering large pages
|
|
171
|
+
> - --auto-servernum usage is recommended in order to run command with a random display number
|
|
172
|
+
> - xvfb-run is used on Linux agents for headed execution since it requires Xvfb to be installed. Playwright official Docker image has Xvfb pre-installed
|
|
173
|
+
|
|
174
|
+
[TestingInspector@1](https://github.com/SPSCommerce/azure-pipelines-extensions/tree/main/extensions/workflow#testinginspector) - Azure DevOps extension used in CI pipeline to upload screenshot and log files into the test results report.
|
|
132
175
|
|
|
133
176
|
## Q&A
|
|
134
|
-
If you have any questions or difficulties with this
|
|
135
|
-
Additional info over this
|
|
177
|
+
If you have any questions or difficulties with this package, reach out to us in [#ffqa](https://spscommerce.slack.com/archives/G01GH392AUX) on Slack.
|
|
178
|
+
Additional info over this framework could be found on [Confluence](https://atlassian.spscommerce.com/wiki/x/jQwlF).
|
|
179
|
+
Put in a PR against this repo if you fix a bug or come up with an improvement!
|
|
136
180
|
|
|
137
181
|
## Used tools
|
|
138
|
-
- [@
|
|
139
|
-
- [@
|
|
182
|
+
- [@alex_neo/jest-expect-message](https://github.com/alexneo2003/jest-expect-message) - gives ability to add a custom error message to the assertions. We use this forked lib since there is a [bug](https://github.com/mattphillips/jest-expect-message/issues/39) in the original one.
|
|
183
|
+
- [@playwright/test](https://github.com/microsoft/playwright) - browser automation and test runner tool
|
|
140
184
|
- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) - ESLint plugin which provides lint rules for TypeScript codebases
|
|
141
185
|
- [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint) - ESLint parser which leverages TypeScript ESTree to allow for ESLint to lint TypeScript source code
|
|
186
|
+
- [dotenv](https://github.com/motdotla/dotenv) - loads environment variables from a .env file into process.env
|
|
142
187
|
- [eslint](https://github.com/eslint/eslint) - static code analysis tool
|
|
143
|
-
- [
|
|
144
|
-
- [eslint-plugin-jest-playwright](https://github.com/playwright-community/eslint-plugin-playwright) - ESLint plugin for the Playwright testing needs
|
|
145
|
-
- [jest](https://github.com/facebook/jest) - testing library for creating, structuring, running and asserting tests
|
|
146
|
-
- [jest-junit](https://github.com/jest-community/jest-junit) - reporter that creates compatible junit xml files
|
|
147
|
-
- [jest-circus](https://github.com/facebook/jest) - test runner that allows to bind to events via a custom environment
|
|
148
|
-
- [jest-expect-message](https://github.com/mattphillips/jest-expect-message) - ability to add a custom error message to the Jest assertions
|
|
149
|
-
- [jest-playwright-preset](https://github.com/playwright-community/jest-playwright) - integrates Jest and Playwright
|
|
150
|
-
- [node-fetch](https://github.com/node-fetch/node-fetch) - light-weight module that brings Fetch API to Node.js
|
|
151
|
-
- [playwright](https://github.com/microsoft/playwright) - browser automation tool
|
|
188
|
+
- [jest-extended](https://github.com/jest-community/jest-extended) - adds additional matchers to default ones making it easy to test everything 🙌
|
|
152
189
|
- [typescript](https://github.com/Microsoft/TypeScript) - language for application-scale JavaScript that adds optional types
|
|
153
|
-
- [ts-jest](https://github.com/kulshekhar/ts-jest) - Jest transformer to test projects written in TypeScript
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/e2e-core",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.4",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"license": "UNLICENSED",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@alex_neo/jest-expect-message": "^1.0.5",
|
|
28
|
-
"@playwright/test": "^1.
|
|
28
|
+
"@playwright/test": "^1.21.1",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
|
30
30
|
"@typescript-eslint/parser": "^4.33.0",
|
|
31
31
|
"dotenv": "^16.0.0",
|
package/playwright.config.js
CHANGED
|
@@ -44,15 +44,12 @@ switch (process.env.BROWSER) {
|
|
|
44
44
|
// @ts-check
|
|
45
45
|
/** @type {import('@playwright/test').PlaywrightTestConfig} */
|
|
46
46
|
const config = {
|
|
47
|
+
/* Directory that will be recursively scanned for test files. */
|
|
47
48
|
testDir: process.env.TEST_DIR,
|
|
48
|
-
|
|
49
49
|
/* Maximum time one test can run for. */
|
|
50
50
|
timeout: +process.env.TIMEOUT || 30000,
|
|
51
|
+
/* Maximum time expect() should wait for the condition to be met. */
|
|
51
52
|
expect: {
|
|
52
|
-
/**
|
|
53
|
-
* Maximum time expect() should wait for the condition to be met.
|
|
54
|
-
* For example in `await expect(locator).toHaveText();`
|
|
55
|
-
*/
|
|
56
53
|
timeout: 5000
|
|
57
54
|
},
|
|
58
55
|
/* Fail the build on CI if you accidentally left test.only in the source code. */
|
|
@@ -68,7 +65,9 @@ const config = {
|
|
|
68
65
|
['junit', { outputFile: path.join(process.cwd(), `results-e2e/reports/${reportName}`) }],
|
|
69
66
|
['list']
|
|
70
67
|
],
|
|
68
|
+
/* Global setup file must export a single function. This function will be run once before all the tests. */
|
|
71
69
|
globalSetup: require.resolve('./lib/globalSetup'),
|
|
70
|
+
/* Similarly, run something once after all the tests. */
|
|
72
71
|
globalTeardown: require.resolve('./lib/globalTeardown'),
|
|
73
72
|
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
74
73
|
use: {
|
|
@@ -79,8 +78,11 @@ const config = {
|
|
|
79
78
|
screenshot: 'only-on-failure',
|
|
80
79
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
81
80
|
trace: process.env.TRACER ? 'retain-on-failure' : 'off',
|
|
82
|
-
|
|
81
|
+
/* Run in headless mode by default (if process.env.HEADLESS is not specified). */
|
|
83
82
|
headless: !process.env.HEADLESS || process.env.HEADLESS === 'true' ? true : false,
|
|
83
|
+
/* Emulates consistent viewport for each page. */
|
|
84
|
+
viewport: JSON.parse(process.env.VIEWPORT) || { width: 1536, height: 960 },
|
|
85
|
+
/* Whether to ignore HTTPS errors when sending network requests. */
|
|
84
86
|
ignoreHTTPSErrors: true,
|
|
85
87
|
/* Base URL to use in actions like `await page.goto('/')`. */
|
|
86
88
|
// baseURL: 'http://localhost:3000',
|
package/src/globalTeardown.ts
CHANGED
|
@@ -9,7 +9,7 @@ async function globalTeardown() {
|
|
|
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 = "
|
|
12
|
+
const newFile = "SPS_" + oldSubFolder.substring(oldSubFolder.indexOf("SPS-")).split('-').slice(1, -1).join('_').replace('_', ' ');
|
|
13
13
|
const newFilePath = `${newFolder}/${newFile}.${oldFile.split('.').pop()}`;
|
|
14
14
|
fs.copyFileSync(oldFilePath, newFilePath);
|
|
15
15
|
}
|