diff --git a/apps/web/app/office/setup/setup-wizard.tsx b/apps/web/app/office/setup/setup-wizard.tsx index 9a1eb73782..a177180b89 100644 --- a/apps/web/app/office/setup/setup-wizard.tsx +++ b/apps/web/app/office/setup/setup-wizard.tsx @@ -198,7 +198,7 @@ export function SetupWizard({ } }, [router]); - const closeHref = mode === "new" ? "/office" : "/"; + const closeHref = "/"; if (!showWizard) { return ( diff --git a/apps/web/e2e/pages/session-page.ts b/apps/web/e2e/pages/session-page.ts index 5b7fb8de56..69f6a46944 100644 --- a/apps/web/e2e/pages/session-page.ts +++ b/apps/web/e2e/pages/session-page.ts @@ -140,7 +140,7 @@ export class SessionPage { const attemptTimeout = opts.attemptTimeout ?? Math.min(15_000, Math.max(5_000, Math.floor(softTotalTimeout / 3))); const pollSlice = 1_500; - const idle = this.idleInput(); + const idle = this.anyIdleInput(); const start = Date.now(); let reloaded = false; @@ -299,6 +299,14 @@ export class SessionPage { return this.page.locator('[data-placeholder="Continue working on the task..."]'); } + /** Chat input placeholder when agent is idle in any current mode. */ + anyIdleInput(): Locator { + return this.page + .locator('[data-placeholder="Continue working on the task..."]') + .or(this.page.locator('[data-placeholder="Continue working on the plan..."]')) + .or(this.page.locator('[data-placeholder="Continue working on the file..."]')); + } + /** Chat input placeholder when agent is idle (plan mode). */ planModeInput(): Locator { return this.page.locator('[data-placeholder="Continue working on the plan..."]'); diff --git a/apps/web/e2e/tests/office/mobile-onboarding.spec.ts b/apps/web/e2e/tests/office/mobile-onboarding.spec.ts index ee8ebf772d..5f0aaeb10c 100644 --- a/apps/web/e2e/tests/office/mobile-onboarding.spec.ts +++ b/apps/web/e2e/tests/office/mobile-onboarding.spec.ts @@ -41,6 +41,18 @@ test.describe("Office onboarding — mobile layout", () => { expect(box.y + box.height).toBeLessThanOrEqual(viewport.height); }); + test("close button returns to homepage on mobile when adding a workspace", async ({ + testPage, + officeSeed: _, + }) => { + await testPage.goto(SETUP_ROUTE); + await expect(testPage.getByRole("heading", { name: STEP_0_HEADING })).toBeVisible(); + + await testPage.getByRole("button", { name: "Cancel" }).click(); + + await expect(testPage).toHaveURL((url) => url.pathname === "/", { timeout: 10_000 }); + }); + test("agent step (Step 1) fits within the viewport horizontally", async ({ testPage, officeSeed: _, diff --git a/apps/web/e2e/tests/office/onboarding.spec.ts b/apps/web/e2e/tests/office/onboarding.spec.ts index 8eabf4f516..ee0657df8e 100644 --- a/apps/web/e2e/tests/office/onboarding.spec.ts +++ b/apps/web/e2e/tests/office/onboarding.spec.ts @@ -74,7 +74,7 @@ test.describe("Onboarding", () => { }); }); - test('"Add workspace" button navigates to setup with mode=new', async ({ + test('"Add workspace" button opens setup and close returns to homepage', async ({ testPage, officeSeed: _, }) => { @@ -91,9 +91,12 @@ test.describe("Onboarding", () => { ).toBeVisible({ timeout: 10_000, }); + + await testPage.getByRole("button", { name: "Cancel" }).click(); + await expect(testPage).toHaveURL((url) => url.pathname === "/", { timeout: 10_000 }); }); - test("cancel button returns to dashboard when adding a new workspace", async ({ + test("cancel button returns to homepage when adding a new workspace", async ({ testPage, officeSeed: _, }) => { @@ -104,10 +107,7 @@ test.describe("Onboarding", () => { await testPage.getByRole("button", { name: "Cancel" }).click(); - await expect(testPage).toHaveURL(/\/office$/, { timeout: 10_000 }); - await expect(testPage.getByRole("heading", { name: /Dashboard/i }).first()).toBeVisible({ - timeout: 10_000, - }); + await expect(testPage).toHaveURL((url) => url.pathname === "/", { timeout: 10_000 }); }); test("inline CLI profile creation selects the profile for the new agent", async ({