Skip to content

Commit 0b05b54

Browse files
committed
Build/Test Tools: Await post title assertions in E2E tests.
Await the title assertions after publishing and quick editing a post so each test waits for its assertion result before completing. Use one-time dialog handlers for application password revocation confirmations. Developed in: WordPress#13425 Props adrianmoldovanwp, lucatume. Fixes #66068. git-svn-id: https://develop.svn.wordpress.org/trunk@63537 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 7ff053b commit 0b05b54

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎tests/e2e/specs/edit-posts.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test.describe( 'Edit Posts', () => {
3636
await expect( posts ).toHaveCount( 1 );
3737

3838
// Expect the title of the post to be correct.
39-
expect( posts.first() ).toHaveText( title );
39+
await expect( posts.first() ).toHaveText( title );
4040
} );
4141

4242
test( 'allows an existing post to be edited using the Edit button', async ( {
@@ -104,7 +104,7 @@ test.describe( 'Edit Posts', () => {
104104
await expect( posts ).toHaveCount( 1 );
105105

106106
// Expect the title of the post to be correct.
107-
expect( posts.first() ).toHaveText( `${ title } Edited` );
107+
await expect( posts.first() ).toHaveText( `${ title } Edited` );
108108
} );
109109

110110
test( 'allows an existing post to be deleted using the Trash button', async ( {

‎tests/e2e/specs/profile/applications-passwords.test.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ test.describe( 'Manage applications passwords', () => {
5050
await expect( revokeButton ).toBeVisible();
5151

5252
// Revoke password.
53-
page.on( 'dialog', ( dialog ) => dialog.accept() );
53+
page.once( 'dialog', ( dialog ) => dialog.accept() );
5454
await revokeButton.click();
5555

5656
await expect(
@@ -73,7 +73,7 @@ test.describe( 'Manage applications passwords', () => {
7373
await expect( revokeAllButton ).toBeVisible();
7474

7575
// Confirms revoking action.
76-
page.on( 'dialog', ( dialog ) => dialog.accept() );
76+
page.once( 'dialog', ( dialog ) => dialog.accept() );
7777
await revokeAllButton.click();
7878

7979
await expect(

0 commit comments

Comments
 (0)