Skip to content

Commit ee537ea

Browse files
committed
test: allure report
1 parent e64c9a8 commit ee537ea

File tree

3 files changed

+151
-0
lines changed

3 files changed

+151
-0
lines changed
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: E2E Tests with Allure Reports
2+
3+
on:
4+
pull_request:
5+
branches: [main, develop]
6+
7+
jobs:
8+
e2e-tests:
9+
name: E2E Tests
10+
runs-on: ubuntu-latest
11+
12+
strategy:
13+
matrix:
14+
node-version: [22.16.0]
15+
browser: [chromium]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'yarn'
26+
27+
- name: Install dependencies
28+
run: |
29+
cd apps/meteor
30+
yarn install --frozen-lockfile
31+
32+
- name: Install Playwright browsers
33+
run: |
34+
cd apps/meteor
35+
npx playwright install --with-deps ${{ matrix.browser }}
36+
37+
- name: Install Allure Commandline
38+
run: |
39+
wget https://github.com/allure-framework/allure2/releases/download/2.24.1/allure-2.24.1.tgz
40+
tar -zxf allure-2.24.1.tgz
41+
sudo mv allure-2.24.1 /opt/allure
42+
sudo ln -s /opt/allure/bin/allure /usr/local/bin/allure
43+
allure --version
44+
45+
- name: Run E2E tests with Allure
46+
run: |
47+
cd apps/meteor
48+
yarn test:e2e
49+
env:
50+
CI: true
51+
NODE_ENV: test
52+
53+
- name: Generate Allure report
54+
if: always()
55+
run: |
56+
cd apps/meteor
57+
mkdir -p tests/e2e/reports/allure
58+
allure generate allure-results --clean --output tests/e2e/reports/allure
59+
60+
- name: Upload Allure results as artifacts
61+
if: always()
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: allure-results-${{ matrix.browser }}-${{ github.run_number }}
65+
path: apps/meteor/allure-results/
66+
retention-days: 30
67+
68+
- name: Upload Allure report as artifacts
69+
if: always()
70+
uses: actions/upload-artifact@v4
71+
with:
72+
name: allure-report-${{ matrix.browser }}-${{ github.run_number }}
73+
path: apps/meteor/tests/e2e/reports/allure/
74+
retention-days: 30
75+
76+
- name: Upload HTML report as artifacts
77+
if: always()
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: html-report-${{ matrix.browser }}-${{ github.run_number }}
81+
path: apps/meteor/tests/e2e/reports/html/
82+
retention-days: 30
83+
84+
- name: Upload JUnit report as artifacts
85+
if: always()
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: junit-report-${{ matrix.browser }}-${{ github.run_number }}
89+
path: apps/meteor/tests/e2e/reports/junit.xml
90+
retention-days: 30
91+
92+
- name: Publish Allure Report to GitHub Pages
93+
if: github.ref == 'refs/heads/main' && always()
94+
uses: peaceiris/actions-gh-pages@v3
95+
with:
96+
github_token: ${{ secrets.GITHUB_TOKEN }}
97+
publish_dir: ./apps/meteor/tests/e2e/reports/allure
98+
destination_dir: ./e2e-reports
99+
100+
- name: Comment PR with Allure Report Link
101+
if: github.event_name == 'pull_request' && always()
102+
uses: actions/github-script@v7
103+
with:
104+
script: |
105+
const { data: comments } = await github.rest.issues.listComments({
106+
owner: context.repo.owner,
107+
repo: context.repo.repo,
108+
issue_number: context.issue.number,
109+
});
110+
111+
const botComment = comments.find(comment =>
112+
comment.user.type === 'Bot' &&
113+
comment.body.includes('Allure Report')
114+
);
115+
116+
const reportUrl = `https://${context.repo.owner}.github.io/${context.repo.repo}/e2e-reports/`;
117+
const commentBody = `## 📊 E2E Test Results
118+
119+
**Allure Report**: [View Report](${reportUrl})
120+
121+
**Test Run**: #${{ github.run_number }}
122+
**Browser**: ${{ matrix.browser }}
123+
**Node.js**: ${{ matrix.node-version }}
124+
125+
📥 **Download Reports**:
126+
- [Allure Results](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts)
127+
- [HTML Report](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts)
128+
129+
---
130+
*Reports are generated automatically for this PR*`;
131+
132+
if (botComment) {
133+
await github.rest.issues.updateComment({
134+
owner: context.repo.owner,
135+
repo: context.repo.repo,
136+
comment_id: botComment.id,
137+
body: commentBody,
138+
});
139+
} else {
140+
await github.rest.issues.createComment({
141+
owner: context.repo.owner,
142+
repo: context.repo.repo,
143+
issue_number: context.issue.number,
144+
body: commentBody,
145+
});
146+
}

apps/meteor/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
"typecheck": "meteor lint && cross-env NODE_OPTIONS=\"--max-old-space-size=8192\" tsc --noEmit --skipLibCheck",
3535
"coverage": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' nyc -r html mocha --config ./.mocharc.js",
3636
"test:e2e": "playwright test",
37+
"allure:generate": "allure generate allure-results --clean -o allure-report",
38+
"allure:open": "allure open allure-report",
3739
"test:e2e:federation": "playwright test --config=playwright-federation.config.ts",
3840
"test:e2e:nyc": "nyc report --reporter=lcov",
3941
"testapi": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\"}' mocha --config ./.mocharc.api.js",
@@ -158,6 +160,7 @@
158160
"@types/xml-encryption": "~1.2.4",
159161
"@typescript-eslint/eslint-plugin": "~5.60.1",
160162
"@typescript-eslint/parser": "~5.60.1",
163+
"allure-playwright": "3.1.0",
161164
"autoprefixer": "^9.8.8",
162165
"babel-loader": "~10.0.0",
163166
"babel-plugin-array-includes": "^2.0.3",
@@ -189,6 +192,7 @@
189192
"nyc": "^17.1.0",
190193
"outdent": "~0.8.0",
191194
"pino-pretty": "^7.6.1",
195+
"playwright": "1.52.0",
192196
"playwright-core": "~1.52.0",
193197
"playwright-qase-reporter": "~2.1.6",
194198
"postcss": "~8.4.49",

apps/meteor/playwright.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default {
2222
outputDir: 'tests/e2e/.playwright',
2323
reporter: [
2424
['list'],
25+
['allure-playwright'],
2526
process.env.REPORTER_ROCKETCHAT_REPORT === 'true' && [
2627
'./reporters/rocketchat.ts',
2728
{

0 commit comments

Comments
 (0)