Skip to content

Commit 9eff1d8

Browse files
committed
Add A11y and Allure Report
1 parent 0036612 commit 9eff1d8

File tree

8 files changed

+347
-27
lines changed

8 files changed

+347
-27
lines changed

.env.default

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ BASE_URL=https://www.bear.plus
22
HEADLESS=false
33
ACCESSIBILITY=false
44
DEVICE_SCALE_FACTOR=2
5+
OUTPUT_PATH=output
56
RECORD_HAR=false
67
HAR_PATH=output/har/requests.har

.github/workflows/e2e-test-automation.yml

+71-7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ name: E2E Test Automation
22

33
on: [ push ]
44

5+
permissions:
6+
contents: read
7+
pages: write
8+
id-token: write
9+
510
jobs:
611
chrome:
712
timeout-minutes: 30
@@ -23,13 +28,13 @@ jobs:
2328
env:
2429
BASE_URL: ${{ vars.BASE_URL }}
2530
HEADLESS: ${{ vars.HEADLESS }}
26-
OUTPUT_PATH: output-chrome
31+
OUTPUT_PATH: ${{ vars.OUTPUT_PATH }}
2732

2833
- uses: actions/upload-artifact@v3
2934
if: always()
3035
with:
3136
name: chrome-artifacts
32-
path: output-chrome
37+
path: ${{ vars.OUTPUT_PATH }}
3338
retention-days: 30
3439

3540
firefox:
@@ -52,7 +57,7 @@ jobs:
5257
env:
5358
BASE_URL: ${{ vars.BASE_URL }}
5459
HEADLESS: ${{ vars.HEADLESS }}
55-
OUTPUT_PATH: output-firefox
60+
OUTPUT_PATH: ${{ vars.OUTPUT_PATH }}
5661
# Workaround to fix GitHub Actions issue:
5762
# Running Nightly as root in a regular user's session is not supported.
5863
# See https://github.com/microsoft/playwright/issues/6500
@@ -62,7 +67,7 @@ jobs:
6267
if: always()
6368
with:
6469
name: firefox-artifacts
65-
path: output-firefox
70+
path: ${{ vars.OUTPUT_PATH }}
6671
retention-days: 30
6772

6873
safari:
@@ -85,11 +90,70 @@ jobs:
8590
env:
8691
BASE_URL: ${{ vars.BASE_URL }}
8792
HEADLESS: ${{ vars.HEADLESS }}
88-
OUTPUT_PATH: output-safari
93+
OUTPUT_PATH: ${{ vars.OUTPUT_PATH }}
8994

9095
- uses: actions/upload-artifact@v3
9196
if: always()
9297
with:
9398
name: safari-artifacts
94-
path: output-safari
95-
retention-days: 30
99+
path: ${{ vars.OUTPUT_PATH }}
100+
retention-days: 30
101+
102+
report:
103+
timeout-minutes: 30
104+
runs-on: ubuntu-latest
105+
container:
106+
image: mcr.microsoft.com/playwright:v1.38.1-jammy
107+
environment:
108+
url: ${{ steps.deployment.outputs.page_url }}
109+
name: 'github-pages'
110+
111+
steps:
112+
- uses: actions/checkout@v3
113+
- uses: actions/setup-node@v3
114+
with:
115+
node-version: 'latest'
116+
- uses: actions/setup-java@v3
117+
with:
118+
distribution: 'temurin'
119+
java-version: '17'
120+
121+
- name: Install dependencies
122+
run: npm ci
123+
124+
- name: Run Chrome scenarios
125+
run: npm run test:chrome
126+
env:
127+
BASE_URL: ${{ vars.BASE_URL }}
128+
HEADLESS: ${{ vars.HEADLESS }}
129+
OUTPUT_PATH: ${{ vars.OUTPUT_PATH }}
130+
131+
- uses: actions/upload-artifact@v3
132+
if: always()
133+
with:
134+
name: report-artifacts
135+
path: ${{ vars.OUTPUT_PATH }}
136+
retention-days: 30
137+
138+
- name: Generate Allure report
139+
if: always()
140+
run: npm run report:generate
141+
142+
- name: Patch Allure report
143+
if: always()
144+
run: npm run report:patch
145+
146+
- name: Setup GitHub Pages
147+
if: always()
148+
uses: actions/configure-pages@v3
149+
150+
- name: Upload artifact
151+
uses: actions/upload-pages-artifact@v2
152+
if: always()
153+
with:
154+
path: ${{ vars.OUTPUT_PATH }}/allure-report
155+
156+
- name: Deploy to GitHub Pages
157+
if: always()
158+
id: deployment
159+
uses: actions/deploy-pages@v2

