@spscommerce/e2e-core 2.2.2 → 2.2.5

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 CHANGED
@@ -1,153 +1,190 @@
1
1
  [![SPS Commerce](https://img.shields.io/badge/sps-commerce-0097cc.svg?style=flat-square&colorA=62686b)](https://www.spscommerce.com)
2
2
 
3
- # sps-e2e-core
4
- E2E test automation framework template based on [Playwright](https://playwright.dev/), [Jest](https://jestjs.io) and [TypeScript](https://www.typescriptlang.org).
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
- ## Start the project depending on your use-case
7
- 1. If you start UI project from scratch -> go to the [ds-react-seed](https://github.com/SPSCommerce/ds-react-seed) repository and follow the instractions there.
8
-
9
- 2. If you already have your UI project set up -> add the current test automation project as a peer dependency to an existing one.
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
- Run:
27
- ```
28
- source .credentials.sh
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
- ## Run tests
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
- HEADLESS=false BROWSER=chromium npm run test
22
+ TIMEOUT=75000
23
+ WORKERS=6
24
+ VIEWPORT={"width": 1920, "height": 1080}
34
25
  ```
35
-
36
- ## CLI options
37
-
38
26
  | Variable | description | default | possible values |
39
27
  | ------------------: | -------------------------------------------------- | ------------------------------ | ------------------------------------ |
40
28
  | HEADLESS | launch browser in headless/headful mode | true | true, false |
41
29
  | BROWSER | use + as a separator, e.g edge+firefox | chromium | chromium, firefox, webkit, edge |
42
- | URL | auth state is invoked for the defined env | test | test, prod etc. |
43
- | SLOWMO | slow down an execution for debugging | 0 | [number_in_ms] |
30
+ | ENV | auth state is invoked for the defined env | test | test, prod |
44
31
  | TIMEOUT | global timeout for each test | 30000 | [number_in_ms] |
45
- | WORKERS | number of workers (test threads) | number of CPUs minus 1 | [number] |
46
- | LOGGER | log all console errors, failed requests per test | false | true, false |
47
- | TRACER | create Playwright actions trace info file per test | false | true, false |
48
- | VIDEO | record a video for each test file | false | true, false |
49
- | SUITE | if defined, report file name is created per suite | - | [string] |
50
-
51
- ## Run tests in Docker container
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
-
32
+ | WORKERS | number of workers (test threads) | 1 | [number] |
33
+ | TRACER | create PW actions trace file per each failed test | false | true, false |
34
+ | VIEWPORT | emulates consistent viewport for each page | {"width": 1536, "height": 960} | [string] |
35
+ | CI | used in CI: forbidOnly and maxFailures are applied | false | true, false |
36
+ | SUITE | used in CI: report file name is created per suite | TEST-results.xml | [string] |
37
+ | TEST_DIR | used in package.json: tests directory path | - | [string] |
38
+ | CONFIG_PATH | used in package.json: .env file path | - | [string] |
39
+ | SETUP_PATH | used in package.json: globalSetup.js file path | - | [string] |
67
40
 
68
- ## Trace Viewer
69
-
70
- In order to show a trace file run the following commands:
71
- ```
72
- cd [trace_file_path]
41
+ 6. Setup the following "scripts" commands in the `package.json` according to your paths:
73
42
  ```
43
+ "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",
44
+ "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
45
  ```
75
- npx playwright show-trace [trace_file_name].zip
46
+ 7. Add your first test file:
76
47
  ```
77
- Detailed information could be found on [Confluence](https://atlassian.spscommerce.com/wiki/pages/viewpage.action?spaceKey=FUL&title=UI+End-to-end+test+automation+core).
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
48
+ import { Page, test } from '@playwright/test';
49
+ import { enableLogger, disableLogger, expect } from '@spscommerce/e2e-core';
83
50
 
84
- https://github.com/playwright-community/jest-playwright/issues/718
51
+ test.describe('SPS_MyFirstTest', () => {
85
52
 
53
+ test.beforeEach(async ({}, testInfo) => {
54
+ await enableLogger(testInfo.titlePath, page);
55
+ });
86
56
 
87
- ## Playwright configuration
88
- Playwright (browser options) is configured in [jest-playwright-config.js](jest-playwright.config.js). More details about the Playwright configuration can be found here [https://github.com/playwright-community/jest-playwright/#configuration](https://github.com/playwright-community/jest-playwright/#configuration).
57
+ test.afterEach(async () => {
58
+ await disableLogger();
59
+ });
89
60
 
90
- > Note: browsers are always launched *incognito* so that the browser retains *no state at all* including cookies, local database and caching
61
+ test('Transactions_is_opened_with_content', async () => {
62
+ await page.goto(https://test.commerce.spscommerce.com/);
63
+ await page.waitForTimeout(10000);
64
+ });
65
+ });
66
+ ```
67
+ > Attention:
68
+ > 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
69
 
92
- ## Jest configuration
93
- Jest (test options) is configured in [jest.config.js](jest.config.js). More details about the Jest configuration can be found here [https://jestjs.io/docs/configuration](https://jestjs.io/docs/configuration).
70
+ ### Additional options
71
+ If CI is set to true, the forbidOnly and maxFailures options are applied.
72
+ - forbidOnly: Fail the build on CI if you accidentally left test.only in the source code
73
+ - maxFailures: Stop test suite execution after reaching 5 failed tests and skip any tests that were not executed yet.
94
74
 
95
- ## Global variables
96
- - browserName <[string]> - name of the current browser channel (chromium, firefox or webkit)
97
- - browser <[Browser]> - Playwright browser instance
98
- - context <[Context]> - a new Playwright context instance for each new test file
99
- - page <[Page]> - Playwright page instance (since a new context for every test file also creates a new page for it)
75
+ ### Authentication
76
+ 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.
77
+ > Attention:
78
+ > 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
79
 
101
- All of them are available globally in each Jest hook, test.
80
+ ### Global setup
81
+ 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
82
 
103
- ## Usage with custom globalSetup
104
- Custom globalSetup is set in [jest.config.js](jest.config.js) and configured in [jest.auth.js](jest.auth.js).
105
- An auth state is invoking one time via an API call in order to save it into a file and inject it into a new browser context created for each test suite.
106
-
107
- ## Global test hooks
108
- Jest global hooks are set in [jest.config.js](jest.config.js) and configured in [jest.setup.js](jest.setup.js).
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.
83
+ ### Results
84
+ After tests finishes, you can observe test results in the results-e2e/ folder:
85
+ - screenshot folder with screen and trace file (if TRACER=true) for each failed test
86
+ - log folder with log file for each test regardless its status
87
+ - reports folder with compatible junit xml files (Azure test results friendly format)
88
+ - auth folder with an invoked auth state
110
89
 
111
- ## Environment specific usage
112
- If you want your tests to behave in a specific way in a certain test execution time, you can add a custom test environment which is set in [jest.config.js](jest.config.js) and configured in [jest-environment.config.js](jest-environment.config.js) file.
113
- Here are some use-case examples when you probably need a custom environment:
114
- - take a screenshot during the test failure
115
- - delete log/trace file before test starts if it runs twice due to jest.retryTimes() option
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)
90
+ ### Tracer
91
+ You can observe the PW trace file in 3 ways:
92
+ - open a trace file via the terminal CLI: npx playwright show-trace [trace_file_path].zip
93
+ - use PW Trace Viewer web app: https://trace.playwright.dev/
94
+ - install "Playwright Trace Viewer for VSCode" extension: https://marketplace.visualstudio.com/items?itemName=ryanrosello-og.playwright-vscode-trace-viewer
118
95
 
119
- All the described use-cases were already implemented in the current project. You can remove it if you do not need it.
96
+ ## Dockerfile
97
+ 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:
98
+ ```
99
+ FROM mcr.microsoft.com/playwright:v1.21.1
120
100
 
121
- ## Usage with Typescript
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.
101
+ ARG BROWSER
124
102
 
125
- ## Reports
126
- Reporting is set and configured in [jest.config.js](jest.config.js). [jest-junit](https://github.com/jest-community/jest-junit) creates compatible junit xml files (Azure test results friendly format).
103
+ RUN mkdir e2e
104
+ WORKDIR /e2e
105
+ COPY . .
106
+ RUN npm install
107
+ RUN if [ "$BROWSER" = "msedge" ]; then npx playwright install msedge; fi
108
+ ```
109
+ > Attention:
110
+ > Installed Playwright package version must match the Docker image version.
127
111
 
128
112
  ## Run tests in CI (Azure Pipelines)
129
113
  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
- Yaml file example is already included into the current project. Please edit it upon your needs.
131
- Detailed information could be found on [Confluence](https://atlassian.spscommerce.com/wiki/pages/viewpage.action?spaceKey=FUL&title=UI+End-to-end+test+automation+core).
114
+ > Attention: Do not forget to set up USER_EMAIL and USER_PASSWORD variables in Azure UI.
115
+ Here is an example of a job in the yaml file:
116
+ ```
117
+ jobs:
118
+ - job: TestRun
119
+ pool: BUILD-LINUX
120
+ timeoutInMinutes: 20
121
+ steps:
122
+ - task: DockerCmd@7
123
+ displayName: 'Test execution'
124
+ continueOnError: true
125
+ inputs:
126
+ dockerfile: 'Dockerfile'
127
+ dockerBuildArgs: '--build-arg BROWSER=${{parameters.browser}}'
128
+ dockerImage: 'ffui/e2e'
129
+ imageSource: 'Dockerfile'
130
+ dockerRunArgs: --ipc=host --memory=6g --shm-size=1g
131
+ awsAssumeRole: $(BuildRole)
132
+ dockerEnvVars: |
133
+ USER_PASSWORD=$(USER_PASSWORD)
134
+ USER_EMAIL=$(USER_EMAIL)
135
+ BROWSER=${{parameters.browser}}
136
+ URL=${{parameters.url}}
137
+ SUITE=$(suite)
138
+ CI=true
139
+ dockerCmd: |
140
+ npx playwright install
141
+ xvfb-run --auto-servernum npm run test:ci $(suite)
142
+ mountCustomVolume: true
143
+ externalMountLocation: '$(Build.ArtifactStagingDirectory)/results'
144
+ internalMountLocation: '/e2e/results-e2e'
145
+ - task: PublishTestResults@2
146
+ displayName: 'Publish test results'
147
+ inputs:
148
+ testResultsFiles: '**/*.xml'
149
+ searchFolder: '$(Build.ArtifactStagingDirectory)/results/reports/'
150
+ - task: TestingInspector@1
151
+ displayName: 'Publish log files and failed test screenshots'
152
+ inputs:
153
+ screenshotsFolder: '$(Build.ArtifactStagingDirectory)/results/screenshots'
154
+ logsFolder: '$(Build.ArtifactStagingDirectory)/results/logs'
155
+ - task: PublishBuildArtifacts@1
156
+ displayName: 'Upload test results artifacts'
157
+ condition: always()
158
+ inputs:
159
+ pathtoPublish: '$(Build.ArtifactStagingDirectory)/results'
160
+ artifactName: 'results'
161
+ publishLocation: 'Container'
162
+ - task: SlackNotification@1
163
+ displayName: Slack notification (qa channel)
164
+ condition: in(variables['Build.Reason'],'Manual')
165
+ inputs:
166
+ channel: 'azure-autotests-private'
167
+ defaultMessage: true
168
+ ```
169
+ > Notes:
170
+ > - --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)
171
+ > - --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
172
+ > - --auto-servernum usage is recommended in order to run command with a random display number
173
+ > - 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
174
+
175
+ [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
176
 
133
177
  ## Q&A
134
- If you have any questions or difficulties with this template, reach out to us in [#ffuiqa](https://spscommerce.slack.com/archives/G01GH392AUX) on Slack.
135
- Additional info over this template could be found on [Confluence](https://atlassian.spscommerce.com/wiki/x/jQwlF).
178
+ If you have any questions or difficulties with this package, reach out to us in [#ffqa](https://spscommerce.slack.com/archives/G01GH392AUX) on Slack.
179
+ Additional info over this framework could be found on [Confluence](https://atlassian.spscommerce.com/wiki/x/jQwlF).
180
+ Put in a PR against this repo if you fix a bug or come up with an improvement!
136
181
 
137
182
  ## Used tools
138
- - [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) - type definitions for Jest
139
- - [@types/jest-expect-message](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest-expect-message) - type definitions for jest-expect-message
183
+ - [@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.
184
+ - [@playwright/test](https://github.com/microsoft/playwright) - browser automation and test runner tool
140
185
  - [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint) - ESLint plugin which provides lint rules for TypeScript codebases
141
186
  - [@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
187
+ - [dotenv](https://github.com/motdotla/dotenv) - loads environment variables from a .env file into process.env
142
188
  - [eslint](https://github.com/eslint/eslint) - static code analysis tool
143
- - [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) - ESLint plugin for Jest
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
189
+ - [jest-extended](https://github.com/jest-community/jest-extended) - adds additional matchers to default ones making it easy to test everything 🙌
152
190
  - [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
@@ -1,4 +1,27 @@
1
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -6,6 +29,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
29
  const fs_1 = __importDefault(require("fs"));
7
30
  const path_1 = __importDefault(require("path"));
8
31
  const test_1 = require("@playwright/test");
32
+ const domain = 'commerce.spscommerce.com';
33
+ const baseUrl = process.env.ENV && process.env.ENV === 'prod' ? 'https://' + domain : 'https://test.' + domain;
9
34
  async function globalSetup() {
10
35
  // Remove custom sub-folders for test artifacts
11
36
  const resultsFolder = path_1.default.join(process.cwd(), 'results-e2e/');
@@ -25,7 +50,7 @@ async function globalSetup() {
25
50
  await context.tracing.start({ screenshots: true, snapshots: true });
26
51
  const page = await context.newPage();
27
52
  try {
28
- await page.goto(process.env.BASEURL);
53
+ await page.goto(baseUrl);
29
54
  await page.waitForURL(/https:\/\/auth.*/);
30
55
  await page.fill('input[type="email"]', process.env.USER_EMAIL);
31
56
  await page.click('button#btn-next');
@@ -41,10 +66,15 @@ async function globalSetup() {
41
66
  }
42
67
  await browser.close();
43
68
  }
44
- else {
45
- const stat = fs_1.default.statSync(storageFile);
46
- console.log(stat);
69
+ if (process.env.SETUP_PATH) {
70
+ if (fs_1.default.existsSync(process.env.SETUP_PATH)) {
71
+ await Promise.resolve().then(() => __importStar(require(process.env.SETUP_PATH)));
72
+ }
73
+ else {
74
+ throw new Error(`${process.env.SETUP_PATH} not found.`);
75
+ }
47
76
  }
77
+ return;
48
78
  }
49
79
  exports.default = globalSetup;
50
80
  //# sourceMappingURL=globalSetup.js.map
@@ -1 +1 @@
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,EA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AAC,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;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE;QACxB,IAAI,YAAE,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YACvC,wDAAa,OAAO,CAAC,GAAG,CAAC,UAAU,GAAC,CAAC;SACxC;aAAM;YACH,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,aAAa,CAAC,CAAC;SAC3D;KACJ;IACD,OAAO;AACX,CAAC;AAED,kBAAe,WAAW,CAAC"}
@@ -19,6 +19,7 @@ async function globalTeardown() {
19
19
  }
20
20
  }
21
21
  }
22
+ return;
22
23
  }
23
24
  exports.default = globalTeardown;
24
25
  //# sourceMappingURL=globalTeardown.js.map
@@ -1 +1 @@
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,CAA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C,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;IACD,OAAO;AACX,CAAC;AAED,kBAAe,cAAc,CAAC"}
@@ -26,7 +26,7 @@ async function enableLogger(file, page) {
26
26
  process.stdout.write = process.stderr.write = access.write.bind(access);
27
27
  // Write the GitHub link of the currently running test to the beginning of each log file
28
28
  console.log(`
29
- https://github.com/SPSCommerce/${process.env.REPONAME}/search?q=${test}`);
29
+ https://github.com/SPSCommerce/${process.env.REPO_NAME}/search?q=${test}`);
30
30
  // Listen for errors
31
31
  page
32
32
  .on('console', async (message) => {
@@ -1 +1 @@
1
- {"version":3,"file":"loggerSetup.js","sourceRoot":"","sources":["../src/loggerSetup.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AAGxB,I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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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spscommerce/e2e-core",
3
- "version": "2.2.2",
3
+ "version": "2.2.5",
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,9 +25,10 @@
25
25
  "license": "UNLICENSED",
26
26
  "dependencies": {
27
27
  "@alex_neo/jest-expect-message": "^1.0.5",
28
- "@playwright/test": "^1.22.0-alpha-apr-10-2022",
28
+ "@playwright/test": "^1.21.1",
29
29
  "@typescript-eslint/eslint-plugin": "^4.33.0",
30
30
  "@typescript-eslint/parser": "^4.33.0",
31
+ "dotenv": "^16.0.0",
31
32
  "eslint": "^7.32.0",
32
33
  "jest-extended": "^1.2.0",
33
34
  "typescript": "^4.4.4"
@@ -1,5 +1,9 @@
1
1
  const path = require('path');
2
2
 
3
+ if (process.env.CONFIG_PATH) {
4
+ require('dotenv').config({ path: process.env.CONFIG_PATH });
5
+ }
6
+
3
7
  const reportName = process.env.SUITE ? `${process.env.SUITE}.xml` : `TEST-result.xml`;
4
8
 
5
9
  let browserProject = [];
@@ -33,9 +37,6 @@ switch (process.env.BROWSER) {
33
37
  break;
34
38
  }
35
39
 
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
  /**
40
41
  * See https://playwright.dev/docs/test-configuration.
41
42
  */
@@ -43,15 +44,12 @@ process.env.BASEURL = process.env.URL && process.env.URL === 'prod' ? 'https://'
43
44
  // @ts-check
44
45
  /** @type {import('@playwright/test').PlaywrightTestConfig} */
45
46
  const config = {
47
+ /* Directory that will be recursively scanned for test files. */
46
48
  testDir: process.env.TEST_DIR,
47
-
48
49
  /* Maximum time one test can run for. */
49
50
  timeout: +process.env.TIMEOUT || 30000,
51
+ /* Maximum time expect() should wait for the condition to be met. */
50
52
  expect: {
51
- /**
52
- * Maximum time expect() should wait for the condition to be met.
53
- * For example in `await expect(locator).toHaveText();`
54
- */
55
53
  timeout: 5000
56
54
  },
57
55
  /* Fail the build on CI if you accidentally left test.only in the source code. */
@@ -67,7 +65,9 @@ const config = {
67
65
  ['junit', { outputFile: path.join(process.cwd(), `results-e2e/reports/${reportName}`) }],
68
66
  ['list']
69
67
  ],
68
+ /* Global setup file must export a single function. This function will be run once before all the tests. */
70
69
  globalSetup: require.resolve('./lib/globalSetup'),
70
+ /* Similarly, run something once after all the tests. */
71
71
  globalTeardown: require.resolve('./lib/globalTeardown'),
72
72
  /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
73
73
  use: {
@@ -78,8 +78,11 @@ const config = {
78
78
  screenshot: 'only-on-failure',
79
79
  /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
80
80
  trace: process.env.TRACER ? 'retain-on-failure' : 'off',
81
- // Run in headless mode by default (if process.env.HEADLESS is not specified)
81
+ /* Run in headless mode by default (if process.env.HEADLESS is not specified). */
82
82
  headless: !process.env.HEADLESS || process.env.HEADLESS === 'true' ? true : false,
83
+ /* Emulates consistent viewport for each page. */
84
+ viewport: process.env.VIEWPORT ? JSON.parse(process.env.VIEWPORT) : { width: 1536, height: 960 },
85
+ /* Whether to ignore HTTPS errors when sending network requests. */
83
86
  ignoreHTTPSErrors: true,
84
87
  /* Base URL to use in actions like `await page.goto('/')`. */
85
88
  // baseURL: 'http://localhost:3000',
@@ -2,6 +2,9 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import { chromium } from '@playwright/test';
4
4
 
5
+ const domain = 'commerce.spscommerce.com';
6
+ const baseUrl = process.env.ENV && process.env.ENV === 'prod' ? 'https://' + domain : 'https://test.' + domain;
7
+
5
8
  async function globalSetup() {
6
9
  // Remove custom sub-folders for test artifacts
7
10
  const resultsFolder = path.join(process.cwd(), 'results-e2e/');
@@ -19,7 +22,7 @@ async function globalSetup() {
19
22
  await context.tracing.start({ screenshots: true, snapshots: true });
20
23
  const page = await context.newPage();
21
24
  try {
22
- await page.goto(process.env.BASEURL);
25
+ await page.goto(baseUrl);
23
26
  await page.waitForURL(/https:\/\/auth.*/);
24
27
  await page.fill('input[type="email"]', process.env.USER_EMAIL);
25
28
  await page.click('button#btn-next');
@@ -33,10 +36,15 @@ async function globalSetup() {
33
36
  throw new Error('Error occurred while running globalSetup.ts file.');
34
37
  }
35
38
  await browser.close();
36
- } else {
37
- const stat = fs.statSync(storageFile);
38
- console.log(stat);
39
39
  }
40
+ if (process.env.SETUP_PATH) {
41
+ if (fs.existsSync(process.env.SETUP_PATH)) {
42
+ await import(process.env.SETUP_PATH);
43
+ } else {
44
+ throw new Error(`${process.env.SETUP_PATH} not found.`);
45
+ }
46
+ }
47
+ return;
40
48
  }
41
49
 
42
50
  export default globalSetup;
@@ -9,12 +9,13 @@ 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 = "FFUI_" + oldSubFolder.substring(oldSubFolder.indexOf("FFUI-")).split('-').slice(1, -1).join('_').replace('_', ' ');
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
  }
16
16
  }
17
17
  }
18
+ return;
18
19
  }
19
20
 
20
21
  export default globalTeardown;
@@ -26,7 +26,7 @@ export async function enableLogger(file: string[], page: Page): Promise<void> {
26
26
 
27
27
  // Write the GitHub link of the currently running test to the beginning of each log file
28
28
  console.log(`
29
- https://github.com/SPSCommerce/${process.env.REPONAME}/search?q=${test}`);
29
+ https://github.com/SPSCommerce/${process.env.REPO_NAME}/search?q=${test}`);
30
30
 
31
31
  // Listen for errors
32
32
  page