diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index a792076a9..924d2481e 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -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' diff --git a/.github/workflows/playwright_comment.yml b/.github/workflows/playwright_comment.yml index 8b3d5bb69..5ae1adf85 100644 --- a/.github/workflows/playwright_comment.yml +++ b/.github/workflows/playwright_comment.yml @@ -35,6 +35,19 @@ 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 + uses: daun/playwright-report-summary@v3 + with: + report-file: playwright-results.json - name: Load artifacts into environment variables id: playwright @@ -70,18 +83,12 @@ 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. - - View Playwright Report (note: open the "playwright-report" artifact) + message: ${{ steps.playwright-summary.outputs.summary }} - 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. - - View Playwright Report (note: open the "playwright-report" artifact) + message: ${{ steps.playwright-summary.outputs.summary }} update-only: true \ No newline at end of file diff --git a/playwright.config.js b/playwright.config.js index acfceb1d1..dfbec44b6 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -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). */