Skip to content

Commit 56aafa3

Browse files
turegjorupclaude
andcommitted
test: stabilize calendar-1-single-booking Playwright test
Replace whole-DOM getByText("Ledigt") scan with a specific .status locator and add a .room-info visibility anchor before the assertion so Playwright doesn't poll an un-rendered tree. Mirrors the pattern of the passing calendar-0-single-booking sibling test (line 202). The previous form was flaky: getByText with toHaveCount(1) fails fast if .status briefly shows "Optaget" during the mount-then-effect re-render window (currentTime initializes from useState(dayjs()) before the page.clock.install propagates into the React tree). toHaveText keeps polling the same element until it settles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ad3bd91 commit 56aafa3

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

assets/tests/template/template-calendar.spec.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,12 @@ test("calendar-0-single-booking: ui tests", async ({ page }) => {
233233
test("calendar-1-single-booking: ui tests", async ({ page }) => {
234234
await fixTime(page);
235235
await page.goto("/template/calendar-1-single-booking");
236-
await expect(page.getByText("Ledigt")).toHaveCount(1);
237-
await expect(page.getByText("Ledigt")).toBeVisible();
236+
await expect(page.locator(".room-info")).toBeVisible();
237+
238+
const status = page.locator(".status");
239+
await expect(status).toHaveText("Ledigt");
238240

239241
await page.clock.runFor(61000);
240242

241-
await expect(page.getByText("Optaget")).toHaveCount(1);
242-
await expect(page.getByText("Optaget")).toBeVisible();
243+
await expect(status).toHaveText("Optaget");
243244
});

0 commit comments

Comments
 (0)