From d6b4da35a8acc5df50290333658aa46ccbc7db16 Mon Sep 17 00:00:00 2001 From: Taylor Jones Date: Mon, 13 Jan 2025 14:38:49 -0600 Subject: [PATCH 1/2] fix(percy): wait for fonts before snapshotting --- e2e/test-utils/storybook.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/e2e/test-utils/storybook.js b/e2e/test-utils/storybook.js index 5f57dd92c39d..b27d7ccd9775 100644 --- a/e2e/test-utils/storybook.js +++ b/e2e/test-utils/storybook.js @@ -36,6 +36,9 @@ async function visitStory(page, options) { await page.goto(url); await expect(page).toContainAStory(options); + + // Ensure Plex assets are fully available for accurate VRT + await page.waitForFunction(() => document.fonts.ready); } function getStoryUrl({ component, story, id }) { From 7c893d3388025292515d0c6217e7330f8729d21b Mon Sep 17 00:00:00 2001 From: Taylor Jones Date: Mon, 13 Jan 2025 14:42:14 -0600 Subject: [PATCH 2/2] chore: update to page.evaluate --- e2e/test-utils/storybook.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/e2e/test-utils/storybook.js b/e2e/test-utils/storybook.js index b27d7ccd9775..801fd0894c5b 100644 --- a/e2e/test-utils/storybook.js +++ b/e2e/test-utils/storybook.js @@ -38,7 +38,9 @@ async function visitStory(page, options) { await expect(page).toContainAStory(options); // Ensure Plex assets are fully available for accurate VRT - await page.waitForFunction(() => document.fonts.ready); + await page.evaluate(async () => { + await document.fonts.ready; + }); } function getStoryUrl({ component, story, id }) {