diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index be91445..ab712ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,7 +3,7 @@ on: pull_request: jobs: - lint: + build: runs-on: ubuntu-latest steps: - name: Code Checkout @@ -17,3 +17,8 @@ jobs: run: npm ci --timing - name: Lint javascript run: npm run lint + - name: Run tests + # aa-exec applies Ubuntu's AppArmor profile for stable Chrome binaries to the Chrome for Testing binary downloaded by Puppeteer + # Without it, Puppeteer fails with error "No usable sandbox!" + # See https://pptr.dev/troubleshooting#issues-with-apparmor-on-ubuntu + run: npm run test-site-dev & sleep 20; aa-exec --profile=chrome npm run cucumber diff --git a/.gitignore b/.gitignore index 30bc162..fe03b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/node_modules \ No newline at end of file +node_modules +output \ No newline at end of file diff --git a/features/README.md b/features/README.md index d7ca0c4..73126fe 100644 --- a/features/README.md +++ b/features/README.md @@ -24,12 +24,20 @@ Then run the tests against the test site: npm run cucumber ``` -## Running the tests with a debugger attached +### Running the tests with a debugger attached ```bash npm run cucumber:debug ``` +### Running the tests and generating a nicely formatted test report + +```bash +npm run cucumber:report +``` + +Test report should be available in `output/test-results.html`. + ## Configuring with environment variables ### Verbose mode diff --git a/package-lock.json b/package-lock.json index 2b9d38f..d9a09ac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1107,9 +1107,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001651", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001651.tgz", - "integrity": "sha512-9Cf+Xv1jJNe1xPZLGuUXLNkE1BoDkqRqYyFJ9TDYSqhduqA4hu4oR9HluGoWYQC/aj8WHjsGVV+bwkh0+tegRg==", + "version": "1.0.30001700", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001700.tgz", + "integrity": "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index e9e366c..c3e2f53 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "eslint Universal-Federated-Analytics.js", "cucumber": "cucumber-js", "cucumber:debug": "VERBOSE=true node --inspect-brk node_modules/@cucumber/cucumber/bin/cucumber-js", + "cucumber:report": "cucumber-js --format \"html\":\"output/test-results.html\"", "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", "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", "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"