Playwright: [Feature] networkidle for "idle after action"

Created on 9 Jun 2020  路  1Comment  路  Source: microsoft/playwright

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

Most helpful comment

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.

>All comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saltyshiomix picture saltyshiomix  路  3Comments

juliomatcom picture juliomatcom  路  3Comments

jperl picture jperl  路  4Comments

VikramTiwari picture VikramTiwari  路  4Comments

kblok picture kblok  路  3Comments