Repository navigation
test(e2e): improve e2e setup - #762
Draft
adriangohjw wants to merge 17 commits into
Draft
adriangohjw wants to merge 17 commits into
adriangohjw wants to merge 17 commits into
Conversation
The worker fixture used a test-scoped container fixture in beforeAll and reset the database after every test, which forced serial runs. Move container startup, schema reset, migrations and Redis flush into a globalSetup that runs once, so tests can run fully in parallel with their own uniquely named data. - Refuse to run when DATABASE_URL does not point at the e2e container (a shell-exported dev URL would otherwise send test writes to dev) - Drop and recreate the public schema so reused containers match the current migrations - forbidOnly and 2 workers on CI, github + list reporters - Keep traces and videos on failure: 'on-first-retry' never fired since no retries are configured Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: adriangoh <adriangoh@open.gov.sg>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New `e2e` job builds the app with .env.e2e and runs Playwright against `next start` (dev server stays the local default) - Uploads traces and videos of failed tests as an artifact (7 days) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Playwright 1.57 cannot install system deps on ubuntu-latest (26.04). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signing in through the OTP UI in every test is slow, so each role gets a pre-signed-in session cookie instead. globalSetup seeds one user per role; a `setup:<role>` project (auth.setup.ts) mints that role's cookie, and the `<role>` project depends on it and runs the tests tagged `roleTag(role)`. Playwright only runs a setup project when selected tests need it, so a run without a role's tests never mints its cookie. Untagged tests run signed out. - Roles: `user`, plus `otherUser` as a second account for authorization tests - login-flow.e2e.ts is the one test that signs in through the UI, using a known OTP written over the stored hash - admin.e2e.ts shows both modes: signed-out redirect, signed-in page, and a per-role test that each session sees its own account - Move sessionOptions/SessionData to session-options.ts so code outside Next can import them without next/headers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mocks Builds on isomer's apps/studio/tests/e2e conventions, grouping by feature: - <feature>/ (auth/, admin/, public/): tests plus the page objects only that feature uses, one <screen>.e2e.ts and <screen>.po.ts per screen - fixtures/: helpers shared across features - <entity>.db.ts: read-only queries returning rows (user.db.ts) - <entity>-expect.ts: expect.poll wrappers over .db.ts getters - network.ts: page.route stubs (mockTrpcFailure) - auth/sign-in.e2e.ts replaces login-flow.e2e.ts, adding an error-state test; smoke.e2e.ts splits into public/landing and public/not-found - tests/e2e/README.md documents layout and rules; AGENTS.md points to it Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: adriangoh <adriangoh@open.gov.sg>
#761 enabled eslint-plugin-playwright on tests/e2e. Keep roleTag() and page-object expect* methods, and adjust the e2e override plus a few call sites so the combined stack lints on current main. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
They were only in the new e2e suite and are not a repo convention. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
|
Cursor Agent can help with this pull request. Just |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: adriangoh <adriangoh@open.gov.sg>
Drop comments that restate the code. Keep the ones that document vendor limits we cannot change. expectUserLastLogin now asserts lastLogin directly instead of polling behind a lint suppression. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
Public layout wraps the page in <main>, so the RestrictedFooter <footer> is not exposed as a contentinfo landmark. That made shows the landing page time out on CI. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
Same as isomer: turbo groups task output in CI unless --log-order=stream. Co-authored-by: adriangoh <adriangoh@open.gov.sg>
…cursor/e2e-combined-db13
adriangohjw
force-pushed
the
cursor/e2e-combined-db13
branch
from
November 16, 2026 10:18
fc5b3b2 to
57954eb
Compare
Changed import statements in various test files to utilize the `~tests/e2e` alias for better clarity and consistency. This includes updates in `playwright.config.ts`, `auth.setup.ts`, `global-setup.ts`, and other related files, enhancing the maintainability of the codebase.
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch stacks four Playwright e2e PRs on current main, which already includes #761. The source PRs stay open.
Source PRs
test/e2e-global-setup, draft. Set up the database once per run in Playwright globalSetup.ci/e2e-job, open. Run Playwright e2e tests in CI.test/e2e-auth, draft. Sign in via minted storage state, with role projects.test/e2e-conventions, draft. Feature folders, page objects, DB helpers, and network mocks.Skipped #641, which runs e2e against a Vercel preview. The four PRs combined without it.
Skipped BP-20 on
cursor/e2e-oxlint-offs-c9ad. #735 deletesapp-fixture.ts, so those oxlint offs were not needed.Merge order
Cherry-picked onto origin/main as 735, then 736, then 738, then 739. Then two commits for #761 oxlint and for dropping AAA comments.
Conflicts
On
app-fixture.ts, #735 deletes the file and #761 edited hook order. We deleted it, matching #735. globalSetup starts the containers.On
smoke.e2e.ts, #735 changes the import and #761 changes locators. We importtestfrom@playwright/testand keep #761's locators:getByRole('contentinfo'), nowaitForSelector, and no conditional 404 throw.On
ci.ymlandpackage.json, git auto-merged #736 onto main. We kept main's action pins andeslint-plugin-playwright, and addedbuild-e2e,start-e2e, and the e2e job. We did not putlodash-esback.On
smoke.e2e.tsagain, #739 deletes the file. We deleted it and split the tests intopublic/landingandpublic/not-found.The #761 playwright plugin wants literal test tags and an
expect()in each test. Tags are'@role:user'/'@role:otherUser'. Assertions live in the tests. URL regexes are module-scoped.auth.setup.tsusesexpect(baseURL).toBeDefined().Later commits on this branch
Removed Arrange / Act / Assert comments from the e2e tests and the README line that required them. #739 added those. Other tests in this repo do not use them.
CI e2e failed on the landing test:
getByRole('contentinfo')does not match RestrictedFooter because public layout wraps the page in<main>, so the<footer>is not a contentinfo landmark. The landing assertion now uses the page heading.The e2e job runs through turbo with
--log-order=streamso Playwright output is not held until the task ends (same as isomer).Dropped the e2e oxlint workarounds for
valid-test-tagsandexpect-expect.Verification
pnpm --filter @acme/web lintpassed.oxfmt --checkpassed on the changed web files.Playwright e2e was not run locally. This environment has no Docker.