diff --git a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/additional-fields.merchant.block_theme.side_effects.spec.ts b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/additional-fields.merchant.block_theme.side_effects.spec.ts index 038565a0ee7..2a3ce45c495 100644 --- a/plugins/woocommerce-blocks/tests/e2e/tests/checkout/additional-fields.merchant.block_theme.side_effects.spec.ts +++ b/plugins/woocommerce-blocks/tests/e2e/tests/checkout/additional-fields.merchant.block_theme.side_effects.spec.ts @@ -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' ) diff --git a/plugins/woocommerce/changelog/46258-dev-fix-e2e-additional-fields b/plugins/woocommerce/changelog/46258-dev-fix-e2e-additional-fields new file mode 100644 index 00000000000..708fa8ebafe --- /dev/null +++ b/plugins/woocommerce/changelog/46258-dev-fix-e2e-additional-fields @@ -0,0 +1,4 @@ +Significance: patch +Type: dev +Comment: Fix blocks e2e test for additional-fields.merchant.block_theme.side_effects.spec.ts +