test: wait for Our Work desktop vector before reading source
This commit is contained in:
@@ -651,6 +651,19 @@ test("Our Work restores its tablet layout at 768px", async ({ page }) => {
|
|||||||
await expect(inner).toHaveCSS("padding-left", "38.4px");
|
await expect(inner).toHaveCSS("padding-left", "38.4px");
|
||||||
await expect(vector).toHaveCSS("width", "768px");
|
await expect(vector).toHaveCSS("width", "768px");
|
||||||
await expect(block.locator(".our-work__vector-mobile")).toBeHidden();
|
await expect(block.locator(".our-work__vector-mobile")).toBeHidden();
|
||||||
|
// Force lazy-loaded image to start fetching before reading its source.
|
||||||
|
await expect(vector).toBeVisible();
|
||||||
|
await vector.evaluate(
|
||||||
|
(image) =>
|
||||||
|
/** @type {HTMLImageElement} */ (image).complete ||
|
||||||
|
new Promise((resolve) => {
|
||||||
|
/** @type {HTMLImageElement} */ (image).addEventListener(
|
||||||
|
"load",
|
||||||
|
() => resolve(undefined),
|
||||||
|
{ once: true },
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
expect(
|
expect(
|
||||||
await vector.evaluate(
|
await vector.evaluate(
|
||||||
(image) => /** @type {HTMLImageElement} */ (image).currentSrc,
|
(image) => /** @type {HTMLImageElement} */ (image).currentSrc,
|
||||||
|
|||||||
Reference in New Issue
Block a user