test: wait for contact linework before measuring

The mobile contact linework is loading=lazy and only resolved when scrolled into view. Wait for it to finish loading before the geometry assertions read its bounding rect, matching the pattern already used for the Our Work desktop vector.
This commit is contained in:
Keith Solomon
2026-06-28 13:09:40 -05:00
parent daeb184dd1
commit 739cb6e6e2
+13
View File
@@ -352,6 +352,19 @@ test("mobile contact card matches the 402px reference geometry", async ({
const linework = await getBox(
cardLocator.locator(".contact-block__linework--mobile"),
);
await cardLocator
.locator(".contact-block__linework--mobile")
.evaluate(
(image) =>
/** @type {HTMLImageElement} */ (image).complete ||
new Promise((resolve) => {
/** @type {HTMLImageElement} */ (image).addEventListener(
"load",
() => resolve(undefined),
{ once: true },
);
}),
);
const backgroundImage = cardLocator.locator(".contact-block__bg-image");
const bandHeight = await cardLocator.evaluate((element) =>
Number.parseFloat(getComputedStyle(element).borderBottomWidth),