mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-07-21 10:28:33 +00:00
test(e2e): harden flaky auto-start-focus-on-play via hash nav (#7953)
Run #3925 (Build All & Release on master) failed solely on auto-start-focus-on-play.spec.ts:53 — every other test passed and the merged commit (local-backup) is unrelated to focus mode, so this is a flake, not a regression. The test enabled `autoStartFocusOnPlay` in Settings and then did a hard `page.goto('/')` reload before pressing play. A full 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, the reloaded app boots with the setting OFF, `syncTrackingStartToSession$` early-returns, and the focus indicator never spawns — a flake no expect timeout can fix. Switch to a same-document hash navigation (`/#/tag/TODAY/tasks`, the pattern already used by `navigateToMiscSettings`). This preserves the in-memory NgRx config the toggle updated synchronously, so the test exercises the auto-start behavior without depending on persistence timing. Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c9de10a785
commit
d7e5be08b5
1 changed files with 11 additions and 2 deletions
|
|
@ -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');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue