mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
test(timeline): wait for the values menu before reading its dots
This commit is contained in:
1 parent
5f5ddd37a6
commit
b5e15fc105
1 file changed
+16
-8
+16
-8
@@ -258,14 +258,22 @@ test("value lines: quarterly means, gaps kept, short ones bridged, up to six lin
|
||||
for (const stroke of marks) expect(stroke).toBe(colour);
|
||||
}
|
||||
// The menu marks each chosen line with the same colour.
|
||||
await page.locator('[data-slot="timeline-values-trigger"]').click();
|
||||
const dots = await page
|
||||
.locator(
|
||||
'[data-slot="timeline-values-option"][aria-checked="true"] [data-slot="timeline-values-dot"]',
|
||||
)
|
||||
.evaluateAll((els) =>
|
||||
els.map((el) => getComputedStyle(el).backgroundColor),
|
||||
);
|
||||
const trigger = page.locator('[data-slot="timeline-values-trigger"]');
|
||||
await expect(async () => {
|
||||
if ((await trigger.getAttribute("data-state")) !== "open") {
|
||||
await trigger.click();
|
||||
}
|
||||
await expect(trigger).toHaveAttribute("data-state", "open", {
|
||||
timeout: 1_000,
|
||||
});
|
||||
}).toPass();
|
||||
const chosenDots = page.locator(
|
||||
'[data-slot="timeline-values-option"][aria-checked="true"] [data-slot="timeline-values-dot"]',
|
||||
);
|
||||
await expect(chosenDots).toHaveCount(6);
|
||||
const dots = await chosenDots.evaluateAll((els) =>
|
||||
els.map((el) => getComputedStyle(el).backgroundColor),
|
||||
);
|
||||
expect(new Set(dots)).toEqual(new Set(colours.map((c) => c.colour)));
|
||||
await page.keyboard.press("Escape");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user