Skip to content

Commit

Permalink
Merge pull request #9 from MarvNC/playwright-reporter
Browse files Browse the repository at this point in the history
Playwright reporter
  • Loading branch information
MarvNC authored Oct 29, 2024
2 parents 7ed53c1 + dde2f89 commit 01ad62c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 8 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,9 @@ jobs:
name: playwright-output
path: playwright-output
if: github.event_name == 'pull_request'

- uses: actions/upload-artifact@v4
with:
name: playwright-results-json
path: playwright-results.json
if: github.event_name == 'pull_request'
31 changes: 24 additions & 7 deletions .github/workflows/playwright_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
name: master-screenshots-outcome
- name: Grab playwright-results-json from PR run
uses: dawidd6/action-download-artifact@bf251b5aa9c2f7eeb574a96ee720e24f801b7c11 # pin@v2
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
run_id: ${{ github.event.workflow_run.id }}
name: playwright-results-json

- name: Generate summary from playwright-results.json (expected to fail to comment)
id: playwright-summary
if: github.event_name == 'pull_request'
uses: daun/playwright-report-summary@v3
with:
report-file: playwright-results.json

- name: Load artifacts into environment variables
id: playwright
Expand Down Expand Up @@ -70,18 +84,21 @@ jobs:
if: steps.playwright.outputs.MASTER_SCREENSHOTS_OUTCOME != 'failure' && (steps.playwright.outputs.FLAKY != 0 || steps.playwright.outputs.FAILED != 0)
with:
issue: ${{ steps.source-run-info.outputs.pullRequestNumber }}
message: |
:warning: Flaky tests or visual differences caused by this PR; please check the playwright report.
message: ${{ steps.playwright-summary.outputs.summary }}
# message: |
# :warning: Flaky tests or visual differences caused by this PR; please check the playwright report.

<a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}#artifacts">View Playwright Report</a> (note: open the "playwright-report" artifact)
# <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}#artifacts">View Playwright Report</a> (note: open the "playwright-report" artifact)

- name: "[Comment] Success: No visual differences introduced by this PR"
uses: mshick/add-pr-comment@dd126dd8c253650d181ad9538d8b4fa218fc31e8 # pin@v2
if: steps.playwright.outputs.MASTER_SCREENSHOTS_OUTCOME != 'failure' && steps.playwright.outputs.FLAKY == 0 && steps.playwright.outputs.FAILED == 0
with:
issue: ${{ steps.source-run-info.outputs.pullRequestNumber }}
message: |
:heavy_check_mark: No visual differences introduced by this PR.
message: ${{ steps.playwright-summary.outputs.summary }}
# message: |
# :heavy_check_mark: No visual differences introduced by this PR.

<a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}#artifacts">View Playwright Report</a> (note: open the "playwright-report" artifact)
update-only: true
# <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}#artifacts">View Playwright Report</a> (note: open the "playwright-report" artifact)
# TODO: uncomment
# update-only: true
5 changes: 4 additions & 1 deletion playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : void 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: [
['html'],
['json', {outputFile: 'playwright-results.json'}],
],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
Expand Down

0 comments on commit 01ad62c

Please sign in to comment.