WordPress / openverse

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
https://openverse.org
MIT License
240 stars 194 forks source link

Make Playwright scroll wait times more reliable #539

Open obulat opened 2 years ago

obulat commented 2 years ago

Problem

Playwright utilities being added in WordPress/openverse-frontend#1530 at the time of opening of this issue have arbitrary sleep durations to make sure that the images are loaded when the page get scrolled. We need to make them less flaky.

Description

@sarayourfriend's comment has the code suggestion to implement an approach that waits for visibility/load state before continuing. I did not add the code in WordPress/openverse-frontend#1530 because it's not possible to test how well it works without the actual tests to run it. And adding more tests would bloat that PR. Once we have the sample Playwright tests that use scrolling to load all of the page images (such as WordPress/openverse-frontend#1542), we should add the code suggestions to make scroll waits more reliable.

Implementation

szymon-polaczy commented 2 months ago

Hi, I'd like to work on this.

I would only have one question - is the expectation to wait for all images to be loaded or should I also make sure they are loading before waiting? Things like lazyloading - should I add scripts to disable them in the tests?

obulat commented 2 months ago

Hi @szymon-polaczy, We're still in a code freeze for Nuxt, so we would have to wait with this issue.