diff --git a/e2e/tests/focus-mode/auto-start-focus-on-play.spec.ts b/e2e/tests/focus-mode/auto-start-focus-on-play.spec.ts index 049798512f..2debb930e3 100644 --- a/e2e/tests/focus-mode/auto-start-focus-on-play.spec.ts +++ b/e2e/tests/focus-mode/auto-start-focus-on-play.spec.ts @@ -60,8 +60,17 @@ test.describe('autoStartFocusOnPlay', () => { // Step 1: enable the new setting via Settings UI. await enableAutoStartOnPlay(page); - // Step 2: navigate back to work view and add a task. - await page.goto('/'); + // Step 2: navigate back to the work view and add a task. + // Use a same-document hash navigation rather than `page.goto('/')`. A hard + // reload re-bootstraps the app and re-reads the config from IndexedDB, + // which races the debounced persistence of the toggle we just flipped: if + // the write hasn't flushed yet, the reloaded app boots with + // autoStartFocusOnPlay=false and the session never spawns — a flake no + // timeout can fix. Hash nav keeps the in-memory NgRx config that the toggle + // already updated synchronously, so we test the auto-start behavior without + // depending on persistence timing. + await page.goto('/#/tag/TODAY/tasks'); + await page.waitForURL(/tag\/TODAY/); await workViewPage.waitForTaskList(); await workViewPage.addTask('AutoStartTask');