Skip to content

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

test(playwright): enhance core seeding with walkthrough options

Steven Enamakel598edffa6c54
diff --git a/app/test/playwright/helpers/core-rpc.ts b/app/test/playwright/helpers/core-rpc.ts
index 036a48b631..e35c90d614 100644
--- a/app/test/playwright/helpers/core-rpc.ts
+++ b/app/test/playwright/helpers/core-rpc.ts
@@ -62,16 +62,25 @@ async function resetCoreForWebUser(userId: string): Promise<void> {
});
}
-export async function seedBrowserCoreMode(page: Page): Promise<void> {
+export async function seedBrowserCoreMode(
+ page: Page,
+ options: { markWalkthroughComplete?: boolean } = {}
+): Promise<void> {
await page.addInitScript(
- ({ rpcUrl, token }) => {
+ ({ rpcUrl, token, markWalkthroughComplete }) => {
window.localStorage.setItem('openhuman_core_mode', 'cloud');
window.localStorage.setItem('openhuman_core_rpc_url', rpcUrl);
window.localStorage.setItem('openhuman_core_rpc_token', token);
- window.localStorage.setItem('openhuman:walkthrough_completed', 'true');
- window.localStorage.removeItem('openhuman:walkthrough_pending');
+ if (markWalkthroughComplete) {
+ window.localStorage.setItem('openhuman:walkthrough_completed', 'true');
+ window.localStorage.removeItem('openhuman:walkthrough_pending');
+ }
},
- { rpcUrl: CORE_RPC_URL, token: CORE_RPC_TOKEN }
+ {
+ rpcUrl: CORE_RPC_URL,
+ token: CORE_RPC_TOKEN,
+ markWalkthroughComplete: options.markWalkthroughComplete !== false,
+ }
);
}
@@ -209,10 +218,11 @@ export async function signInViaBypassUser(
export async function bootAuthenticatedPage(
page: Page,
userId: string,
- hash: string = '/home'
+ hash: string = '/home',
+ options: { markWalkthroughComplete?: boolean } = {}
): Promise<void> {
await resetCoreForWebUser(userId);
- await seedBrowserCoreMode(page);
+ await seedBrowserCoreMode(page, options);
await page.goto('/#/home');
await waitForAuthenticatedSnapshot(page);
await page.goto(`/#${hash}`);
diff --git a/app/test/playwright/specs/guided-tour-gates.spec.ts b/app/test/playwright/specs/guided-tour-gates.spec.ts
index 20f1a7798c..89ffb05332 100644
--- a/app/test/playwright/specs/guided-tour-gates.spec.ts
+++ b/app/test/playwright/specs/guided-tour-gates.spec.ts
@@ -31,7 +31,9 @@ test.describe('Guided tour gates', () => {
test.beforeEach(async ({ page }) => {
// Tour coverage does not exercise the auth callback. Seed the authenticated
// core state directly so callback timing cannot obscure walkthrough failures.
- await bootAuthenticatedPage(page, 'pw-guided-tour-user', '/home');
+ await bootAuthenticatedPage(page, 'pw-guided-tour-user', '/home', {
+ markWalkthroughComplete: false,
+ });
await dismissWalkthroughIfPresent(page);
await page.goto('/#/home');
await waitForAppReady(page);