mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
test(e2e): target the DateField overlay and ISO mirror in the medication wizard
The course-window date field now keeps its ISO value on a hidden native input (data-slot) and edits through a text overlay (data-testid). Fill the overlay, then assert the committed ISO value on the hidden input.
This commit is contained in:
1 parent
bf58d5d0b3
commit
291fb30209
2 files changed
+12
-1
No files matched your search
@@ -59,6 +59,9 @@ test.describe("medication wizard — daily", () => {
|
||||
|
||||
// Step 4 — course window (today by default).
|
||||
await expectStep(page, 4);
|
||||
// `DateField` keeps the ISO value on a hidden native date input
|
||||
// (data-slot), while the visible overlay paints the locale-formatted
|
||||
// string. Assert the committed ISO value on the hidden input.
|
||||
await expect(
|
||||
page.locator('[data-slot="course-window-starts"]'),
|
||||
).toHaveValue(/^\d{4}-\d{2}-\d{2}$/);
|
||||
|
||||
@@ -62,7 +62,15 @@ test.describe("medication wizard — one-shot", () => {
|
||||
// Step 4 — course window. Set startsOn to a deterministic date so
|
||||
// the post body assertion below is stable.
|
||||
await expectStep(page, 4);
|
||||
await page.locator('[data-slot="course-window-starts"]').fill("2026-10-15");
|
||||
// `DateField` rides a visible text overlay (the data-testid) that parses
|
||||
// a typed ISO string back to the canonical value; the hidden native input
|
||||
// (data-slot) carries the committed ISO. Type into the overlay, then blur
|
||||
// so the parse commits.
|
||||
await page.getByTestId("course-window-starts-field").fill("2026-10-15");
|
||||
await page.getByTestId("course-window-starts-field").blur();
|
||||
await expect(
|
||||
page.locator('[data-slot="course-window-starts"]'),
|
||||
).toHaveValue("2026-10-15");
|
||||
await clickNext(page);
|
||||
|
||||
// Step 5 — pick Einmalig. The path compresses to 5 steps the
|
||||
|
||||
Reference in new issue
Block a user