Fix blocks e2e test for `additional-fields.merchant.block_theme.side_effects.spec.ts` (#46258)

* Wait for DOMContentLoaded to ensure that scripts are run when we try click edit shipping details.
This commit is contained in:
Sam Seay 2024-04-06 09:54:46 +08:00 committed by GitHub
parent 11ec7c6255
commit be93d94130
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -297,11 +297,17 @@ test.describe( 'Merchant → Additional Checkout Fields', () => {
.getByLabel( 'Is this a personal purchase or a business purchase?' )
.selectOption( 'personal' );
await admin.page
const clickPromise = admin.page
.getByRole( 'button', { name: 'Update' } )
.first()
.click();
const navigationPromise = admin.page.waitForEvent( 'domcontentloaded' );
// When update is clicked without waiting for DOMContentLoaded the page becomes
// available before click handlers are attached to the shipping edit link.
await Promise.all( [ clickPromise, navigationPromise ] );
await admin.page
.getByRole( 'heading', { name: 'Shipping Edit' } )
.getByRole( 'link' )

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: Fix blocks e2e test for additional-fields.merchant.block_theme.side_effects.spec.ts