Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add(ci): publish playwright report for PRs #178

Merged
merged 23 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
8e1798e
add(ci): publish playwright report for PRs
luisecm Oct 10, 2024
c9b5e02
update(ci): upgrade docker image
luisecm Oct 10, 2024
4cfec93
update(ci): use latest docker only on merge job
luisecm Oct 10, 2024
4bb153e
update(test): changes to ci and temporarily just run one test
luisecm Oct 10, 2024
0e912e7
update(ci): ditch allure report
luisecm Oct 10, 2024
f0be425
update(ci): dont ditch allure and upgrade grants
luisecm Oct 10, 2024
6947631
update(ci): config files fix@
luisecm Oct 10, 2024
67cf1fb
update(ci): publish allure
luisecm Oct 10, 2024
0d26f66
update(playwright): dont add allure report
luisecm Oct 11, 2024
3f84db2
update(ci): upgrade playwright and dont use docker
luisecm Oct 11, 2024
48ce29f
update(ci): move merge reports to a new job
luisecm Oct 11, 2024
017fc2a
update(ci): update playwright report
luisecm Oct 11, 2024
8a68c27
update(ci): speed up test execution temporarily
luisecm Oct 11, 2024
4658b10
update(ci): update playwright report
luisecm Oct 11, 2024
10cd78b
update(ci): attempt playwright
luisecm Oct 11, 2024
4aa3daa
update(ci): make it fail on purpose
luisecm Oct 11, 2024
55dc007
update(ci): publish allure and playwright report
luisecm Oct 14, 2024
1d65aaf
update(ci): update report location
luisecm Oct 14, 2024
ec95bd4
update(ci): publish both reports
luisecm Oct 14, 2024
3a35291
update(ci): kill ssh agent
luisecm Oct 14, 2024
63a0526
update(test): bring test back to its current state
luisecm Oct 14, 2024
1819954
update(test): remove only changes
luisecm Oct 14, 2024
f59906f
Merge branch 'dev' into luis/playwright-report
luisecm Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 99 additions & 17 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.47.2-jammy
image: mcr.microsoft.com/playwright:v1.48.0-jammy
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -57,16 +57,16 @@ jobs:
if: always()
with:
name: playwright-report-${{ matrix.project }}
path: automated-tests/playwright-report/
retention-days: 5
path: automated-tests/blob-report/
retention-days: 1

- name: Upload Allure results as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: allure-results-${{ matrix.project }}
path: automated-tests/allure-results
retention-days: 5
retention-days: 1

- name: Add label if any of build jobs failed
if: failure()
Expand All @@ -77,28 +77,104 @@ jobs:
Failed Automated Test
type: add

generate-report:
merge-reports:
if: always()
needs: test
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.48.0-jammy
steps:
- name: Download Blob Report from Desktop
uses: actions/download-artifact@v4
with:
name: playwright-report-desktop-chrome
path: blob-report

- name: Download Blob Report from Mobile
uses: actions/download-artifact@v4
with:
name: playwright-report-mobile-chrome
path: blob-report

- name: Merge Blob Reports into HTML Report
run: npx playwright merge-reports --reporter html ./blob-report

- name: Upload Merged Report
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-merged-report
path: playwright-report
retention-days: 5

- name: Delete temporary artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
playwright-report-desktop-chrome
playwright-report-mobile-chrome

- name: Add label if job fails
if: failure()
uses: buildsville/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
labels: |
Failed Automated Test
type: add

publish-report:
if: always()
needs: merge-reports
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
issues: read
steps:
- name: Download Merged Report
uses: actions/download-artifact@v4
with:
name: playwright-merged-report
path: playwright-report

- name: Set a timestamp one
id: timestampidone
# this will store current time with UTC in outputs.timestamp (eg of value: 20231028_233147Z)
run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT"

- name: Deploy Playwright HTML report to Github Pages
if: success()
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: Satellite-im/test-reports
keep_files: true
publish_branch: gh-pages
publish_dir: ./playwright-report
destination_dir: ${{ steps.timestampidone.outputs.timestamp }}

- name: Stop ssh-agent job from first deploy required for deploying a second time
run: killall ssh-agent

