Skip to content

Pin the buy e2e locale so the collection-IBAN test stops depending on account data - #1269

Open
joshuakrueger-dfx wants to merge 1 commit into
DFXswiss:developfrom
joshuakrueger-dfx:fix/buy-e2e-language-independent
Open

Pin the buy e2e locale so the collection-IBAN test stops depending on account data#1269
joshuakrueger-dfx wants to merge 1 commit into
DFXswiss:developfrom
joshuakrueger-dfx:fix/buy-e2e-language-independent

Conversation

@joshuakrueger-dfx

@joshuakrueger-dfx joshuakrueger-dfx commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What

e2e/buy-process.spec.ts → the should toggle between the personal and the collection IBAN test now opens the buy screen with &lang=en.

Why

The test asserts English labels (Payment Information, Show collection IBAN), but without a lang parameter the UI locale is resolved as

lang (URL) ?? user.language ?? storedLanguage ?? browserLanguage

(src/contexts/settings.context.tsx). With no parameter the locale therefore comes from the test account's stored user.language — server-side data anyone can change. It is currently German, so the app renders Zahlungsinformation, the English selectors match nothing and the test fails with element(s) not found.

Evidence

Run against an unmodified checkout of the current develop (51ce782), repo-pinned Playwright 1.57.0:

Result
without lang=en 1 failedelement(s) not found
with lang=en 1 passed

The baseline screenshots are unchanged by this PR — the parameter changes the locale, not the rendering that the baselines capture.

Scope

Test-only, four lines (three of them the comment explaining the failure mode). No production code, no other test touched.

Necessity

Symptom (verbatim): Error: expect(locator).toBeVisible() failedLocator: getByRole('heading', { name: 'Payment Information' }).locator('..').getByRole('button', { name: 'Show collection IBAN' })Error: element(s) not found. Reproduced on an unmodified checkout of develop 51ce782, so it is not caused by any code change.

Scale: this test is the only visual guard for the collection-IBAN UI, and it fails for every developer whose test account language is not English. The account language changed after the test was written on 2026-08-04, and two people hit it on that same day. It also blocks validating the two regenerated baselines in #1270.

Smaller fix considered: setting the test account language back to English on the dev API, zero lines of code — insufficient because that is mutable server-side state which the next person can change back, which is exactly how the test broke in the first place.

… account data

The test asserts English labels, but without a lang parameter the UI locale
comes from the test account's stored user.language. That field lives on the
server and was switched to German, so the English selectors find nothing and
the test fails with "element(s) not found" - on unchanged code.

Passing lang=en makes the test decide its own locale.
@joshuakrueger-dfx
joshuakrueger-dfx marked this pull request as ready for review August 4, 2026 18:18
@joshuakrueger-dfx

Copy link
Copy Markdown
Contributor Author

@marassteiner please review

@marassteiner

Copy link
Copy Markdown
Collaborator

EN: Working on this now — job dfxswiss__services__1269__pr-review.
DE: Ich arbeite jetzt daran — Auftrag dfxswiss__services__1269__pr-review.

@marassteiner marassteiner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review summary

Recommendation: approve

No merge-blockers. Test-only change; production code untouched. CI is green (Build and test, Analyze, CodeQL, review).

What changed

e2e/buy-process.spec.ts — collection-IBAN toggle test now opens the buy URL with &lang=en, so English role selectors (Payment Information, Show collection IBAN) no longer depend on mutable server-side user.language.

Gate A — diff review (conformity + logic)

Both independent review lanes completed a full pass over the PR diff vs develop and reported 0 findings.

  • Locale priority in settings.context.tsx is lang (URL) → user.language → store → browser; pinning lang=en correctly overrides account language.
  • Matches existing e2e convention (support-issue-receiver-iban.spec.ts, payment-and-special.spec.ts).
  • Scope matches the PR claim; comment documents the failure mode; no type-safety / security / semantic merge issues.

Gate B — local software run

Step Result
npm ci Failed on review host with npm 11 / Node 24 (package.json vs lock out of sync for optional platform packages). Not attributable to this PR (diff does not touch lockfile/deps).
npm install OK (fallback per review procedure)
npm run lint OK (exit 0)
CI=true npm run test -- --watchAll=false 72 suites / 788 tests passed
npm run start:dev (PORT=3019) Compiled (No issues found.); process listens on *:3019; GET http://127.0.0.1:3019/HTTP 200

Merge-blockers

None.

Follow-up findings

None filed. (A pre-existing sibling test in the same file also uses English labels without lang=en; it is outside this PR’s claim and not introduced or worsened here.)

CI

All PR checks green at review time: Build and test, Analyze, CodeQL, review.

No merge from this review.

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.

2 participants