diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js index eb98753bdac..80e94ef6ed0 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-coupon.spec.js @@ -29,14 +29,20 @@ test.describe( 'Add New Coupon Page', () => { waitUntil: 'networkidle', } ); - await page.fill( '#title', couponCode ); + await page.locator( '#title' ).fill( couponCode ); - await page.fill( '#woocommerce-coupon-description', 'test coupon' ); + // Blur then wait for the auto-save to finish + await page.locator( '#title' ).blur(); + await page.waitForLoadState( 'networkidle' ); - await page.fill( '#coupon_amount', '100' ); + await page + .locator( '#woocommerce-coupon-description' ) + .fill( 'test coupon' ); - await expect( page.locator( '#publish:not(.disabled)' ) ).toBeVisible(); - await page.click( '#publish' ); + await page.locator( '#coupon_amount' ).fill( '100' ); + + await page.locator( '#publish:not(.disabled)' ).click(); + await page.waitForLoadState( 'networkidle' ); await expect( page