mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
test(e2e): measure the lab review rows once the dialog has stopped widening
The review stage widens the sheet and the row grid re-flows from the container width; on a slow runner the 560 px case measured a half-laid-out row and failed on the first attempt. The spec now waits until the surface keeps its width across two frames before it measures.
This commit is contained in:
1 parent
2ea9dc3936
commit
2979b5c4ef
1 file changed
+22
@@ -428,6 +428,28 @@ test.describe("lab-scan review dialog uses the width it is given", () => {
|
||||
await expect(rows).toHaveCount(REVIEW_ROWS.length);
|
||||
|
||||
const label = `scan review @${vp.label}`;
|
||||
// The sheet widens from the picking stage to the review stage and the
|
||||
// row grid re-flows from the container width it is given. Measuring in
|
||||
// the middle of that sees a half-laid-out row, so wait until the
|
||||
// surface has kept the same width across two frames.
|
||||
await expect
|
||||
.poll(
|
||||
async () => {
|
||||
const before = (await surface.boundingBox())!.width;
|
||||
await page.evaluate(
|
||||
() =>
|
||||
new Promise<void>((resolve) =>
|
||||
requestAnimationFrame(() =>
|
||||
requestAnimationFrame(() => resolve()),
|
||||
),
|
||||
),
|
||||
);
|
||||
const after = (await surface.boundingBox())!.width;
|
||||
return Math.abs(after - before);
|
||||
},
|
||||
{ message: `${label}: dialog width settles` },
|
||||
)
|
||||
.toBeLessThan(0.5);
|
||||
await expectNoSidewaysScroll(page, label);
|
||||
await expectControlsInsideBox(page, label);
|
||||
|
||||
|
||||
Reference in new issue
Block a user