Merge pull request #29737 from woocommerce/e2e/e2e-fix-flaky-checkout-test

Fixed checkout coupons flaky scenario in e2e suite
This commit is contained in:
Ron Rennick 2021-04-26 13:16:44 -03:00 committed by GitHub
commit f46c2fbf0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -236,6 +236,10 @@ export const searchForOrder = async (value, orderId, customerName) => {
*/
export const applyCoupon = async ( couponCode ) => {
try {
await Promise.all([
page.reload(),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
]);
await expect(page).toClick('a', {text: 'Click here to enter your code'});
await uiUnblocked();
await clearAndFillInput('#coupon_code', couponCode);
@ -255,6 +259,10 @@ export const applyCoupon = async ( couponCode ) => {
* @returns {Promise<void>}
*/
export const removeCoupon = async ( couponCode ) => {
await Promise.all([
page.reload(),
page.waitForNavigation( { waitUntil: 'networkidle0' } ),
]);
await expect(page).toClick('[data-coupon="'+couponCode.toLowerCase()+'"]', {text: '[Remove]'});
await uiUnblocked();
await expect(page).toMatchElement('.woocommerce-message', {text: 'Coupon has been removed.'});