Skip to content

Commit

Permalink
Test: Wait for images to be loaded in e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Jun 21, 2024
1 parent dcdd641 commit 418f2f6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/e2e/demo-components-compare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ const runComponentCompareTests = (testConfig) => {
);
// wait for fonts to load
await page.evaluate(() => document.fonts.ready);
// wait for images to load
await page.waitForFunction(() => {
const images = Array.from(document.querySelectorAll('img'));

return images.every((img) => img.complete);
});
// wait for transitions to finish
await page.waitForLoadState();
// disable animations to avoid flaky screenshots
Expand Down

0 comments on commit 418f2f6

Please sign in to comment.