Skip to content

Commit dd6a744

Browse files
authored
Simplify e2e setup (#895)
- Remove unused dotenv package - Remove redundant package playwright (already have playwright/test) - Remove dotenv package - Consolidate dependencies and devDependencies
1 parent a79e0a5 commit dd6a744

File tree

7 files changed

+139
-160
lines changed

7 files changed

+139
-160
lines changed

Makefile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ __check_defined = \
3232
e2e-clean-image \
3333
e2e-clean-report \
3434
e2e-merge-reports \
35+
e2e-setup \
3536
e2e-setup-ci \
36-
e2e-setup-native \
3737
e2e-show-report \
3838
e2e-test \
3939
e2e-test-native \
@@ -96,17 +96,16 @@ e2e-clean-report: ## Remove the local e2e report folders and content
9696
rm -rf ./e2e/test-results
9797

9898
e2e-merge-reports: ## Merge E2E blob reports from multiple shards into an HTML report
99-
cd e2e && npm run e2e-merge-reports
99+
cd e2e && npm run merge-reports
100100

101-
e2e-setup-ci: ## Setup end-to-end tests for CI
102-
cd e2e && npm run e2e-setup
103-
104-
e2e-setup-native: ## Setup end-to-end tests
101+
e2e-setup: ## Setup end-to-end tests
105102
cd e2e && npm install
106-
cd e2e && npm run e2e-setup
103+
104+
e2e-setup-ci: ## Setup end-to-end tests for CI
105+
cd e2e && npm ci
107106

108107
e2e-show-report: ## Show the E2E report
109-
cd e2e && npm run e2e-show-report
108+
cd e2e && npm run show-report
110109

111110
e2e-test: ## Run E2E tests in a Docker container and copy the report locally
112111
e2e-test: e2e-build
@@ -122,18 +121,18 @@ e2e-test: e2e-build
122121
-v $(PWD)/e2e/playwright-report:/e2e/playwright-report \
123122
-v $(PWD)/e2e/blob-report:/e2e/blob-report \
124123
$(E2E_IMAGE_NAME) \
125-
$(E2E_ARGS)
124+
npm test -- $(E2E_ARGS)
126125
@echo "Run 'make e2e-show-report' to view the test report"
127126

128127
e2e-test-native: ## Run end-to-end tests natively
129128
@:$(call check_defined, APP_NAME, You must pass in a specific APP_NAME)
130129
@echo "Running e2e tests with CI=${CI}, APP_NAME=${APP_NAME}, BASE_URL=${BASE_URL}"
131-
cd e2e && APP_NAME=$(APP_NAME) BASE_URL=$(BASE_URL) npm run e2e-test -- $(E2E_ARGS)
130+
cd e2e && APP_NAME=$(APP_NAME) BASE_URL=$(BASE_URL) npm test -- $(E2E_ARGS)
132131

133132
e2e-test-native-ui: ## Run end-to-end tests natively in UI mode
134133
@:$(call check_defined, APP_NAME, You must pass in a specific APP_NAME)
135134
@echo "Running e2e UI tests natively with APP_NAME=$(APP_NAME), BASE_URL=$(BASE_URL)"
136-
cd e2e && APP_NAME=$(APP_NAME) BASE_URL=$(BASE_URL) npm run e2e-test:ui -- $(E2E_ARGS)
135+
cd e2e && APP_NAME=$(APP_NAME) BASE_URL=$(BASE_URL) npm run test:ui -- $(E2E_ARGS)
137136

138137
###########
139138
## Infra ##

docs/e2e/e2e-checks.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ First, make sure the application you want to test is running.
4848
To run end-to-end tests natively, first install Playwright with:
4949

5050
```bash
51-
make e2e-setup-native
51+
make e2e-setup
5252
```
5353

5454
Then, run the tests with your app name and base url:
5555
```bash
5656
make e2e-test-native APP_NAME=app
5757
```
58+
5859
>* `BASE_URL` is optional for both `e2e-test-native` and `e2e-test-native-ui` targets. It will by default use the app-specific (`/e2e/<APP_NAME>/playwright.config.js`) `baseURL`
5960
6061
### Run tests in UI mode

e2e/Dockerfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ COPY e2e/package.json e2e/package-lock.json ./
1212

1313
# install deps
1414
RUN npm ci
15-
RUN npm run e2e-setup
1615

1716
# Copy entire e2e folder over
1817
COPY e2e /e2e
1918

20-
ENTRYPOINT ["npm", "run", "e2e-test", "--"]
21-
22-
# Optional additional args
23-
CMD [""]
19+
CMD ["npm", "test", "--"]

e2e/package-lock.json

Lines changed: 112 additions & 119 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/package.json

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
{
2-
"name": "e2e",
3-
"version": "1.0.0",
4-
"scripts": {
5-
"e2e-merge-reports": "npx playwright merge-reports --reporter html blob-report",
6-
"e2e-setup": "npx playwright install --with-deps",
7-
"e2e-show-report": "npx playwright show-report",
8-
"e2e-test": "./run-e2e-test",
9-
"e2e-test:ui": "./run-e2e-test --ui"
10-
},
11-
"devDependencies": {
12-
"@playwright/test": "^1.49.0",
13-
"@types/node": "^22.10.1"
14-
},
15-
"dependencies": {
16-
"@axe-core/playwright": "^4.10.1",
17-
"dotenv": "^16.4.7",
18-
"playwright": "^1.49.0"
19-
}
2+
"name": "e2e",
3+
"version": "1.0.0",
4+
"scripts": {
5+
"merge-reports": "npx playwright merge-reports --reporter html blob-report",
6+
"show-report": "npx playwright show-report",
7+
"test": "./run-e2e-test",
8+
"test:ui": "./run-e2e-test --ui"
9+
},
10+
"devDependencies": {
11+
"@axe-core/playwright": "^4.10.1",
12+
"@playwright/test": "^1.49.0",
13+
"@types/node": "^22.10.1"
2014
}
15+
}

e2e/playwright.config.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
// Load environment variables from .env file if it exists
2-
import * as dotenv from 'dotenv';
3-
41
import { defineConfig, devices } from "@playwright/test";
52

6-
dotenv.config();
7-
83
/**
94
* See https://playwright.dev/docs/test-configuration.
105
*/

e2e/run-e2e-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
# Ensure APP_NAME is provided
77
if [[ -z "${APP_NAME}" ]]; then
8-
echo "You must pass in a specific APP_NAME. IE: APP_NAME=app npm run e2e-test" >&2
8+
echo "You must pass in a specific APP_NAME. IE: APP_NAME=app npm test" >&2
99
exit 1
1010
fi
1111

0 commit comments

Comments
 (0)