From c4ea62dc1fc366917e7b89edb457d4b6058844df Mon Sep 17 00:00:00 2001 From: Laurent Bossavit <216452+Morendil@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:58:25 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A(ci)=20improve=20E2E=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disable retries and save trace for failed tests. 💚(ci) preserve server logs Save server logs to the same place as Playwright reports to aid debugging. 💚(ci) move back to 1 worker on CI At least three reasons - seems redundant with sharding - strong suspicion it's the reason for the ValidationError issue - that way the comment no longer tells a lie ;) 💚(ci) improve E2E tests Log into CHANGELOG to ensure the new test results impact PR status 🤷 💚(ci) make dummy data creation more robust This is a QR (Quick Response) fix for the failures in the "Add dummy data" step in E2E testing. Proper QC (Quality Control) needs a bit more thought. --- .github/workflows/people.yml | 4 ++++ CHANGELOG.md | 1 + src/backend/demo/management/commands/create_demo.py | 5 +++++ src/frontend/apps/e2e/playwright.config.ts | 8 ++++---- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/people.yml b/.github/workflows/people.yml index c66344d..3698200 100644 --- a/.github/workflows/people.yml +++ b/.github/workflows/people.yml @@ -203,6 +203,10 @@ jobs: - name: Run e2e tests run: cd src/frontend/ && yarn e2e:test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + - name: Save logs + if: always() + run: docker compose logs > src/frontend/apps/e2e/report/logs.txt + - uses: actions/upload-artifact@v4 if: always() with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af55cf..f111aad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to ### Fixed +- 💚(ci) improve E2E tests #492 - 🔧(sentry) restore default integrations - 🔇(backend) remove Sentry duplicated warning/errors - 👷(ci) add sharding e2e tests #467 diff --git a/src/backend/demo/management/commands/create_demo.py b/src/backend/demo/management/commands/create_demo.py index 009e363..97f989f 100755 --- a/src/backend/demo/management/commands/create_demo.py +++ b/src/backend/demo/management/commands/create_demo.py @@ -156,8 +156,13 @@ def create_demo(stdout): queue.flush() with Timeit(stdout, "Creating domains"): + created = set() for _i in range(defaults.NB_OBJECTS["domains"]): name = fake.domain_name() + if name in created: + continue + created.add(name) + slug = slugify(name) queue.push( diff --git a/src/frontend/apps/e2e/playwright.config.ts b/src/frontend/apps/e2e/playwright.config.ts index 482c3c4..57ea729 100644 --- a/src/frontend/apps/e2e/playwright.config.ts +++ b/src/frontend/apps/e2e/playwright.config.ts @@ -17,10 +17,10 @@ export default defineConfig({ fullyParallel: true, /* Fail the build on CI if you accidentally left test.only in the source code. */ forbidOnly: !!process.env.CI, - /* Retry on CI only */ - retries: process.env.CI ? 2 : 0, + /* Fail fast */ + retries: 0, /* Opt out of parallel tests on CI. */ - workers: process.env.CI ? 3 : undefined, + workers: process.env.CI ? 1 : undefined, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ reporter: [['html', { outputFolder: './report' }]], /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ @@ -28,7 +28,7 @@ export default defineConfig({ baseURL: baseURL, /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', + trace: 'retain-on-failure', }, webServer: {