- name: Download Allure results artifact for desktop
uses: actions/download-artifact@v4
with:
name: allure-results-desktop-chrome
path: automated-tests/allure/desktop-chrome
path: allure/desktop-chrome

- name: Download Allure results artifact for mobile
uses: actions/download-artifact@v4
with:
name: allure-results-mobile-chrome
path: automated-tests/allure/mobile-chrome
path: allure/mobile-chrome

- name: Merge Allure results
run: |
mkdir -p automated-tests/allure-results
cp -r automated-tests/allure/desktop-chrome/* automated-tests/allure-results/
cp -r automated-tests/allure/mobile-chrome/* automated-tests/allure-results/
mkdir -p allure-results
cp -r allure/desktop-chrome/* allure-results/
cp -r allure/mobile-chrome/* allure-results/

- name: Get Allure history
uses: actions/checkout@v4
Expand All @@ -114,10 +190,17 @@ jobs:
uses: simple-elf/allure-report-action@master
with:
gh_pages: gh-pages
allure_results: automated-tests/allure-results
allure_results: allure-results
allure_report: allure-report
allure_history: allure-history
keep_reports: 100
github_repo: Satellite-im/test-reports
github_repo_owner: Satellite-im

- name: Set a timestamp two
id: timestampidtwo
# this will store current time with UTC in outputs.timestamp (eg of value: 20231028_233147Z)
run: echo "timestamp=$(date --utc +%Y%m%d_%H%M%SZ)" >> "$GITHUB_OUTPUT"

- name: Deploy report to Github Pages
if: success()
Expand All @@ -126,14 +209,14 @@ jobs:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: Satellite-im/test-reports
publish_branch: gh-pages
publish_dir: allure-history
publish_dir: ./allure-history

- name: Comment PR with Allure test results
- name: Comment PR with Test Report link
if: always() && github.event_name == 'pull_request'
uses: mshick/add-pr-comment@v2
with:
message: |
Playwright test execution is complete! You can find the test results report [here](https://satellite-im.github.io/test-reports/${{ github.run_number }})
Automated tests execution is complete! You can find the Playwright test report [here](https://satellite-im.github.io/test-reports/${{ steps.timestampidone.outputs.timestamp }}/) and the Allure Test Report [here](https://satellite-im.github.io/test-reports/${{ github.run_number }})
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -147,7 +230,7 @@ jobs:
type: add

remove-label:
needs: [test, generate-report]
needs: [test, merge-reports, publish-report]
runs-on: ubuntu-latest
permissions:
checks: write
Expand All @@ -163,8 +246,7 @@ jobs:
uses: geekyeggo/delete-artifact@v5
with:
name: |
playwright-report-desktop-chrome
playwright-report-mobile-chrome
playwright-merged-report
allure-results-desktop-chrome
allure-results-mobile-chrome

Expand Down
24 changes: 12 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "MIT",
"devDependencies": {
"@faker-js/faker": "^8.4.1",
"@playwright/test": "^1.45.3",
"@playwright/test": "^1.48.0",
"@types/node": "^20.14.2",
"allure-playwright": "^3.0.0-beta.7",
"prettier": "3.2.5",
Expand Down
11 changes: 8 additions & 3 deletions playwright.ci.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export default defineConfig({
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
["html", { outputFolder: "playwright-report" }],
["json", { outputFile: "playwright-report/report.json" }],
["list"],
["blob"],
["allure-playwright", { outputFolder: "allure-results" }],
[
"@estruyf/github-actions-reporter",
Expand All @@ -41,13 +41,17 @@ export default defineConfig({
actionTimeout: 30000,
video: "retain-on-failure",
screenshot: "only-on-failure",
trace: "on-first-retry",
},

/* Configure projects for major browsers */
projects: [
{
name: "desktop-chrome",
use: { ...devices["Desktop Chrome"] },
use: {
...devices["Desktop Chrome"],
video: "retain-on-failure",
},
},

/* Test against mobile viewports. */
Expand All @@ -56,6 +60,7 @@ export default defineConfig({
use: {
browserName: "chromium",
...devices["Pixel 5"], // Use predefined mobile device
video: "retain-on-failure",
},
testIgnore: "./playwright/specs/13-settings-keybinds.spec.ts",
},
Expand Down
Loading