From 9e694c57ae6cc45f2961858c30a21cd0357de4e0 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 26 Sep 2024 09:41:25 +0200 Subject: [PATCH] ci: upload Playwright tests' results even in PR builds We do that in all other workflows that run the Playwright tests, and it is very helpful when diagnosing issues (especially the screenshots that are stored on failure). This needs a slight change in the Playwright configuration where we now want to have the `github` reporter _in addition_ to the `html` reporter (and not instead of it). Signed-off-by: Johannes Schindelin --- .github/workflows/ci.yml | 7 ++++++- playwright.config.js | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc0a291395..e723882fa3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,4 +82,9 @@ jobs: - name: Run Playwright tests env: PLAYWRIGHT_TEST_URL: http://localhost:5000/ - run: npx playwright test --project=chrome \ No newline at end of file + run: npx playwright test --project=chrome + - uses: actions/upload-artifact@v4 + if: always() + with: + name: playwright-report + path: playwright-report/ \ No newline at end of file diff --git a/playwright.config.js b/playwright.config.js index 8701a20512..e35c9d9f22 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -22,7 +22,11 @@ module.exports = defineConfig({ workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Uses 'github' for GitHub Actions CI to generate annotations, otherwise 'html' */ - reporter: process.env.CI && process.env.PLAYWRIGHT_TEST_URL === 'http://localhost:5000/' ? 'github' : 'html', + reporter: [ + [ 'html' ], + ...(process.env.CI && process.env.PLAYWRIGHT_TEST_URL === 'http://localhost:5000/' + ? [ [ 'github' ] ] : []) + ], /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { /* Base URL to use in actions like `await page.goto('/')`. */