Skip to content

chore(e2e): refresh screenshot baselines and drop unread snapshot files - #3005

Merged
CassioMG merged 5 commits into
masterfrom
chore/refresh-e2e-snapshots
Sep 11, 2026
Merged

chore(e2e): refresh screenshot baselines and drop unread snapshot files#3005
CassioMG merged 5 commits into
masterfrom
chore/refresh-e2e-snapshots

Conversation

@CassioMG

Copy link
Copy Markdown
Contributor

TL;DR

The Playwright screenshot baselines had quietly drifted out of date, and a pile of
snapshot files in the repo were no longer read by any test. This refreshes the 28
baselines the suite actually compares against and deletes 40 dead snapshot files
plus one test helper that nothing imports.

The reason the drift went unnoticed is worth knowing: the shared screenshot helper
allows a 2% differing-pixel ratio, and Playwright's per-pixel colour threshold
means only text glyphs count as "different" — flat panel backgrounds shifting by a
few RGB steps do not. That is enough headroom for an entire redesigned section to
pass comparison. One baseline still showed the old docs.freighter.app domain and
an expanded transaction details panel, while the screen today shows
play.freighter.app, a Network row, a Memo row, and details collapsed behind a
link — and it passed. Tightening that tolerance is deliberately not part of this
PR; see the follow-ups below.

No test logic changed, and no product code changed.

Implementation details (for agents)

What changed

Two commits, kept separate so the binary refresh and the deletions can be reviewed
independently.

  1. test(e2e): refresh screenshot baselines that no longer match the UI — 28 PNGs
    regenerated with yarn test:e2e … --update-snapshots=all. These are every
    baseline the suite currently compares against, except one (see below).

  2. test(e2e): delete snapshot files and a helper that nothing reads — 41 deletions.

Why the 40 snapshot files were dead

Playwright resolves screenshot paths as
{arg}{-projectName}{-snapshotSuffix}{ext}, and the only configured project is
named chromium
.
So the effective filename is always <name>-chromium-darwin.png, and the 30 files
ending in a plain -darwin.png were never read by any comparison — leftovers from
the older toMatchSnapshot naming, which omitted the project name.

Ten more were correctly named but referenced by nothing:

  • addAsset.test.ts-snapshots/manage-assets-page — only
    integration-tests/addAssetIntegration.test.ts references manage-assets-page.png,
    and it resolves to its own snapshot directory.
  • addAsset.test.ts-snapshots/manage-assets-unverified-token
  • freighterApiIntegration.test.ts-snapshots/domain-not-allowed and
    domain-not-allowed-sign-message
  • all six under sendPayment.test.ts-snapshots

The dead helper

extension/e2e-tests/helpers/sendPayment.ts exported sendXlmPayment, which took
the send-payment-to / -amount / -sent screenshots. No test file imports it —
sendPayment.test.ts was rewritten to cover the flow with element assertions
instead. The helper, and the whole sendPayment.test.ts-snapshots directory
(including three baselines whose names the helper never even referenced), are
removed together.

Verification

  • yarn test:e2e — full suite, repo config (retries: 5, maxFailures: 1):
    233 passed, 10 skipped, 0 failed, 0 flaky, exit 0.
  • yarn test:ci1774 passed, 51 skipped, 0 failed across 220 suites.
  • yarn build:extension — exit 0.
  • ESLint does not apply: the flat config globally ignores
    **/e2e-tests/**/*
    .
  • Every snapshot directory now matches its test file's references exactly — nothing
    missing, nothing unread — checked by enumerating screenshot: references per test
    file and diffing against directory contents.
  • The regenerated baselines were spot-checked visually (sign-transaction,
    account-history, network-form-page, recovery-modal) to confirm they capture
    fully-rendered screens rather than loading states.
  • That the comparison is genuinely running was confirmed by substituting an
    unrelated image of the same dimensions for one baseline, which failed as expected.

