Fix problem in headless by adding uiUnblocked
This commit is contained in:
parent
f4be2afa2a
commit
121099afe7
|
@ -6,7 +6,8 @@ const {
|
||||||
shopper,
|
shopper,
|
||||||
merchant,
|
merchant,
|
||||||
createCoupon,
|
createCoupon,
|
||||||
createSimpleProduct
|
createSimpleProduct,
|
||||||
|
uiUnblocked
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,6 +39,7 @@ const runCartApplyCouponsTest = () => {
|
||||||
// Apply Fixed cart discount coupon
|
// Apply Fixed cart discount coupon
|
||||||
await expect(page).toFill('#coupon_code', 'Code-Fixed cart discount');
|
await expect(page).toFill('#coupon_code', 'Code-Fixed cart discount');
|
||||||
await expect(page).toClick('button', {text: 'Apply coupon'});
|
await expect(page).toClick('button', {text: 'Apply coupon'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
||||||
|
|
||||||
// Wait for page to expand total calculations to avoid flakyness
|
// Wait for page to expand total calculations to avoid flakyness
|
||||||
|
@ -49,22 +51,26 @@ const runCartApplyCouponsTest = () => {
|
||||||
|
|
||||||
// Remove coupon
|
// Remove coupon
|
||||||
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
||||||
|
|
||||||
// Apply Percentage discount coupon
|
// Apply Percentage discount coupon
|
||||||
await expect(page).toFill('#coupon_code', 'Code-Percentage discount');
|
await expect(page).toFill('#coupon_code', 'Code-Percentage discount');
|
||||||
await expect(page).toClick('button', {text: 'Apply coupon'});
|
await expect(page).toClick('button', {text: 'Apply coupon'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
||||||
await page.waitForSelector('.cart-discount .amount', {text: '$4.99'});
|
await page.waitForSelector('.cart-discount .amount', {text: '$4.99'});
|
||||||
await page.waitForSelector('.order-total .amount', {text: '$5.00'});
|
await page.waitForSelector('.order-total .amount', {text: '$5.00'});
|
||||||
|
|
||||||
// Remove coupon
|
// Remove coupon
|
||||||
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
||||||
|
|
||||||
// Apply Fixed product discount coupon
|
// Apply Fixed product discount coupon
|
||||||
await expect(page).toFill('#coupon_code', 'Code-Fixed product discount');
|
await expect(page).toFill('#coupon_code', 'Code-Fixed product discount');
|
||||||
await expect(page).toClick('button', {text: 'Apply coupon'});
|
await expect(page).toClick('button', {text: 'Apply coupon'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
||||||
await page.waitForSelector('.cart-discount .amount', {text: '$5.00'});
|
await page.waitForSelector('.cart-discount .amount', {text: '$5.00'});
|
||||||
await page.waitForSelector('.order-total .amount', {text: '$4.99'});
|
await page.waitForSelector('.order-total .amount', {text: '$4.99'});
|
||||||
|
@ -72,18 +78,22 @@ const runCartApplyCouponsTest = () => {
|
||||||
// Try to apply the same coupon
|
// Try to apply the same coupon
|
||||||
await expect(page).toFill('#coupon_code', 'Code-Fixed product discount');
|
await expect(page).toFill('#coupon_code', 'Code-Fixed product discount');
|
||||||
await expect(page).toClick('button', {text: 'Apply coupon'});
|
await expect(page).toClick('button', {text: 'Apply coupon'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-error', { text: 'Coupon code already applied!' });
|
await page.waitForSelector('.woocommerce-error', { text: 'Coupon code already applied!' });
|
||||||
|
|
||||||
// Try to apply multiple coupons
|
// Try to apply multiple coupons
|
||||||
await expect(page).toFill('#coupon_code', 'Code-Fixed cart discount');
|
await expect(page).toFill('#coupon_code', 'Code-Fixed cart discount');
|
||||||
await expect(page).toClick('button', {text: 'Apply coupon'});
|
await expect(page).toClick('button', {text: 'Apply coupon'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon code applied successfully.'});
|
||||||
await page.waitForSelector('.order-total .amount', {text: '$0.00'});
|
await page.waitForSelector('.order-total .amount', {text: '$0.00'});
|
||||||
|
|
||||||
// Remove coupon
|
// Remove coupon
|
||||||
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
||||||
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
await expect(page).toClick('.woocommerce-remove-coupon', {text: '[Remove]'});
|
||||||
|
await uiUnblocked();
|
||||||
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
await page.waitForSelector('.woocommerce-message', {text: 'Coupon has been removed.'});
|
||||||
|
|
||||||
// Verify the total amount after all coupons removal
|
// Verify the total amount after all coupons removal
|
||||||
|
|
Loading…
Reference in New Issue