Skip to content

Commit

Permalink
e2e Tests: waitForNavigation in Comments Query Loop test (#39818)
Browse files Browse the repository at this point in the history
  • Loading branch information
ockham authored Mar 29, 2022
1 parent c653bae commit 3756bed
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions packages/e2e-tests/specs/experiments/blocks/comments-query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,39 @@ describe( 'Comment Query Loop', () => {
`This is an automated comment - ${ i }`
);
await pressKeyTimes( 'Tab', 1 );
await page.keyboard.press( 'Enter' );
await page.waitForNavigation();
await Promise.all( [
page.keyboard.press( 'Enter' ),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
] );
}

// We check that there is a previous comments page link.
await page.waitForSelector( '.wp-block-comments-pagination-previous' );
expect(
await page.$( '.wp-block-comments-pagination-previous' )
).not.toBeNull();
expect(
await page.$( '.wp-block-comments-pagination-next' )
).toBeNull();

await page.click( '.wp-block-comments-pagination-previous' );
await Promise.all( [
page.click( '.wp-block-comments-pagination-previous' ),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
] );

// We check that there are a previous and a next link.
await page.waitForSelector( '.wp-block-comments-pagination-previous' );
await page.waitForSelector( '.wp-block-comments-pagination-next' );
expect(
await page.$( '.wp-block-comments-pagination-previous' )
).not.toBeNull();
expect(
await page.$( '.wp-block-comments-pagination-next' )
).not.toBeNull();
await page.click( '.wp-block-comments-pagination-previous' );

await Promise.all( [
page.click( '.wp-block-comments-pagination-previous' ),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
] );

// We check that there is only have a next link
await page.waitForSelector( '.wp-block-comments-pagination-next' );
expect(
await page.$( '.wp-block-comments-pagination-previous' )
).toBeNull();
Expand Down

0 comments on commit 3756bed

Please sign in to comment.