From faf4658915a9b55428283efa1e19d256baca06c2 Mon Sep 17 00:00:00 2001 From: Eason Su Date: Tue, 12 Nov 2024 15:29:24 +0800 Subject: [PATCH] Fix the issue that E2E test can't log in to wp-admin. --- tests/e2e/global-setup.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/global-setup.js b/tests/e2e/global-setup.js index 1ddcb249..4311fb9e 100644 --- a/tests/e2e/global-setup.js +++ b/tests/e2e/global-setup.js @@ -69,7 +69,7 @@ module.exports = async ( config ) => { await adminPage .locator( 'input[name="pwd"]' ) .fill( admin.password ); - await adminPage.locator( 'text=Log In' ).click(); + await adminPage.getByRole( 'button', { name: 'Log In' } ).click(); await adminPage.waitForLoadState( LOAD_STATE.DOM_CONTENT_LOADED ); await adminPage.goto( `/wp-admin` ); await adminPage.waitForLoadState( LOAD_STATE.DOM_CONTENT_LOADED ); @@ -110,7 +110,9 @@ module.exports = async ( config ) => { await customerPage .locator( 'input[name="pwd"]' ) .fill( customer.password ); - await customerPage.locator( 'text=Log In' ).click(); + await customerPage + .getByRole( 'button', { name: 'Log In' } ) + .click(); await customerPage.goto( `/my-account` ); await expect(