diff --git a/scripts/windows-smoke.mjs b/scripts/windows-smoke.mjs index c2b5636..2f08e1a 100644 --- a/scripts/windows-smoke.mjs +++ b/scripts/windows-smoke.mjs @@ -406,11 +406,16 @@ record( try { await page.evaluate(([k, f]) => localStorage.setItem(k, JSON.stringify(f)), [KEY, fake]); await page.reload(); - const moved = await until(async () => { + // Step 2 mirrors the tokens, reads them back to verify, and only then strips + // them from localStorage, all in the same boot. Wait for the strip rather + // than stopping at the first "mirrored" sighting (that in-between state made + // a step-2 build look like a step-1 one). + const stripped = await until(async () => { const st = await state(); - return st.tokensIn === 'keychain' || (st.blobHasToken && st.kcToken === fake.accessToken) ? st : undefined; + return st.tokensIn === 'keychain' ? st : undefined; }, 30_000); - if (moved && moved.tokensIn !== 'keychain') { + const moved = stripped ?? (await state()); + if (!stripped && moved.blobHasToken && moved.kcToken === fake.accessToken) { record(name, 'n/a', 'build mirrors the tokens but keeps them in localStorage (before step 2)'); } else { await page.reload();