Replace deprecated page methods.

Blur and wait for autosave.
Add a few explicit waits.
This commit is contained in:
rodelgc 2023-05-17 15:19:18 +08:00
parent 3be1f45f2e
commit fd5bc2a420
1 changed files with 11 additions and 5 deletions

View File

@ -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