test(e2e): fix flaky supersync tests by preventing premature waitForURL resolution

The URL pattern /(active\/tasks|tag\/TODAY)/ was matching the current
/daily-summary page URL (which contains "tag/TODAY"), causing waitForURL
to resolve immediately without waiting for navigation back to the work
view. This meant syncAndWait() fired before archive operations were
fully uploaded, so Client B received no archived tasks.

Fix: add negative lookahead (?!\/daily-summary) to all three waitForURL
calls (two inline in supersync-daily-summary.spec.ts, one in the shared
archiveDoneTasks() helper). Also updates the helper to accept tag/TODAY
without /tasks suffix, consistent with the rest of the test suite.
This commit is contained in:
Johannes Millan 2026-04-13 18:33:19 +02:00
parent c47ab48eb7
commit 265b44db5d
2 changed files with 10 additions and 5 deletions

View file

@ -115,8 +115,9 @@ test.describe('@supersync Daily Summary Sync', () => {
await saveAndGoHomeBtn.click();
// Wait for Work View (Archived)
// Accept either active/tasks or tag/TODAY (with or without /tasks suffix)
await clientA.page.waitForURL(/(active\/tasks|tag\/TODAY)/);
// Use negative lookahead so we don't match the CURRENT /daily-summary URL —
// /(active\/tasks|tag\/TODAY)/ would match tag/TODAY/daily-summary immediately.
await clientA.page.waitForURL(/(active\/tasks|tag\/TODAY(?!\/daily-summary))/);
console.log('Client A archived tasks.');
// Sync A (upload archive)
@ -236,7 +237,8 @@ test.describe('@supersync Daily Summary Sync', () => {
await saveAndGoHomeBtn.click();
// Wait for navigation back to work view
await client.page.waitForURL(/(active\/tasks|tag\/TODAY)/);
// Use negative lookahead so we don't match the CURRENT /daily-summary URL.
await client.page.waitForURL(/(active\/tasks|tag\/TODAY(?!\/daily-summary))/);
// Wait a moment for any async effects to complete
await client.page.waitForTimeout(1000);

View file

@ -883,8 +883,11 @@ export const archiveDoneTasks = async (client: SimulatedE2EClient): Promise<void
await saveAndGoHomeBtn.waitFor({ state: 'visible', timeout: UI_VISIBLE_TIMEOUT });
await saveAndGoHomeBtn.click();
// Wait for navigation back to work view
await client.page.waitForURL(/(active\/tasks|tag\/TODAY\/tasks)/);
// Wait for navigation back to work view.
// Use negative lookahead: /(active\/tasks|tag\/TODAY)/ would match the
// current /daily-summary URL; adding (?!\/daily-summary) ensures we wait
// for a real navigation. Also handles tag/TODAY without /tasks suffix.
await client.page.waitForURL(/(active\/tasks|tag\/TODAY(?!\/daily-summary))/);
await client.page.waitForTimeout(UI_SETTLE_STANDARD);
};