From 422869b00eb42bac967ba1a98667bcaf380bfe98 Mon Sep 17 00:00:00 2001 From: Gustav Hansen Date: Wed, 27 Sep 2023 14:41:23 +0200 Subject: [PATCH 1/3] chore(e2e): store test traces for failed tests as GH action artifacts --- .github/workflows/tests.yml | 6 ++++++ playwright.base.config.js | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e1abf9733..151424fa31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -177,6 +177,12 @@ jobs: - name: Run E2E tests run: yarn test:e2e --setup --concurrency=1 --project=${{ matrix.project }} + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: playwright-trace + path: test-apps/e2e/**/test-results/**/trace.zip + api_ce_pg: if: needs.changes.outputs.backend == 'true' runs-on: ubuntu-latest diff --git a/playwright.base.config.js b/playwright.base.config.js index 94ffb766e7..c4588f6cd4 100644 --- a/playwright.base.config.js +++ b/playwright.base.config.js @@ -36,8 +36,8 @@ const createConfig = ({ port, testDir, appDir }) => ({ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ actionTimeout: 0, - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'off', + /* Collect trace when a test failed. See https://playwright.dev/docs/trace-viewer */ + trace: 'retain-on-failure', }, /* Configure projects for major browsers */ From 4b145c82d52de0eb36bba89c8c6a5cbb1f7103b5 Mon Sep 17 00:00:00 2001 From: Gustav Hansen Date: Wed, 27 Sep 2023 14:47:21 +0200 Subject: [PATCH 2/3] chore(e2e): limit trace retention to one day --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 151424fa31..6e8c165cdc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -182,6 +182,7 @@ jobs: with: name: playwright-trace path: test-apps/e2e/**/test-results/**/trace.zip + retention-days: 1 api_ce_pg: if: needs.changes.outputs.backend == 'true' From 67ef868b9106090744d0c25e931a26b4dd5b8262 Mon Sep 17 00:00:00 2001 From: Gustav Hansen Date: Thu, 28 Sep 2023 11:47:43 +0200 Subject: [PATCH 3/3] chore(e2e): limit traces to CI environments --- playwright.base.config.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/playwright.base.config.js b/playwright.base.config.js index c4588f6cd4..e8805cb2b3 100644 --- a/playwright.base.config.js +++ b/playwright.base.config.js @@ -36,8 +36,11 @@ const createConfig = ({ port, testDir, appDir }) => ({ /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ actionTimeout: 0, - /* Collect trace when a test failed. See https://playwright.dev/docs/trace-viewer */ - trace: 'retain-on-failure', + /* Collect trace when a test failed on the CI. See https://playwright.dev/docs/trace-viewer + Until https://github.com/strapi/strapi/issues/18196 is fixed we can't enable this locally, + because the Strapi server restarts every time a new file (trace) is created. + */ + trace: process.env.CI ? 'retain-on-failure' : 'off', }, /* Configure projects for major browsers */