Follow-ups / out of scope

  • The screenshot tolerance. expectPageToHaveScreenshot passes
    maxDiffPixelRatio: 0.02

    — roughly 18k pixels of a 1280×720 shot — and Playwright's per-pixel threshold
    defaults to 0.2. Left alone on purpose: baselines are generated on developer
    machines and compared on CI's macOS runner, so some of that headroom is probably
    absorbing font-rendering differences, and tightening it is a team call with real
    flake risk.
  • One baseline could not be refreshed.
    addAsset.test.ts-snapshots/manage-assets-verified-token-chromium-darwin.png is
    referenced only by a test.fixme test (navigation after "Manage Assets" does not
    complete reliably), so it never executes. It is kept rather than deleted, since
    the reference still exists, but it remains stale and will need regenerating
    whenever that test is fixed.

🤖 Generated with Claude Code

CassioMG and others added 2 commits September 9, 2026 19:09
Several baselines had drifted far from what the extension renders. The sign-transaction one, for example, still showed docs.freighter.app and an expanded transaction details panel, while the current screen shows play.freighter.app, a Network row, a Memo row, and details collapsed behind a link.

The drift went unnoticed because expectPageToHaveScreenshot compares with maxDiffPixelRatio: 0.02 — about 18k pixels of a 1280x720 shot — and Playwright's per-pixel threshold defaults to 0.2, so only text glyphs register as different. Flat panel backgrounds shifting by a few RGB steps do not count, which leaves enough headroom for a whole redesigned section to slip through unflagged.

Regenerated with --update-snapshots=all so the baselines describe the screens as they are today, rather than sitting just inside the tolerance.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Playwright names screenshots {arg}{-projectName}{-snapshotSuffix}, and the only project is named chromium, so the 30 files ending in plain -darwin.png were never read by any comparison. They are leftovers from the older toMatchSnapshot naming, which omitted the project name.

Ten more had the right name but no reference: manage-assets-page and manage-assets-unverified-token under addAsset (addAssetIntegration references manage-assets-page from its own snapshot directory), domain-not-allowed and domain-not-allowed-sign-message, and all six under sendPayment.

The sendPayment ones belonged to helpers/sendPayment.ts, which no test file imports. The test it once served was rewritten and now covers the flow with element assertions instead, so the helper and its snapshot directory go too.

Every snapshot directory now matches its test file's references exactly, with nothing missing and nothing unread.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings September 10, 2026 01:11

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

Refreshes active E2E screenshot baselines and removes unused snapshot infrastructure.

Changes:

  • Refreshes 28 active Playwright baselines.
  • Removes unused snapshots and the unreferenced payment helper.
  • Leaves stale README references to the deleted snapshot directory.
Suppressed comments (1)

extension/e2e-tests/helpers/sendPayment.ts:1

  • Deleting the send-payment snapshot set leaves the E2E guide with stale references: extension/e2e-tests/README.md:238 still presents sendPayment.test.ts-snapshots/ as an active mapping, and line 330 links to that now-missing directory. Please update those references as part of this cleanup so the documented snapshot workflow has no broken link.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

PR Preview build is ready: https://github.com/stellar/freighter/releases/tag/untagged-f94a75a300332e8264a6
Backend: V1 prod + V2 beta (no sandbox configured for @CassioMG). SDF collaborators only — install instructions in the release description.

The guide used sendPayment.test.ts as its example of a test-to-snapshot-directory mapping, as the target of the per-test --update-snapshots command, and as the Additional Resources link to the baselines. That directory is gone, so the link was broken and the command would have updated nothing.

All three now point at onboarding.test.ts, which carries twelve baselines and is the largest set in the suite.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings September 10, 2026 01:23

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

Copilot reviewed 2 out of 70 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings September 10, 2026 15:32

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

Copilot reviewed 2 out of 70 changed files in this pull request and generated no new comments.

@CassioMG CassioMG self-assigned this Sep 10, 2026
@CassioMG
CassioMG requested a review from a team September 10, 2026 15:35
Copilot AI review requested due to automatic review settings September 11, 2026 22:45

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

Copilot reviewed 2 out of 70 changed files in this pull request and generated no new comments.

@CassioMG
CassioMG merged commit be7c780 into master Sep 11, 2026
12 checks passed
@CassioMG
CassioMG deleted the chore/refresh-e2e-snapshots branch September 11, 2026 23:02
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.

3 participants