Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(e2e): make the notification seed one-shot so a reload cannot undo it\n\nNOT RUN LOCALLY — standing rule forbids local execution; reasoned from source\nand verified by reading. The spec remains skipped.\n\ncoderabbitai is right, and this one would have silently broken the test it was\nmeant to support. `addInitScript` runs before EVERY new document, `page.reload()`\nincluded. The "read state survives a reload" test seeds items with read: false,\nmarks them all read, then reloads — at which point the init script re-applied\nthe original payload, restoring read: false over the state the test had just\npersisted and destroying the thing it asserts.\n\nGuarded with a localStorage marker, which survives the reload alongside the\npersisted blob, so the seed applies to the first seeded navigation only and\nevery later document sees whatever the app actually persisted.\n

M3gA-Minddbbfb3499a20
diff --git a/app/test/playwright/specs/notifications-feed-interaction.spec.ts b/app/test/playwright/specs/notifications-feed-interaction.spec.ts
index 6e583ec10f..115edff29a 100644
--- a/app/test/playwright/specs/notifications-feed-interaction.spec.ts
+++ b/app/test/playwright/specs/notifications-feed-interaction.spec.ts
@@ -128,14 +128,22 @@ async function openFeedWith(page: Page, items: SeedItem[]): Promise<void> {
await waitForAppReady(page);
const user = await resolveActiveUserId(page);
+ // One-shot. `addInitScript` runs before EVERY new document, `page.reload()`
+ // included, so without the marker the reload in "read state survives a reload"
+ // would re-apply the original payload — restoring `read: false` over the state
+ // that test just marked read, and destroying the very thing it asserts. The
+ // marker lives in localStorage, so it survives the reload alongside the
+ // persisted blob and the seed applies to the first seeded navigation only.
await page.addInitScript(
- ({ key, payload }) => {
+ ({ key, marker, payload }) => {
+ if (window.localStorage.getItem(marker)) return;
+ window.localStorage.setItem(marker, '1');
const raw = window.localStorage.getItem(key);
const blob: Record<string, string> = raw ? (JSON.parse(raw) as Record<string, string>) : {};
blob.items = JSON.stringify(payload);
window.localStorage.setItem(key, JSON.stringify(blob));
},
- { key: `${user}:persist:notifications`, payload: items }
+ { key: `${user}:persist:notifications`, marker: 'pw:notif-seed-applied', payload: items }
);
// A fresh document: the init script above runs first, so the store rehydrates