diff --git a/tests/e2e/core-tests/specs/merchant/wp-admin-coupon-new.test.js b/tests/e2e/core-tests/specs/merchant/wp-admin-coupon-new.test.js index f220fd1dd7a..cccd3d8aa39 100644 --- a/tests/e2e/core-tests/specs/merchant/wp-admin-coupon-new.test.js +++ b/tests/e2e/core-tests/specs/merchant/wp-admin-coupon-new.test.js @@ -41,13 +41,14 @@ const runCreateCouponTest = () => { await expect(page).toFill('#coupon_amount', '100'); // Publish coupon, verify that it was published. - await AdminEdit.verifyPublish( + const adminEdit = new AdminEdit(); + await adminEdit.verifyPublish( '#publish', '.notice', 'Coupon updated.', ); // Delete the coupon - const couponId = await AdminEdit.getId(); + const couponId = await adminEdit.getId(); if ( couponId ) { const repository = Coupon.restRepository( factories.api.withDefaultPermalinks ); await repository.delete( couponId ); diff --git a/tests/e2e/utils/src/flows/utils.js b/tests/e2e/utils/src/flows/utils.js index c80d18d6588..0670c0504bc 100644 --- a/tests/e2e/utils/src/flows/utils.js +++ b/tests/e2e/utils/src/flows/utils.js @@ -40,4 +40,4 @@ export const itIf = ( condition ) => */ export const waitForTimeout = async ( timeout ) => { await new Promise( ( resolve ) => setTimeout( resolve, timeout ) ); -} +}; diff --git a/tests/e2e/utils/src/page-utils.js b/tests/e2e/utils/src/page-utils.js index b14e0913c97..59ad5cef03a 100644 --- a/tests/e2e/utils/src/page-utils.js +++ b/tests/e2e/utils/src/page-utils.js @@ -123,9 +123,11 @@ export const waitForSelectorWithoutThrow = async ( selector, timeoutInSeconds = */ export const verifyPublishAndTrash = async ( button, publishNotice, publishVerification, trashVerification ) => { if ( button === '.order_actions li .save_order' ) { - await OrderEdit.verifyPublish( button, publishNotice, publishVerification ); + const orderEdit = new OrderEdit(); + await orderEdit.verifyPublish( button, publishNotice, publishVerification ); } else { - await AdminEdit.verifyPublish( button, publishNotice, publishVerification ); + const adminEdit = new AdminEdit(); + await adminEdit.verifyPublish( button, publishNotice, publishVerification ); } // Trash diff --git a/tests/e2e/utils/src/pages/admin-edit.js b/tests/e2e/utils/src/pages/admin-edit.js index d9bea53a13b..4ab03e7674e 100644 --- a/tests/e2e/utils/src/pages/admin-edit.js +++ b/tests/e2e/utils/src/pages/admin-edit.js @@ -1,4 +1,4 @@ -import { utils } from '../flows'; +import { waitForTimeout } from '../flows/utils'; export class AdminEdit { @@ -12,7 +12,7 @@ export class AdminEdit { */ async verifyPublish( button, publishNotice, publishVerification ) { // Wait for auto save - await utils.waitForTimeout( 2000 ); + await waitForTimeout( 2000 ); // Publish and verify await expect( page ).toClick( button ); @@ -42,7 +42,7 @@ export class OrderEdit extends AdminEdit { * @returns {Promise} */ async verifyPublish( button, publishNotice, publishVerification ) { - AdminEdit.verifyPublish( button, publishNotice, publishVerification ); + super.verifyPublish( button, publishNotice, publishVerification ); await expect( page ).toMatchElement( '#select2-order_status-container', { text: 'Processing' } ); await expect( page ).toMatchElement(