activity-sport-type: e2e test + register spec in playwright config
- e2e/activity-sport-type.test.ts: register → create activity with a sport → assert the sport badge renders on the detail page. Passes locally against an E2E=true server. - playwright.config.ts: add the `activity-sport-type` project so the spec actually runs (specs only execute if a project testMatch matches them). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
2cb32cd2d3
commit
953c79befe
3 changed files with 40 additions and 3 deletions
29
e2e/activity-sport-type.test.ts
Normal file
29
e2e/activity-sport-type.test.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { test, expect, gotoHydrated } from "./fixtures/test";
|
||||
import { setupVirtualAuthenticator, registerUser } from "./helpers/auth";
|
||||
|
||||
test.describe("Activity sport type", () => {
|
||||
test("create an activity with a sport renders the sport badge", async ({ page }) => {
|
||||
const cdp = await page.context().newCDPSession(page);
|
||||
await setupVirtualAuthenticator(cdp);
|
||||
|
||||
const stamp = Date.now();
|
||||
await registerUser(page, `sport-${stamp}@example.com`, `sport${stamp}`);
|
||||
|
||||
await gotoHydrated(page, "/activities/new");
|
||||
|
||||
// Name deliberately avoids the sport word so the badge assertion can't
|
||||
// accidentally match the title.
|
||||
await page.getByLabel("Name").fill("Saturday loop");
|
||||
// exact: the nav avatar button's aria-label is the username ("sport…"),
|
||||
// which a loose "Sport" match would also catch.
|
||||
await page.getByLabel("Sport", { exact: true }).selectOption("gravel");
|
||||
await page.getByRole("button", { name: "Create Activity" }).click();
|
||||
|
||||
// Redirects to the new activity's detail page.
|
||||
await expect(page).toHaveURL(/\/activities\/[0-9a-f-]+$/, { timeout: 10000 });
|
||||
|
||||
// Title plus the localized sport badge ("Gravel").
|
||||
await expect(page.getByRole("heading", { name: "Saturday loop" })).toBeVisible();
|
||||
await expect(page.getByText("Gravel")).toBeVisible();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue