microsoft/playwright

[Feature] networkidle for "idle after action"

arjunattam opened this issue · 1 comments

Context:

  • Playwright Version: 1.0.2
  • Operating System: Ubuntu (GitHub Actions)
  • Browser: Tried Chromium and WebKit

Code Snippet

await page.goto('https://brewredis-spring-storefront.azuremicroservices.io/');
await page.fill('[placeholder=Search]', 'ipa');
page.on('response', (response) => {console.log('response event', response.url())});
await Promise.all([
  page.keyboard.press('Enter'),
  page.waitForSelector('mat-card-title')
]);
await page.waitForLoadState('networkidle');
console.log('networkidle');
await page.screenshot({ path: '__tests__/artifacts/search.png' });

On the page,

  • I search for a string "ipa"
  • Pressing enter loads the search results (shown as result cards on the UI)
  • Each result has a corresponding image

I was expecting the page.waitForLoadState to wait for the network calls that fetch images. But I'm seeing cases (only on CI) where this is not happening.

The end screenshot looks like the following, without the images being loaded.

search

We do not currently plan to enhance networkidle support, because it's quite flaky - any analytics script can mess it up.

However, here is a gist that does "wait for network settled after action", just in case it is still useful.