evOo-local/apps/web/e2e/onboarding-oo-swipe.spec.ts
cynarAI 0e1036b2ff
First-run onboarding UX: naming, locale, voices, Heute route, mobile drawer (#171)
* Fix first-run onboarding UX: naming, locale, voices, Heute route, mobile drawer

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix biome import order and formatting

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix biome formatting on OoStage and E2E specs

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix E2E specs for onboarding name step and Heute reload route

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix German onboarding heading matcher in E2E

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix German signup E2E, Escape menu stacking, and Heute rhythm click

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Make onboarding E2E helpers locale-aware for German UI

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix completeOnboarding language skip for Skip · locale label

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Use language-step Skip · locale button in completeOnboarding

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix German E2E: Nachricht composer, voice loading wait, Heute rhythm

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Stabilize Heute reload URL and German voice E2E assertions

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Fix Heute bootstrap redirect and German onboarding voices

When Kokoro lists no locale-matched voices, onboarding now uses offline
presets instead of showing English-only options. Shell bootstrap skips
bot redirects while the user is on /app/heute.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Relax German voice E2E name matching for voice labels

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Harden Heute route and German voice onboarding E2E

Rebased onto main with Expo SDK 57 typecheck fixes. Voice options expose
stable test ids; Shell keeps /app/heute across bootstrap and redirects
legacy /app/heute bot URLs. Heute coach E2E asserts URL after reload.

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

* Format Shell after Heute route helper

Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: cynarAI <cynarAI@users.noreply.github.com>
2026-10-06 20:15:36 +02:00

83 lines
2.6 KiB
TypeScript

import type { Page } from "@playwright/test";
import { expect, test } from "@playwright/test";
import { captureScreenshot, signup, skipOnboardingNameStep } from "./helpers";
test.beforeEach(async ({ page }) => {
await page.route("**/rpc/integrationSetup/get", (route) =>
route.fulfill({
json: {
json: {
canConfigure: true,
needsSetup: false,
webUrl: "https://example.test/integrations/setup",
providers: [{ id: "composio", configured: true }],
},
},
}),
);
});
test.use({
hasTouch: true,
isMobile: true,
viewport: { width: 390, height: 844 },
});
async function swipeLook(page: Page, start: [number, number], end: [number, number]) {
await page.getByTestId("onboarding-look-carousel").evaluate(
(root, { start, end }) => {
function touch([clientX, clientY]: [number, number]) {
return new Touch({ clientX, clientY, identifier: 1, target: root });
}
const first = touch(start);
root.dispatchEvent(
new TouchEvent("touchstart", {
bubbles: true,
cancelable: true,
changedTouches: [first],
touches: [first],
}),
);
const last = touch(end);
root.dispatchEvent(
new TouchEvent("touchend", {
bubbles: true,
cancelable: true,
changedTouches: [last],
touches: [],
}),
);
},
{ start, end },
);
}
test("mobile onboarding: category pick and swipe look previews", async ({ page }, testInfo) => {
const stamp = Date.now();
await signup(page, `oo-swipe-${stamp}@rakazo.test`, "password12", "Swipe Tester");
await page.waitForURL(/\/(onboarding|app)/, { timeout: 20_000 });
await expect(page.getByTestId("onboarding-oo-designer")).toBeVisible();
await expect(page.getByRole("heading", { name: /Design your Oo/i })).toBeVisible();
await expect(page.getByTestId("onboarding-look-preview")).toBeVisible();
await page.getByTestId("onboarding-look-category-coder").click();
await expect(page.getByTestId("onboarding-look-category-coder")).toHaveAttribute(
"aria-selected",
"true",
);
const secondDot = page.getByRole("tab", { name: /Look 2 of/i });
await swipeLook(page, [280, 420], [120, 420]);
await expect(secondDot).toHaveAttribute("aria-selected", "true");
if (testInfo) await captureScreenshot(page, testInfo, "mobile-onboarding-oo-swipe");
await page
.getByRole("button", { name: /Continue/i })
.first()
.click();
await skipOnboardingNameStep(page);
await expect(page.getByRole("heading", { name: /Choose your language/i })).toBeVisible();
});