@spscommerce/e2e-core 2.4.0 → 2.4.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/Dockerfile +1 -1
- package/Example.test.ts +9 -6
- package/README.md +4 -2
- package/lib/matchersSetup.js +1 -1
- package/lib/matchersSetup.js.map +1 -1
- package/package.json +9 -9
- package/playwright.config.js +3 -1
- package/src/matchersSetup.ts +1 -1
package/Dockerfile
CHANGED
package/Example.test.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { test } from '@playwright/test';
|
|
2
|
-
|
|
3
|
-
import expect from './src/matchersSetup';
|
|
1
|
+
import { test, expect } from '@playwright/test';
|
|
2
|
+
import expectExt from './src/matchersSetup';
|
|
4
3
|
import { enableLogger, disableLogger } from './src/loggerSetup';
|
|
5
4
|
|
|
6
5
|
test.describe('SPS_Example', () => {
|
|
7
|
-
|
|
6
|
+
test.describe.configure({ retries: 1 });
|
|
8
7
|
test.beforeEach(async ({ page }, testInfo) => {
|
|
9
8
|
process.env.CI && await enableLogger(testInfo.titlePath, page);
|
|
10
9
|
await page.goto(`https://test.commerce.spscommerce.com/fulfillment/`);
|
|
@@ -14,13 +13,17 @@ test.describe('SPS_Example', () => {
|
|
|
14
13
|
process.env.CI && await disableLogger();
|
|
15
14
|
});
|
|
16
15
|
|
|
17
|
-
test('
|
|
16
|
+
test('First_test', async ({ page }) => {
|
|
18
17
|
await page.waitForTimeout(10000);
|
|
19
18
|
expect(
|
|
20
19
|
true,
|
|
21
|
-
// false,
|
|
22
20
|
`Custom error message.`
|
|
23
21
|
).toBeTruthy();
|
|
22
|
+
expectExt(
|
|
23
|
+
[1, 2, 3, 4],
|
|
24
|
+
// false,
|
|
25
|
+
`Custom error message.`
|
|
26
|
+
).toIncludeAllMembers([1, 5, 3]);
|
|
24
27
|
});
|
|
25
28
|
|
|
26
29
|
});
|
package/README.md
CHANGED
|
@@ -20,6 +20,7 @@ export USER_PASSWORD="EXAMPLE_PASSWORD"
|
|
|
20
20
|
5. Create .env file in the tests-e2e/ directory with an appropriate process.env variables listed below in the table. E.g.:
|
|
21
21
|
```
|
|
22
22
|
TEST_TIMEOUT=75000
|
|
23
|
+
EXPECT_TIMEOUT=10000
|
|
23
24
|
ACTION_TIMEOUT=45000
|
|
24
25
|
WORKERS=6
|
|
25
26
|
REPO_NAME=fulfillment-ui-v2
|
|
@@ -31,6 +32,7 @@ VIEWPORT={"width": 1920, "height": 1080}
|
|
|
31
32
|
| BROWSER | use + as a separator, e.g edge+firefox | chromium | chromium, firefox, webkit, edge |
|
|
32
33
|
| ENV | auth state is invoked for the defined env | test | test, prod |
|
|
33
34
|
| TEST_TIMEOUT | global timeout for each test | 30000 | [number_in_ms] |
|
|
35
|
+
| EXPECT_TIMEOUT | global timeout for each expect | 5000 | [number_in_ms] |
|
|
34
36
|
| ACTION_TIMEOUT | global timeout for each PW action, like click() | 30000 | [number_in_ms] |
|
|
35
37
|
| SLOWMO | slows down the actions by the specified ms | 0 | [number_in_ms] |
|
|
36
38
|
| WORKERS | number of workers (test threads) | 1 | [number] |
|
|
@@ -99,7 +101,7 @@ You can observe the PW trace file in 3 ways:
|
|
|
99
101
|
## Dockerfile
|
|
100
102
|
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:
|
|
101
103
|
```
|
|
102
|
-
FROM mcr.microsoft.com/playwright:v1.
|
|
104
|
+
FROM mcr.microsoft.com/playwright:v1.28.0-focal
|
|
103
105
|
|
|
104
106
|
ARG BROWSER
|
|
105
107
|
|
|
@@ -184,11 +186,11 @@ Additional info over this framework could be found on [Confluence](https://atlas
|
|
|
184
186
|
Put in a PR against this repo if you fix a bug or come up with an improvement!
|
|
185
187
|
|
|
186
188
|
## Used tools
|
|
187
|
-
- [@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.
|
|
188
189
|
- [@playwright/test](https://github.com/microsoft/playwright) - browser automation and test runner tool
|
|
189
190
|
- [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) - ESLint plugin which provides lint rules for TypeScript codebases
|
|
190
191
|
- [@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
|
|
191
192
|
- [dotenv](https://github.com/motdotla/dotenv) - loads environment variables from a .env file into process.env
|
|
192
193
|
- [eslint](https://github.com/eslint/eslint) - static code analysis tool
|
|
194
|
+
- [jest-expect-message](https://github.com/mattphillips/jest-expect-message) - gives ability to add a custom error message to the assertions
|
|
193
195
|
- [jest-extended](https://github.com/jest-community/jest-extended) - adds additional matchers to default ones making it easy to test everything 🙌
|
|
194
196
|
- [typescript](https://github.com/Microsoft/TypeScript) - language for application-scale JavaScript that adds optional types
|
package/lib/matchersSetup.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const test_1 = require("@playwright/test");
|
|
7
|
-
const withMessage_js_1 = __importDefault(require("
|
|
7
|
+
const withMessage_js_1 = __importDefault(require("jest-expect-message/dist/withMessage.js"));
|
|
8
8
|
const expect = (0, withMessage_js_1.default)(test_1.test.expect);
|
|
9
9
|
const matchers = require('jest-extended');
|
|
10
10
|
expect.extend(matchers);
|
package/lib/matchersSetup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchersSetup.js","sourceRoot":"","sources":["../src/matchersSetup.ts"],"names":[],"mappings":";;;;;AAAA,2CAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"matchersSetup.js","sourceRoot":"","sources":["../src/matchersSetup.ts"],"names":[],"mappings":";;;;;AAAA,2CAAwC;AACxC,6FAAkE;AAElE,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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/e2e-core",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2",
|
|
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",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"author": "SPS Commerce",
|
|
25
25
|
"license": "UNLICENSED",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@
|
|
28
|
-
"@
|
|
29
|
-
"@typescript-eslint/
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"jest-extended": "
|
|
34
|
-
"typescript": "
|
|
27
|
+
"@playwright/test": "1.29.0",
|
|
28
|
+
"@typescript-eslint/eslint-plugin": "5.30.0",
|
|
29
|
+
"@typescript-eslint/parser": "5.30.0",
|
|
30
|
+
"dotenv": "16.0.3",
|
|
31
|
+
"eslint": "7.32.0",
|
|
32
|
+
"jest-expect-message": "1.0.4",
|
|
33
|
+
"jest-extended": "1.2.0",
|
|
34
|
+
"typescript": "4.7.4"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/playwright.config.js
CHANGED
|
@@ -93,7 +93,7 @@ const config = {
|
|
|
93
93
|
timeout: +process.env.TEST_TIMEOUT || 30000,
|
|
94
94
|
/* Maximum time expect() should wait for the condition to be met */
|
|
95
95
|
expect: {
|
|
96
|
-
timeout: 5000
|
|
96
|
+
timeout: +process.env.EXPECT_TIMEOUT || 5000,
|
|
97
97
|
},
|
|
98
98
|
/* Fail the build on CI if you accidentally left test.only in the source code */
|
|
99
99
|
forbidOnly: !!process.env.CI,
|
|
@@ -119,6 +119,8 @@ const config = {
|
|
|
119
119
|
actionTimeout: +process.env.ACTION_TIMEOUT || 30000,
|
|
120
120
|
/* Collect screenshot after each test failure. See https://playwright.dev/docs/test-configuration#automatic-screenshots */
|
|
121
121
|
screenshot: 'only-on-failure',
|
|
122
|
+
/* Record video only when retrying a test for the first time. See https://playwright.dev/docs/test-configuration#automatic-screenshots */
|
|
123
|
+
video: 'on-first-retry',
|
|
122
124
|
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
123
125
|
trace: process.env.TRACER && (process.env.TRACER.toString().toLowerCase() === 'true') ? 'retain-on-failure' : 'off',
|
|
124
126
|
/* Run in headless mode by default (if process.env.HEADLESS is not specified) */
|
package/src/matchersSetup.ts
CHANGED