Skip to content

Commit 3049be7

Browse files
dpaquetteDavid Paquette
andcommitted
Run e2e tests in PRs (#140)
* Run e2e tests PRs * Main, not master * Install playwright browsers in workflow * Add github reporter * Screenshots on failure for e2e tests * Upload test results if failure * Fix e2e tests that were failing * Update to Node 16 * Update readme to reference Node 16.x Co-authored-by: David Paquette <dave.paquette@outlook.com>
1 parent ae1eab7 commit 3049be7

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

.github/workflows/2wr-app.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ on:
55
paths:
66
- '2wr-app/**'
77
- '.github/workflows/2wr-app.yaml'
8-
branches: [ master ]
8+
branches: [ main ]
99
pull_request:
1010
paths:
1111
- '2wr-app/**'
1212
- '.github/workflows/2wr-app.yaml'
13-
branches: [ master ]
13+
branches: [ main ]
1414
workflow_dispatch:
1515

1616
jobs:
@@ -20,7 +20,7 @@ jobs:
2020

2121
strategy:
2222
matrix:
23-
node-version: [12.x]
23+
node-version: [16.x]
2424

2525
steps:
2626
- uses: actions/checkout@v2
@@ -30,6 +30,20 @@ jobs:
3030
node-version: ${{ matrix.node-version }}
3131
- run: npm ci
3232
working-directory: ./2wr-app
33+
- run: npx playwright install
34+
working-directory: ./2wr-app
35+
- name: Write sample env file for e2e tests
36+
run: 'cp ./2wr-app/.env-sample ./2wr-app/.env'
37+
- run: npm run e2etest
38+
working-directory: ./2wr-app
39+
- name: Upload e2e Test Results
40+
uses: actions/upload-artifact@v2
41+
if: failure()
42+
with:
43+
name: e2e-test-results
44+
path: ./2wr-app/test-results
45+
- name: Clear sample env file from e2e tests
46+
run: 'rm ./2wr-app/.env'
3347
- name: Write env file
3448
run: 'echo "$DEV_ENV" > ./2wr-app/.env'
3549
shell: bash

2wr-app/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ node_modules
99
.env.local
1010
.env.*.local
1111

12+
#test results
13+
/test-results
14+
1215
# Log files
1316
npm-debug.log*
1417
yarn-debug.log*

2wr-app/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ In VSCode, you can get a walk-through of the code via the [CodeTour](https://mar
1818

1919
## Project Prerequisites
2020

21-
1. Node.js 14.17.6 LTS
21+
1. Node.js 16.x.x LTS
2222

2323
## Project setup
2424

2wr-app/playwright.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const config = {
2222
},
2323
globalSetup: require.resolve("./tests/global-setup"),
2424
use: {
25+
screenshot: "only-on-failure",
2526
// Tell all tests to load signed-in state from 'storageState.json'.
2627
storageState: "./tests/_storagestate/storageState.json"
2728
}

2wr-app/tests/welcome.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test.describe("Welcome page accessibility test", () => {
1414
await injectAxe(page);
1515
});
1616

17-
test("Check Accessability", async () => {
17+
test("Check Accessibility", async () => {
1818
await checkA11y(page, null, {
1919
axeOptions: {},
2020
detailedReport: true,

0 commit comments

Comments
 (0)