Skip to content

Commit 87d4ae4

Browse files
committed
chore: Add js tests
1 parent 96682d4 commit 87d4ae4

15 files changed

+3063
-319
lines changed

.github/workflows/frontend.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Frontend E2E Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'release/**'
8+
pull_request:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
e2e:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v5
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '24'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Install Playwright browsers
31+
run: npx playwright install --with-deps
32+
33+
- name: Run linting
34+
run: npx gulp lint
35+
36+
- name: Run E2E tests with coverage
37+
run: npm run e2e
38+
39+
- name: Generate coverage report
40+
if: always()
41+
run: npm run e2e:coverage:report
42+
43+
- name: Upload coverage reports
44+
if: always()
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: coverage-e2e
48+
path: coverage-e2e/
49+
retention-days: 30
50+
51+
- name: Upload Playwright report
52+
if: always()
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: playwright-report
56+
path: playwright-report/
57+
retention-days: 30
58+
59+
- name: Comment coverage on PR
60+
if: github.event_name == 'pull_request'
61+
uses: actions/github-script@v7
62+
with:
63+
script: |
64+
const fs = require('fs');
65+
const coveragePath = 'coverage-e2e/lcov-report/index.html';
66+
67+
if (!fs.existsSync(coveragePath)) {
68+
console.log('Coverage report not found');
69+
return;
70+
}
71+
72+
// Read the summary from the test output
73+
const summary = `## Frontend E2E Test Coverage
74+
75+
Coverage reports have been generated and uploaded as artifacts.
76+
77+
Download the artifacts from this workflow run to view the full HTML coverage report.
78+
`;
79+
80+
github.rest.issues.createComment({
81+
issue_number: context.issue.number,
82+
owner: context.repo.owner,
83+
repo: context.repo.repo,
84+
body: summary
85+
});

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ htmlcov/
1616
!djangocms_versioning/static/djangocms_versioning/js/dist
1717
docs/_build/
1818
node_modules
19+
coverage-e2e/
20+
.nyc_output/
21+
playwright-report/
22+
test-results/

gulpfile.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ gulp.task('lint:javascript', function () {
4646

4747
gulp.task('lint', gulp.series('lint:javascript'));
4848

49+
4950
var webpackBundle = function (opts) {
5051
var webpackOptions = opts || {};
5152

0 commit comments

Comments
 (0)