@spscommerce/e2e-core 2.5.1 → 2.6.1
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 +24 -19
- package/eslint.config.mjs +11 -11
- package/package.json +3 -2
- package/playwright.config.js +5 -1
package/README.md
CHANGED
|
@@ -27,25 +27,26 @@ REPO_NAME=fulfillment-ui-v2
|
|
|
27
27
|
BASEURL=https://test.commerce.spscommerce.com/fulfillment
|
|
28
28
|
VIEWPORT={"width": 1920, "height": 1080}
|
|
29
29
|
```
|
|
30
|
-
| Variable
|
|
31
|
-
|
|
32
|
-
| HEADLESS
|
|
33
|
-
| BROWSER
|
|
34
|
-
| TEST_TIMEOUT
|
|
35
|
-
| EXPECT_TIMEOUT
|
|
36
|
-
| ACTION_TIMEOUT
|
|
37
|
-
| SLOWMO
|
|
38
|
-
| WORKERS
|
|
39
|
-
| TRACER
|
|
40
|
-
| VIEWPORT
|
|
41
|
-
| CI
|
|
42
|
-
| SUITE
|
|
43
|
-
| ENV
|
|
44
|
-
| BASEURL
|
|
45
|
-
| TEST_DIR
|
|
46
|
-
| CONFIG_PATH
|
|
47
|
-
| SETUP_PATH
|
|
48
|
-
| REPO_NAME
|
|
30
|
+
| Variable | description | default | possible values |
|
|
31
|
+
|:----------------|----------------------------------------------------|--------------------------------|---------------------------------|
|
|
32
|
+
| HEADLESS | launch browser in headless/headful mode | true | true, false |
|
|
33
|
+
| BROWSER | use + as a separator, e.g edge+firefox | chromium | chromium, firefox, webkit, edge |
|
|
34
|
+
| TEST_TIMEOUT | global timeout for each test | 30000 | [number_in_ms] |
|
|
35
|
+
| EXPECT_TIMEOUT | global timeout for each expect | 5000 | [number_in_ms] |
|
|
36
|
+
| ACTION_TIMEOUT | global timeout for each PW action, like click() | 30000 | [number_in_ms] |
|
|
37
|
+
| SLOWMO | slows down the actions by the specified ms | 0 | [number_in_ms] |
|
|
38
|
+
| WORKERS | number of workers (test threads) | 1 | [number] |
|
|
39
|
+
| TRACER | create PW actions trace file per each failed test | false | true, false |
|
|
40
|
+
| VIEWPORT | emulates consistent viewport for each page | {"width": 1536, "height": 960} | [string] |
|
|
41
|
+
| CI | used in CI: forbidOnly and maxFailures are applied | false | true, false |
|
|
42
|
+
| SUITE | used in CI: report file name is created per suite | TEST-results.xml | [string] |
|
|
43
|
+
| ENV | invoked auth state environment flag* | test | test, prod |
|
|
44
|
+
| BASEURL | auth state is invoked for the provided url* | - (required) | [string] |
|
|
45
|
+
| TEST_DIR | used in package.json: tests directory path | - (required) | [string] |
|
|
46
|
+
| CONFIG_PATH | used in package.json: .env file path | - | [string] |
|
|
47
|
+
| SETUP_PATH | used in package.json: set sm-th before test start | - | [string] |
|
|
48
|
+
| REPO_NAME | creates GH repo link on test in log files | - | [string] |
|
|
49
|
+
| TESTRAIL_REPORT | enables custom TestRail reporter | - | true, false |
|
|
49
50
|
|
|
50
51
|
\* If you have several urls to run your tests for, consider the following possible set up in the SETUP_PATH file instead of providing BASEURL in the .env file:
|
|
51
52
|
```
|
|
@@ -203,6 +204,9 @@ jobs:
|
|
|
203
204
|
|
|
204
205
|
[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.
|
|
205
206
|
|
|
207
|
+
## Report to TestRail
|
|
208
|
+
We can use the custom [playwright-testrail-reporter](https://github.com/niche-tester/playwright-testrail-reporter) to publish tests result to the TestRail. It enables by the **TESTRAIL_REPORT** environment variable (you can check official docs for the usage capabilities and setup).
|
|
209
|
+
|
|
206
210
|
## Q&A
|
|
207
211
|
If you have any questions or difficulties with this package, reach out to us in [#ffqa](https://spscommerce.slack.com/archives/G01GH392AUX) on Slack.
|
|
208
212
|
Additional info over this framework could be found on [Confluence](https://atlassian.spscommerce.com/wiki/x/jQwlF).
|
|
@@ -217,3 +221,4 @@ Put in a PR against this repo if you fix a bug or come up with an improvement!
|
|
|
217
221
|
- [jest-expect-message](https://github.com/mattphillips/jest-expect-message) - gives ability to add a custom error message to the assertions
|
|
218
222
|
- [jest-extended](https://github.com/jest-community/jest-extended) - adds additional matchers to default ones making it easy to test everything 🙌
|
|
219
223
|
- [typescript](https://github.com/Microsoft/TypeScript) - language for application-scale JavaScript that adds optional types
|
|
224
|
+
- [playwright-testrail-reporter](https://github.com/niche-tester/playwright-testrail-reporter/tree/main) - custom reporter for Playwright Test to seamlessly integrate with TestRail
|
package/eslint.config.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import globals from 'globals';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {fileURLToPath} from 'node:url';
|
|
4
|
-
import {defineConfig, globalIgnores} from 'eslint/config';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { defineConfig, globalIgnores } from 'eslint/config';
|
|
5
5
|
|
|
6
6
|
import tsParser from '@typescript-eslint/parser';
|
|
7
7
|
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
8
8
|
import js from '@eslint/js';
|
|
9
|
-
import {FlatCompat} from '@eslint/eslintrc';
|
|
9
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
10
10
|
|
|
11
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
const __dirname = path.dirname(__filename);
|
|
@@ -17,10 +17,14 @@ const compat = new FlatCompat({
|
|
|
17
17
|
export default defineConfig([globalIgnores(["node_modules/*", "lib/*"]), {
|
|
18
18
|
languageOptions: {
|
|
19
19
|
globals: {
|
|
20
|
-
...globals.browser,
|
|
20
|
+
...globals.browser,
|
|
21
|
+
...globals.amd,
|
|
22
|
+
...globals.node,
|
|
21
23
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
parser: tsParser,
|
|
25
|
+
ecmaVersion: 12,
|
|
26
|
+
sourceType: "module",
|
|
27
|
+
parserOptions: {},
|
|
24
28
|
},
|
|
25
29
|
|
|
26
30
|
extends: compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"),
|
|
@@ -28,11 +32,7 @@ export default defineConfig([globalIgnores(["node_modules/*", "lib/*"]), {
|
|
|
28
32
|
plugins: {
|
|
29
33
|
"@typescript-eslint": typescriptEslint,
|
|
30
34
|
},
|
|
31
|
-
|
|
32
|
-
"rules": {
|
|
33
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
34
|
-
"@typescript-eslint/no-var-requires": "off",
|
|
35
|
+
rules: {
|
|
35
36
|
"@typescript-eslint/no-require-imports": "off",
|
|
36
|
-
"no-empty-pattern": "off"
|
|
37
37
|
},
|
|
38
38
|
}]);
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spscommerce/e2e-core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"lint": "eslint .",
|
|
9
9
|
"build": "tsc --incremental -p tsconfig.json",
|
|
10
|
-
"test": "CONFIG_PATH=$(pwd)/.env HEADLESS=false
|
|
10
|
+
"test": "CONFIG_PATH=$(pwd)/.env HEADLESS=false playwright test"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"eslint": "9.39.1",
|
|
34
34
|
"jest-expect-message": "1.1.3",
|
|
35
35
|
"jest-extended": "1.2.1",
|
|
36
|
+
"playwright-testrail-reporter": "1.3.3",
|
|
36
37
|
"typescript": "4.9.5"
|
|
37
38
|
},
|
|
38
39
|
"packageManager": "yarn@4.4.0+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb"
|
package/playwright.config.js
CHANGED
|
@@ -6,7 +6,6 @@ if (process.env.CONFIG_PATH) {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
const reportName = process.env.SUITE ? `${process.env.SUITE}.xml` : `TEST-result.xml`;
|
|
9
|
-
|
|
10
9
|
const customViewport = process.env.VIEWPORT ? JSON.parse(process.env.VIEWPORT) : { width: 1536, height: 844 };
|
|
11
10
|
|
|
12
11
|
let browserProject = [];
|
|
@@ -126,6 +125,11 @@ const config = {
|
|
|
126
125
|
// Special reporters to transform video-s/screen-s to the form what can be displayed in the TestingInspector attachments
|
|
127
126
|
[path.resolve(__dirname, './lib/reporters/screenshots')],
|
|
128
127
|
[path.resolve(__dirname, './lib/reporters/junitFix'), { reportJunitFile: `results-e2e/reports/${reportName}` }],
|
|
128
|
+
// Testrail custom reporter
|
|
129
|
+
...(process.env.TESTRAIL_REPORT && process.env.TESTRAIL_REPORT === 'true'
|
|
130
|
+
? [['playwright-testrail-reporter']]
|
|
131
|
+
: []
|
|
132
|
+
),
|
|
129
133
|
],
|
|
130
134
|
/* Global setup file must export a single function. This function will be run once before all the tests */
|
|
131
135
|
globalSetup: require.resolve('./lib/globalSetup'),
|