From bbcc88caf1c344c9d3ee0c843a066df5410e5b68 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 30 Sep 2026 23:50:46 +0300 Subject: [PATCH] test(i18n): the second-card locale check counts locale requests only (#722) secondCardReusesPageLocale compared the count of all page requests before and after the second card mounted. The only extra request is that card's own plan image: under page.route the browser HTTP cache is off, so it is fetched again, and whether it lands before the read is a race. The German locale file itself is loaded exactly once per page. The check now counts requests for the locale chunk only and still fails if the second card fetches it again. Issue: #722 User-Visible: no Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd --- demo/smoke_german_locale.mjs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/demo/smoke_german_locale.mjs b/demo/smoke_german_locale.mjs index 2d0a260b..bb196ac1 100644 --- a/demo/smoke_german_locale.mjs +++ b/demo/smoke_german_locale.mjs @@ -53,11 +53,15 @@ const out = { && window.__card.getAttribute('lang') === 'de'), }; -const beforeSecond = requested.length; +// #722: count only the locale chunk. Every new card mounts its own plan +// , and under page.route (HTTP cache off) that is a fresh request for +// the backdrop; whether it lands before this read is a race, not a locale fact. +const localeRequests = () => requested.filter((path) => path.endsWith(`/${localeName}`)).length; +const beforeSecond = localeRequests(); await cold.page.evaluate(replaceWithGermanCard, ' 2'); await cold.page.waitForFunction(() => window.__card?._model?.length > 0 && window.__card._t('btn.save') === 'Speichern'); -out.secondCardReusesPageLocale = requested.length === beforeSecond; +out.secondCardReusesPageLocale = localeRequests() === beforeSecond; const failed = await launchColdView(); let failedRequests = 0;