README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ Modern E2E Test Automation suite that supports cross-browser testing, parallel e
66
## Tech stack
77
- [CodeceptJS](https://codecept.io)
88
- [Playwright](https://playwright.dev)
9-
- [Axe](https://www.deque.com/axe)
9+
- [Deque Axe](https://www.deque.com/axe)
1010
- [Typescript](https://www.typescriptlang.org)
1111

1212
## Features
1313
- ✅ Cross-browser testing (Chrome, Firefox, Safari)
1414
- ✅ Headless and headful modes
1515
- ✅ Parallel execution
16-
- ✅ Accessibility testing with Axe
1716
- ✅ Screenshot and video recording
1817
- ✅ Playwright tracing
1918
- ✅ HTTP Archive (HAR) files generation and replay
19+
- ✅ Accessibility testing with Axe
20+
- ✅ Reporting with Allure Report
2021

2122
## Installation
2223

@@ -48,6 +49,8 @@ ACCESSIBILITY=false
4849
# keep 1 for most monitors
4950
# set to 2 for MacBook Pro screen to avoid flickering
5051
DEVICE_SCALE_FACTOR=1
52+
# Reports, traces, screenshots, videos output path
53+
OUTPUT_PATH=output
5154
# Generate HTTP Archive (HAR) file from test scenario
5255
RECORD_HAR=false
5356
# HAR file path
@@ -59,11 +62,6 @@ HAR_PATH=output/har/requests.har
5962
npm run test:all
6063
```
6164

62-
### Run all test scenarios in parallel
63-
```sh
64-
npm run test:parallel
65-
```
66-
6765
### Run a specific browser
6866
```sh
6967
npm run test:chrome
@@ -75,3 +73,7 @@ npm run test:safari
7573
```sh
7674
npx codeceptjs run tests/bear-plus.spec.ts --steps
7775
```
76+
77+
## Pipeline
78+
79+
[![Pipeline](https://github.com/bear-plus/codeceptjs-playwright-typescript-boilerplate/actions/workflows/e2e-test-automation.yml/badge.svg)](https://github.com/bear-plus/codeceptjs-playwright-typescript-boilerplate/actions/workflows/e2e-test-automation.yml)

codecept.conf.ts

+10-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ export const config: CodeceptJS.MainConfig = {
1919
emulate: {
2020
deviceScaleFactor: process.env.DEVICE_SCALE_FACTOR ? parseInt(process.env.DEVICE_SCALE_FACTOR) : 1,
2121
recordHar: process.env.RECORD_HAR === 'true' ? {
22-
path: './output/har/requests.har',
22+
path: `${process.env.OUTPUT_PATH}/har/requests.har`,
2323
mode: 'full',
2424
} : undefined,
2525
},
2626
waitForTimeout: 45_000,
2727
waitForNavigation: 'load',
2828
keepVideoForPassedTests: false,
29-
keepTraceForPassedTests: false,
29+
keepTraceForPassedTests: true,
30+
},
31+
A11yHelper: {
32+
require: 'codeceptjs-a11y-helper',
3033
},
3134
},
3235
include: {
@@ -52,5 +55,10 @@ export const config: CodeceptJS.MainConfig = {
5255
stepByStepReport: {
5356
enabled: true
5457
},
58+
allure: {
59+
enabled: true,
60+
require: 'allure-codeceptjs',
61+
outputDir: `${process.env.OUTPUT_PATH}/allure`,
62+
},
5563
}
5664
}

0 commit comments

Comments
 (0)