implement `page.waitForNavigation` for handling the page load after clicking the search submit (https://github.com/woocommerce/woocommerce-blocks/pull/2769)

This commit is contained in:
Darren Ethier 2020-06-23 10:38:48 -04:00 committed by GitHub
parent 1953d4f96a
commit 19ab667672
1 changed files with 2 additions and 1 deletions

View File

@ -47,7 +47,8 @@ export async function visitBlockPage( title ) {
if ( await page.$( '#post-search-input' ) ) {
// search for the page.
await page.type( '#post-search-input', title );
await page.click( '#search-submit', { waitUntil: 'domcontentloaded' } );
await page.click( '#search-submit' );
await page.waitForNavigation( { waitUntil: 'domcontentloaded' } );
const pageLink = await page.$x( `//a[contains(text(), '${ title }')]` );
if ( pageLink.length > 0 ) {
// clicking the link directly caused racing issues, so I used goto.