Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e Tests: waitForNavigation in Comments Query Loop test #39818

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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