Merge pull request #30583 from woocommerce/fix/e2e-shipping-zone-tests

Added waits for the UI to be unblocked for shipping zone tests
This commit is contained in:
Ron Rennick 2021-08-26 12:50:18 -03:00 committed by GitHub
commit 7058368ad8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 0 deletions

View File

@ -9,6 +9,7 @@ const {
clearAndFillInput,
selectOptionInSelect2,
withRestApi,
uiUnblocked,
} = require( '@woocommerce/e2e-utils' );
/**
@ -76,6 +77,8 @@ const runAddNewShippingZoneTest = () => {
await selectOptionInSelect2('New York');
await expect(page).toClick('button[name="calc_shipping"]');
await uiUnblocked();
// Verify shipping costs
await page.waitForSelector('.order-total');
await expect(page).toMatchElement('.shipping .amount', {text: '$10.00'});
@ -94,6 +97,8 @@ const runAddNewShippingZoneTest = () => {
await clearAndFillInput('#calc_shipping_postcode', '94000');
await expect(page).toClick('button[name="calc_shipping"]');
await uiUnblocked();
// Verify shipping method and cost
await page.waitForSelector('.order-total');
await expect(page).toMatchElement('.shipping ul#shipping_method > li', {text: 'Free shipping'});
@ -108,6 +113,8 @@ const runAddNewShippingZoneTest = () => {
await clearAndFillInput('#calc_shipping_postcode', '94107');
await expect(page).toClick('button[name="calc_shipping"]');
await uiUnblocked();
// Verify shipping method and cost
await page.waitForSelector('.order-total');
await expect(page).toMatchElement('.shipping ul#shipping_method > li', {text: 'Local pickup'});

View File

@ -453,6 +453,8 @@ const addShippingZoneAndMethod = async ( zoneName, zoneLocation = 'country:US',
// Select shipping zone location
await expect(page).toSelect('select[name="zone_locations"]', zoneLocation);
await uiUnblocked();
// Fill shipping zone postcode if needed otherwise just put empty space
await page.waitForSelector('a.wc-shipping-zone-postcodes-toggle');
await expect(page).toClick('a.wc-shipping-zone-postcodes-toggle');
@ -460,6 +462,8 @@ const addShippingZoneAndMethod = async ( zoneName, zoneLocation = 'country:US',
await expect(page).toMatchElement('#zone_postcodes', zipCode);
await expect(page).toClick('button#submit');
await uiUnblocked();
// Add shipping zone method
await page.waitFor(1000);
await expect(page).toClick('button.wc-shipping-zone-add-method', {text:'Add shipping method'});
@ -467,6 +471,8 @@ const addShippingZoneAndMethod = async ( zoneName, zoneLocation = 'country:US',
await expect(page).toSelect('select[name="add_method_id"]', zoneMethod);
await expect(page).toClick('button#btn-ok');
await page.waitForSelector('#zone_locations');
await uiUnblocked();
};
/**