Skip to content

Commit b66499f

Browse files
committed
Run tests as part of the CI build.
1 parent 1817f8a commit b66499f

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on:
33
pull_request:
44

55
jobs:
6-
lint:
6+
build:
77
runs-on: ubuntu-latest
88
steps:
99
- name: Code Checkout
@@ -17,3 +17,8 @@ jobs:
1717
run: npm ci --timing
1818
- name: Lint javascript
1919
run: npm run lint
20+
- name: Start the test site and run the cucumber tests against it
21+
# aa-exec applies Ubuntu's AppArmor profile for stable Chrome binaries to the Chrome for Testing binary downloaded by Puppeteer
22+
# Without it, Puppeteer fails with error "No usable sandbox!"
23+
# See https://pptr.dev/troubleshooting#issues-with-apparmor-on-ubuntu
24+
run: npm run test-site-dev & sleep 20; aa-exec --profile=chrome npm run cucumber

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
/node_modules
1+
node_modules
2+
output

features/README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,20 @@ Then run the tests against the test site:
2424
npm run cucumber
2525
```
2626

27-
## Running the tests with a debugger attached
27+
### Running the tests with a debugger attached
2828

2929
```bash
3030
npm run cucumber:debug
3131
```
3232

33+
### Running the tests and generating a nicely formatted test report
34+
35+
```bash
36+
npm run cucumber:report
37+
```
38+
39+
Test report should be available in `output/test-results.html`.
40+
3341
## Configuring with environment variables
3442

3543
### Verbose mode

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"lint": "eslint Universal-Federated-Analytics.js",
1010
"cucumber": "cucumber-js",
1111
"cucumber:debug": "VERBOSE=true node --inspect-brk node_modules/@cucumber/cucumber/bin/cucumber-js",
12+
"cucumber:report": "cucumber-js --format \"html\":\"output/test-results.html\"",
1213
"test-site-dev": "docker build --no-cache --build-arg DAP_ENV='dev' -t dap-test-site-dev . && docker run --rm -p 8080:80 --name dap-test-site-dev dap-test-site-dev",
1314
"test-site-stg": "docker build --no-cache --build-arg DAP_ENV='stg' -t dap-test-site-stg . && docker run --rm -p 8080:80 --name dap-test-site-stg dap-test-site-stg",
1415
"test-site-prd": "docker build --no-cache --build-arg DAP_ENV='prd' -t dap-test-site-prd . && docker run --rm -p 8080:80 --name dap-test-site-prd dap-test-site-prd"

0 commit comments

Comments
 (0)