mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
Let the vaccination journey wait for its list before adding
The header add disappears once an empty Impfpass has loaded; the journey now waits for a record or the empty state and clicks whichever add control is on screen.
This commit is contained in:
1 parent
276cac1d5b
commit
a1a0afe675
1 file changed
+19
-6
@@ -84,11 +84,19 @@ async function captureDose(
|
||||
booster: "confirm" | "decline" | "none";
|
||||
},
|
||||
): Promise<void> {
|
||||
// The header Add renders whether or not the list is empty, so clicking it
|
||||
// works in both states. click() auto-waits for the button to be actionable,
|
||||
// which avoids racing an instant visibility read against the client render
|
||||
// (an empty-state-only branch times out once a record already exists).
|
||||
await page.locator('[data-slot="vaccination-add"]').first().click();
|
||||
// While the Impfpass is empty its empty state carries the add action and
|
||||
// the header drops its own, so wait for the list to settle (a record or
|
||||
// the empty state) and click whichever add control is then on screen.
|
||||
await expect(
|
||||
page.locator('[data-vaccination-id], [data-slot="empty-state"]').first(),
|
||||
).toBeVisible();
|
||||
await page
|
||||
.locator(
|
||||
'[data-slot="vaccination-add"], [data-slot="vaccination-add-empty"]',
|
||||
)
|
||||
.filter({ visible: true })
|
||||
.first()
|
||||
.click();
|
||||
|
||||
await expect(page.locator('[data-slot="vaccination-form"]')).toBeVisible();
|
||||
|
||||
@@ -321,7 +329,12 @@ test.describe("vaccinations", () => {
|
||||
).toBeVisible({ timeout: 15_000 });
|
||||
await expectNoSeriousAxe(page);
|
||||
|
||||
await page.locator('[data-slot="vaccination-add"]').first().click();
|
||||
await page
|
||||
.locator(
|
||||
'[data-slot="vaccination-add"], [data-slot="vaccination-add-empty"]',
|
||||
)
|
||||
.last()
|
||||
.click();
|
||||
await expect(page.locator('[data-slot="vaccination-form"]')).toBeVisible();
|
||||
await expectNoSeriousAxe(page);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user