-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test] Wait for images to load #11004
[test] Wait for images to load #11004
Conversation
Deploy preview: https://deploy-preview-11004--material-ui-x.netlify.app/ |
@@ -101,12 +101,6 @@ async function main() { | |||
// Move cursor offscreen to not trigger unwanted hover effects. | |||
page.mouse.move(0, 0); | |||
|
|||
// Wait for the flags to load | |||
await page.waitForFunction(() => { | |||
const images = Array.from(document.querySelectorAll('img')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't work, because sometimes the images were not rendered yet - so I moved it after the '[data-testid="testcase"]:not([aria-busy="true"])'
assertion
() => { | ||
const images = Array.from(document.querySelectorAll('img')); | ||
return images.every((img) => { | ||
if (!img.complete && img.loading === 'lazy') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For lazy-loaded images that are not visible img.complete
will always be false
}); | ||
}, | ||
undefined, | ||
{ timeout: 1000 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To fail fast
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Nice fix! 💪🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, finally this nasty issue arising since eternity is gone 🎉
Fixes false-positives like https://app.argos-ci.com/mui/mui-x/builds/15042/64442787