Skip to content

fix(e2e): read username_domain from /api/info — unblock CI on Release PR - #153

Merged
TaprootFreak merged 3 commits into
stagingfrom
fix/e2e-username-domain-from-server
Jun 1, 2026
Merged

fix(e2e): read username_domain from /api/info — unblock CI on Release PR#153
TaprootFreak merged 3 commits into
stagingfrom
fix/e2e-username-domain-from-server

Conversation

@TaprootFreak

Copy link
Copy Markdown
Contributor

Summary

PR #98 made username_domain server-reported per stage. The DEV node now answers username_domain: "dev.zkcoins.app", so the wallet renders addresses as xxx@dev.zkcoins.app on DEV. The e2e helpers still had @zkcoins.app PRD-hardcoded in the address-chip regex and the copy-button locator — turning the post-#98 server rollout into an E2E globalSetup failure on every Release PR (most recently #152 just now).

Fix

Lazy-load username_domain from /api/info once per test session in e2e/_helpers/api.ts:

  • Module-level cache (cachedUsernameDomain)
  • Exported getUsernameDomain() (async, fetches once, cached)
  • Exported zkAddressRegex(domain) pure builder
  • Fail-loud if /api/info is unreachable or the field is missing — no silent fallback to a hardcoded PRD domain (would match the wrong stage)

All consumers updated:

  • e2e/_helpers/wallet.tscreateSeedWallet, restoreSeedWallet, unlockWithPassword now derive the chip regex + copy-button locator at runtime
  • e2e/_helpers/screenshot.tsdefaultMasks now async, uses the dynamic regex for the chip mask; snap() awaits it (caller was already async, no public-API break)
  • Doc comments in wallet.ts, 05-disconnect.spec.ts, README.md aligned

Test plan

  • npx prettier --check e2e/ — clean
  • npx tsc --noEmit — clean for these changes (two pre-existing src/__tests__/ errors unchanged from staging)
  • CI green on this PR
  • After merge → promote → release: confirm globalSetup no longer fails on @zkcoins.app regex against DEV serving dev.zkcoins.app

…zkcoins.app

PR #98 made `username_domain` server-reported per stage — dev.zkcoins.app
now serves `dev.zkcoins.app` as the domain, so addresses render as
`xxx@dev.zkcoins.app` on DEV. The e2e helpers had `@zkcoins.app`
hardcoded into the wallet-chip regex and the copy-button locator,
turning the post-#98 frontend rollout into an E2E-globalSetup failure
on every Release PR.

Fix: lazy-load `username_domain` from /api/info once per test session
(cached, no fallback to a hardcoded domain — fail loud if /api/info is
unreachable so a misconfigured CI surface doesn't silently match the
wrong stage). All consumers — globalSetup's address-chip wait, the
copy-button locator, doc comments — now derive the suffix at runtime.

Validation:
  - `npx prettier --check e2e/` clean
  - `npx tsc --noEmit` clean
@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

[OK] Button-Inventory-Audit — all clear

Checked 72 testid(s) in src/ against 70 reference(s) in e2e/. Nothing to do.

Subagent fix only touched the helpers; three specs had the chip-
locator inlined as `text=/[0-9a-f]{8}@zkcoins\\.app/` and so still
hard-coded the PRD suffix. Hook them onto the same
`getUsernameDomain()` + `zkAddressRegex()` pair as the helpers.
@TaprootFreak
TaprootFreak marked this pull request as ready for review June 1, 2026 22:39
@TaprootFreak
TaprootFreak merged commit e1a94f3 into staging Jun 1, 2026
10 checks passed
TaprootFreak added a commit that referenced this pull request Jun 1, 2026
… PR (#153) (#154)

* fix(e2e): read username_domain from /api/info instead of hardcoding @zkcoins.app

PR #98 made `username_domain` server-reported per stage — dev.zkcoins.app
now serves `dev.zkcoins.app` as the domain, so addresses render as
`xxx@dev.zkcoins.app` on DEV. The e2e helpers had `@zkcoins.app`
hardcoded into the wallet-chip regex and the copy-button locator,
turning the post-#98 frontend rollout into an E2E-globalSetup failure
on every Release PR.

Fix: lazy-load `username_domain` from /api/info once per test session
(cached, no fallback to a hardcoded domain — fail loud if /api/info is
unreachable so a misconfigured CI surface doesn't silently match the
wrong stage). All consumers — globalSetup's address-chip wait, the
copy-button locator, doc comments — now derive the suffix at runtime.

Validation:
  - `npx prettier --check e2e/` clean
  - `npx tsc --noEmit` clean

* fix(e2e): use dynamic zkAddressRegex in specs 02/03/04 too

Subagent fix only touched the helpers; three specs had the chip-
locator inlined as `text=/[0-9a-f]{8}@zkcoins\\.app/` and so still
hard-coded the PRD suffix. Hook them onto the same
`getUsernameDomain()` + `zkAddressRegex()` pair as the helpers.

* fix(e2e): also remove hardcoded chip regex in 08-receive.spec.ts

Co-authored-by: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com>
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.

1 participant