Fix flaky e2e test and update login util (#48446)

This commit is contained in:
Veljko V 2024-06-12 22:35:36 +02:00 committed by GitHub
parent 8a69728312
commit 08e44d0c4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
E2E tests: fixing flaky merchant user create and logging

View File

@ -80,7 +80,11 @@ for ( const userData of users ) {
await test.step( 'verify the new user can login', async () => {
await page.context().clearCookies();
await page.goto( '/wp-admin' );
await page.goto( '/wp-login.php' );
await expect(
page.getByLabel( 'Username or Email Address' )
).toBeVisible();
await logIn( page, userData.username, user.password, false );
const expectedTitle =

View File

@ -1,8 +1,12 @@
const { expect } = require( '../fixtures/fixtures' );
const logIn = async ( page, username, password, assertSuccess = true ) => {
await page.getByLabel( 'Username or Email Address' ).click();
await page
.getByLabel( 'Username or Email Address' )
.click( { delay: 100 } );
await page.getByLabel( 'Username or Email Address' ).fill( username );
await page.getByRole( 'textbox', { name: 'Password' } ).click();
await page
.getByRole( 'textbox', { name: 'Password' } )
.click( { delay: 100 } );
await page.getByRole( 'textbox', { name: 'Password' } ).fill( password );
await page.getByRole( 'button', { name: 'Log In' } ).click();