Skip to content

Add deterministic Playwright screenshot flows - #39

Merged
L03TJ3 merged 7 commits into
mainfrom
copilot/automated-playwright-screenshot-flow
Jul 29, 2026
Merged

Add deterministic Playwright screenshot flows#39
L03TJ3 merged 7 commits into
mainfrom
copilot/automated-playwright-screenshot-flow

Conversation

Copilot AI commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Introduces a credential-free, deterministic browser-test mode for initial GoodWallet journeys. Chromium coverage now captures desktop and mobile checkpoints for localized onboarding, authenticated home actions, and claim verification.

  • Test harness

    • Adds Playwright configuration, Chromium projects, artifact retention, and E2E scripts.
    • Generates a fresh wallet seed per test run; enables only private-key test login.
  • Deterministic state

    • Blocks non-local browser requests and mocks token API responses.
    • Seeds onboarding, privacy, login, and claim-splash storage state.
    • Adds test-only representative home balance and verification-required claim state.
  • Checkpoint coverage

    • login-onboarding-da-{desktop,mobile}.png
    • home-balances-overflow-en-{desktop,mobile}.png
    • claim-requires-verification-en-{desktop,mobile}.png
NEXT_PUBLIC_PLAYWRIGHT_TEST_MODE=true
NEXT_PUBLIC_TEST_LOGIN_ENABLED=true

@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
good-wallet-v2 Ready Ready Preview Jul 29, 2026 6:47am

Request Review

Copilot AI changed the title [WIP] Establish automated Playwright and screenshot flow Add deterministic Playwright screenshot flows Jul 22, 2026
Copilot AI requested a review from L03TJ3 July 22, 2026 12:20
@sirpy
sirpy requested a review from Copilot July 27, 2026 15:50
@sirpy

sirpy commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@copilot how should I test this PR to make sure its working?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Playwright-based E2E harness to generate deterministic screenshot checkpoints for core GoodWallet journeys (onboarding/login entry, authenticated home, and GoodDollar claim) across desktop and mobile Chromium, gated behind a new Playwright test mode flag.

Changes:

  • Introduces Playwright config + Chromium desktop/mobile projects, plus Yarn scripts to run E2E flows.
  • Adds a playwrightTestMode config flag and uses it to force deterministic UI in Home (balance) and Claim (verification-required state).
  • Adds an initial E2E spec that blocks external browser traffic, seeds storage state, and writes named PNG checkpoints.

Reviewed changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
yarn.lock Adds @playwright/test/playwright dependencies to the lockfile.
tests-playwright/wallet-flows.e2e.ts New Playwright E2E flows that prepare deterministic state, block non-local requests, and capture screenshots.
src/sections/Home/components/WalletSection.tsx Forces a deterministic displayed USD value in Playwright mode and adds a test hook on the action container.
src/sections/GoodDollar/components/Claim/ClaimView.tsx Adds Playwright-mode short-circuit to render whitelist-required state.
playwright.config.ts New Playwright configuration, projects, artifact output, and Next dev server boot with test-mode env.
package.json Adds test:e2e scripts and Playwright dev dependency.
config.ts Adds playwrightTestMode flag to shared config.
.gitignore Ignores generated screenshots and Playwright artifacts directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +400 to +402
if (config.playwrightTestMode) {
return <RequireWhitelist onWhitelist={() => undefined} />
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

early return

Comment on lines +7 to +16
await page.context().route("**/*", (route) => {
const { hostname, pathname } = new URL(route.request().url())
if (pathname === "/api/tokens") {
return route.fulfill({
contentType: "application/json",
body: JSON.stringify({ tokens: {} }),
})
}
return hostname === "localhost" ? route.continue() : route.abort()
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aborting all non-localhost requests also blocks Google Fonts

Comment thread playwright.config.ts
Comment thread package.json

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot how should I test this PR to make sure its working?

The tests require no credentials — the config auto-generates a fresh throwaway wallet seed each run. Prerequisites: Node.js, Yarn, and the Playwright browser:

yarn install
yarn playwright install chromium

Run the screenshot tests (both desktop and mobile):

yarn test:e2e

This spins up the Next.js dev server automatically with test-mode flags, then runs tests-playwright/wallet-flows.e2e.ts against Desktop Chrome and iPhone 13 (Chromium) projects.

Expected output — 6 screenshots written to tests-playwright/:

File What it shows
login-onboarding-da-desktop.png Welcome dialog in Danish
login-onboarding-da-mobile.png Same, mobile viewport
home-balances-overflow-en-desktop.png Authenticated home with $124.68 balance
home-balances-overflow-en-mobile.png Same, with action bar scrolled to overflow end
claim-requires-verification-en-desktop.png Claim screen requiring face verification
claim-requires-verification-en-mobile.png Same, mobile

All tests pass when the 6 screenshots are written and there are no assertion failures. Artifacts (traces/videos) for any failing test are retained in tests-playwright/artifacts/.

If you want to refresh the stored screenshots as the new baseline, use:

yarn test:e2e:screenshots

Copilot finished work on behalf of sirpy July 27, 2026 15:58
Copilot AI requested a review from sirpy July 27, 2026 15:58
@blueogin
blueogin self-requested a review July 27, 2026 17:05

@blueogin blueogin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshots are write-only + gitignored : no baseline comparison, and CI doesn’t run Playwright.

Comment on lines +7 to +16
await page.context().route("**/*", (route) => {
const { hostname, pathname } = new URL(route.request().url())
if (pathname === "/api/tokens") {
return route.fulfill({
contentType: "application/json",
body: JSON.stringify({ tokens: {} }),
})
}
return hostname === "localhost" ? route.continue() : route.abort()
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aborting all non-localhost requests also blocks Google Fonts

Comment on lines +400 to +402
if (config.playwrightTestMode) {
return <RequireWhitelist onWhitelist={() => undefined} />
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

early return

@sirpy
sirpy removed their request for review July 28, 2026 13:00
@L03TJ3

L03TJ3 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@copilot Can you follow up on your own review comments and @blueogin review comments and apply the needed fixes.

  1. we want to have a organized folder where we commit screenshots
  2. playwright should be run when making new commits ensuring that affected screens represent their latest UI display and state

@L03TJ3

L03TJ3 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@copilot Whats the cause of the error and why can you not fetch generated screenshots? shouldn't they just be local in the sessions container?

Copilot AI commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Whats the cause of the error and why can you not fetch generated screenshots? shouldn't they just be local in the sessions container?

The screenshots were generated locally and are present in this checkout; they are committed in ad213b4 under tests-playwright/screenshots/{desktop,mobile}/. The earlier failure occurred after that commit was created (Changes before error encountered), so it was not a screenshot-fetch failure. A subsequent agent session uses a fresh container, so uncommitted files from a prior session are not accessible; committed files are available through the repository checkout, as they are here. The current agent workflow is still running, and there is not yet a failing CI job log to inspect.

…copilot/automated-playwright-screenshot-flow
@L03TJ3
L03TJ3 marked this pull request as ready for review July 29, 2026 06:31
@L03TJ3
L03TJ3 merged commit 5151aaf into main Jul 29, 2026
3 checks passed
@L03TJ3
L03TJ3 deleted the copilot/automated-playwright-screenshot-flow branch July 29, 2026 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PLAN] Automated Playwright and Screenshot Flow

5 participants