mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-03 05:08:53 +00:00
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018qZfe7YS4rqEMKoVeS3GKd
This commit is contained in:
@@ -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
|
||||
// <image>, 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;
|
||||
|
||||
Reference in New Issue
Block a user