Tweak lost password e2e logic (#50666)

This commit is contained in:
Chi-Hsuan Huang 2024-08-14 19:31:18 +08:00 committed by GitHub
parent a512668e96
commit 88e4a6f0e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 7 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Tweak the lost password e2e logic

View File

@ -20,19 +20,19 @@ test.describe( 'Can go to lost password page and submit the form', () => {
await page.getByRole( 'button', { name: 'Get New Password' } ).click(); await page.getByRole( 'button', { name: 'Get New Password' } ).click();
try { try {
await page.waitForURL( '**/wp-login.php?checkemail=confirm' );
await expect(
page.getByText( /Check your email for the confirmation link/i )
).toBeVisible();
} catch ( e ) {
// For local testing, the email might not be sent, so we can ignore this error. // For local testing, the email might not be sent, so we can ignore this error.
// eslint-disable-next-line jest/no-try-expect
await expect( await expect(
page.getByText( page.getByText(
/The email could not be sent. Your site may not be correctly configured to send emails/i /The email could not be sent. Your site may not be correctly configured to send emails/i
) )
).toBeVisible(); ).toBeVisible();
} catch ( e ) {
// eslint-disable-next-line jest/no-try-expect
await page.waitForURL( '**/wp-login.php?checkemail=confirm' );
// eslint-disable-next-line jest/no-try-expect
await expect(
page.getByText( /Check your email for the confirmation link/i )
).toBeVisible();
} }
} ); } );
} ); } );