Skip to content

Commit 992833c

Browse files
dpaquetteDavid Paquette
andauthored
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 c2663e3 commit 992833c

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-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
@@ -8,6 +8,9 @@ node_modules
88
.env.local
99
.env.*.local
1010

11+
#test results
12+
/test-results
13+
1114
# Log files
1215
npm-debug.log*
1316
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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ const config = {
88
port: 8080,
99
timeout: 120 * 1000,
1010
},
11+
use: {
12+
screenshot: 'only-on-failure',
13+
}
1114
};
1215
module.exports = config;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ test.describe('Welcome page accessibility test', () => {
99
await injectAxe(page);
1010
});
1111

12-
test('Check Accessability', async () => {
12+
test('Check Accessibility', async () => {
1313
await checkA11y(page, null, {
1414
axeOptions: {
1515

0 commit comments

Comments
 (0)