You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(e2e): make WelcomePortal recovery navigation locale-independent (#590)
* fix(e2e): make WelcomePortal recovery navigation locale-independent
Extracted from PR #583's already-converged fix for exactly this failure
class -- see #589 for the reproduced blocker and #532 for the broader
startup/navigation nondeterminism this belongs to.
ensureWelcomePortalEntry()'s Factory-Reset recovery fallback (used when a
pre-existing/leftover project causes a cold boot to land in the main
shell instead of the WelcomePortal) drove Settings/Data/Factory-Reset
navigation through English/German-only translated button-name regexes,
after trying to force English via localStorage + reload. The Playwright
accessibility snapshot from #589's failure proved that reload doesn't
reliably take effect before the English-only lookup runs, so the
recovery path fails deterministically whenever the rare landing-in-main-
chrome race triggers with any other persisted locale (Spanish, in the
observed case).
Replaces the whole recovery flow with stable, locale-independent
data-tour/data-testid anchors end to end:
- clickSettingsNavItem() (helpers.ts) -- mobile-aware Settings navigation
keyed on data-tour="nav-settings"/"nav-more", not translated text.
- resolveStartupState() -- explicit WELCOME_PORTAL | MAIN_CHROME result
instead of repeated isVisible().catch(() => false) boolean soup.
- settings-nav- testid on SettingsView's NavButton, and
factory-reset-button / factory-reset-confirm-button testids on
DataSection / SettingsModals, so the recovery flow never depends on
translated labels.
- Sidebar.tsx gains the data-tour="nav-more" anchor the new helper
needs -- traced as a required dependency not otherwise present on main.
Adds a dedicated regression test (onboarding-entry-precondition.spec.ts)
that deterministically reproduces the exact failure shape (persisted
main-chrome project + non-English language, Mobile Chrome and desktop)
instead of relying on the rare race to expose it.
Deliberately excludes #583's unrelated handleFactoryReset error-toast
refactor (hooks/useSettingsView.ts) and its tests -- orthogonal to this
locale-independence fix, left for #583's own convergence.
* docs: add QNBS-v3 annotations for the new E2E test-selector attributes
Sidebar.tsx's dataTour prop and DataSection.tsx's factory-reset-button
testid were extracted from #583 with a plain JSDoc / no comment; the
repo convention requires a single-line QNBS-v3 annotation on non-trivial
TS/TSX changes. No behavior change.
* test(e2e): assert applied locale, not just the persisted seed
The prior assertion only proved localStorage held 'es', which doesn't
prove the app actually rendered in Spanish -- a broken addInitScript
seed or a failed es bundle load could still pass this test vacuously in
English, the exact vacuity the original comment claimed to prevent.
document.documentElement.lang (set by I18nProvider/App.tsx on mount) is
the real applied-locale authority; assert that instead, using
Playwright's own auto-wait toHaveAttribute matcher rather than a bare
evaluate() + expect().
* chore(ci): exclude tests/ from codecov patch coverage
vitest.config.ts's own coverage.include list scopes measurement to
application source (App.tsx, index.tsx, register-sw.ts, app/, components/,
features/, hooks/, services/, packages/*/src/) -- tests/** was never
instrumented, by design, since it's test code, not application source.
No codecov.yml existed to tell Codecov the same thing, so any PR adding
substantial new logic to an E2E helper file (as #590 does in
tests/e2e/helpers.ts) got counted as uncovered diff lines it structurally
cannot have coverage data for, producing a false codecov/patch failure
regardless of how well the actual application-source changes in the same
diff were covered.
Mirrors vitest.config.ts's coverage.exclude entry for the same path.
Pure YAML config -- rationale here in the commit message, not an inline
comment, per repo convention.
* fix(ci): correct codecov.yml ignore key to top-level per documented schema
ignore: is a documented top-level codecov.yml key, not nested under
coverage: -- confirmed against docs.codecov.com and codecov.io/validate
(parses to the expected (?s:tests/.*)\Z regex). The previous shape was
accepted by YAML parsing but wasn't the schema Codecov's config loader
actually recognizes.
awaitpage.locator('#sidebar-mobile').getByRole('button',{ name }).click();
30
30
}
31
31
32
+
/** Locale-independent Settings navigation: same mobile-aware fallback as clickNavItem, keyed on the stable `data-tour="nav-settings"` anchor instead of translated visible text. */
// QNBS-v3: this reload can itself race a pending debounced autosave and land back in WelcomePortal instead of main chrome — accept either state again rather than assuming main chrome.
// QNBS-v3: every step below uses a stable data-tour/data-testid anchor, never translated text — Playwright's own docs say addInitScript execution order across registrations is unspecified, so this cannot rely on forcing a language first.
test('reaches the entry point via the recovery flow with a persisted non-English language, on Mobile Chrome and desktop alike',async({
46
+
page,
47
+
})=>{
48
+
// QNBS-v3: a fresh boot lands on the portal regardless of locale — this combines a persisted main-chrome project with a non-English language so a mobile "More"-button locale regression actually fails, on every project including Mobile Chrome.
// QNBS-v3: asserts the applied locale, not just the persisted seed — a broken addInitScript or a failed es bundle load could otherwise pass this test vacuously in English.
0 commit comments