instantiate AdminEdit object
This commit is contained in:
parent
d2a94ba5d9
commit
21470315fa
|
@ -41,13 +41,14 @@ const runCreateCouponTest = () => {
|
||||||
await expect(page).toFill('#coupon_amount', '100');
|
await expect(page).toFill('#coupon_amount', '100');
|
||||||
|
|
||||||
// Publish coupon, verify that it was published.
|
// Publish coupon, verify that it was published.
|
||||||
await AdminEdit.verifyPublish(
|
const adminEdit = new AdminEdit();
|
||||||
|
await adminEdit.verifyPublish(
|
||||||
'#publish',
|
'#publish',
|
||||||
'.notice',
|
'.notice',
|
||||||
'Coupon updated.',
|
'Coupon updated.',
|
||||||
);
|
);
|
||||||
// Delete the coupon
|
// Delete the coupon
|
||||||
const couponId = await AdminEdit.getId();
|
const couponId = await adminEdit.getId();
|
||||||
if ( couponId ) {
|
if ( couponId ) {
|
||||||
const repository = Coupon.restRepository( factories.api.withDefaultPermalinks );
|
const repository = Coupon.restRepository( factories.api.withDefaultPermalinks );
|
||||||
await repository.delete( couponId );
|
await repository.delete( couponId );
|
||||||
|
|
|
@ -40,4 +40,4 @@ export const itIf = ( condition ) =>
|
||||||
*/
|
*/
|
||||||
export const waitForTimeout = async ( timeout ) => {
|
export const waitForTimeout = async ( timeout ) => {
|
||||||
await new Promise( ( resolve ) => setTimeout( resolve, timeout ) );
|
await new Promise( ( resolve ) => setTimeout( resolve, timeout ) );
|
||||||
}
|
};
|
||||||
|
|
|
@ -123,9 +123,11 @@ export const waitForSelectorWithoutThrow = async ( selector, timeoutInSeconds =
|
||||||
*/
|
*/
|
||||||
export const verifyPublishAndTrash = async ( button, publishNotice, publishVerification, trashVerification ) => {
|
export const verifyPublishAndTrash = async ( button, publishNotice, publishVerification, trashVerification ) => {
|
||||||
if ( button === '.order_actions li .save_order' ) {
|
if ( button === '.order_actions li .save_order' ) {
|
||||||
await OrderEdit.verifyPublish( button, publishNotice, publishVerification );
|
const orderEdit = new OrderEdit();
|
||||||
|
await orderEdit.verifyPublish( button, publishNotice, publishVerification );
|
||||||
} else {
|
} else {
|
||||||
await AdminEdit.verifyPublish( button, publishNotice, publishVerification );
|
const adminEdit = new AdminEdit();
|
||||||
|
await adminEdit.verifyPublish( button, publishNotice, publishVerification );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trash
|
// Trash
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { utils } from '../flows';
|
import { waitForTimeout } from '../flows/utils';
|
||||||
|
|
||||||
|
|
||||||
export class AdminEdit {
|
export class AdminEdit {
|
||||||
|
@ -12,7 +12,7 @@ export class AdminEdit {
|
||||||
*/
|
*/
|
||||||
async verifyPublish( button, publishNotice, publishVerification ) {
|
async verifyPublish( button, publishNotice, publishVerification ) {
|
||||||
// Wait for auto save
|
// Wait for auto save
|
||||||
await utils.waitForTimeout( 2000 );
|
await waitForTimeout( 2000 );
|
||||||
|
|
||||||
// Publish and verify
|
// Publish and verify
|
||||||
await expect( page ).toClick( button );
|
await expect( page ).toClick( button );
|
||||||
|
@ -42,7 +42,7 @@ export class OrderEdit extends AdminEdit {
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async verifyPublish( button, publishNotice, publishVerification ) {
|
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( '#select2-order_status-container', { text: 'Processing' } );
|
||||||
await expect( page ).toMatchElement(
|
await expect( page ).toMatchElement(
|
||||||
|
|
Loading…
Reference in New Issue