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:
commit
7058368ad8
|
@ -9,6 +9,7 @@ const {
|
||||||
clearAndFillInput,
|
clearAndFillInput,
|
||||||
selectOptionInSelect2,
|
selectOptionInSelect2,
|
||||||
withRestApi,
|
withRestApi,
|
||||||
|
uiUnblocked,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,6 +77,8 @@ const runAddNewShippingZoneTest = () => {
|
||||||
await selectOptionInSelect2('New York');
|
await selectOptionInSelect2('New York');
|
||||||
await expect(page).toClick('button[name="calc_shipping"]');
|
await expect(page).toClick('button[name="calc_shipping"]');
|
||||||
|
|
||||||
|
await uiUnblocked();
|
||||||
|
|
||||||
// Verify shipping costs
|
// Verify shipping costs
|
||||||
await page.waitForSelector('.order-total');
|
await page.waitForSelector('.order-total');
|
||||||
await expect(page).toMatchElement('.shipping .amount', {text: '$10.00'});
|
await expect(page).toMatchElement('.shipping .amount', {text: '$10.00'});
|
||||||
|
@ -94,6 +97,8 @@ const runAddNewShippingZoneTest = () => {
|
||||||
await clearAndFillInput('#calc_shipping_postcode', '94000');
|
await clearAndFillInput('#calc_shipping_postcode', '94000');
|
||||||
await expect(page).toClick('button[name="calc_shipping"]');
|
await expect(page).toClick('button[name="calc_shipping"]');
|
||||||
|
|
||||||
|
await uiUnblocked();
|
||||||
|
|
||||||
// Verify shipping method and cost
|
// Verify shipping method and cost
|
||||||
await page.waitForSelector('.order-total');
|
await page.waitForSelector('.order-total');
|
||||||
await expect(page).toMatchElement('.shipping ul#shipping_method > li', {text: 'Free shipping'});
|
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 clearAndFillInput('#calc_shipping_postcode', '94107');
|
||||||
await expect(page).toClick('button[name="calc_shipping"]');
|
await expect(page).toClick('button[name="calc_shipping"]');
|
||||||
|
|
||||||
|
await uiUnblocked();
|
||||||
|
|
||||||
// Verify shipping method and cost
|
// Verify shipping method and cost
|
||||||
await page.waitForSelector('.order-total');
|
await page.waitForSelector('.order-total');
|
||||||
await expect(page).toMatchElement('.shipping ul#shipping_method > li', {text: 'Local pickup'});
|
await expect(page).toMatchElement('.shipping ul#shipping_method > li', {text: 'Local pickup'});
|
||||||
|
|
|
@ -453,6 +453,8 @@ const addShippingZoneAndMethod = async ( zoneName, zoneLocation = 'country:US',
|
||||||
// Select shipping zone location
|
// Select shipping zone location
|
||||||
await expect(page).toSelect('select[name="zone_locations"]', zoneLocation);
|
await expect(page).toSelect('select[name="zone_locations"]', zoneLocation);
|
||||||
|
|
||||||
|
await uiUnblocked();
|
||||||
|
|
||||||
// Fill shipping zone postcode if needed otherwise just put empty space
|
// Fill shipping zone postcode if needed otherwise just put empty space
|
||||||
await page.waitForSelector('a.wc-shipping-zone-postcodes-toggle');
|
await page.waitForSelector('a.wc-shipping-zone-postcodes-toggle');
|
||||||
await expect(page).toClick('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).toMatchElement('#zone_postcodes', zipCode);
|
||||||
await expect(page).toClick('button#submit');
|
await expect(page).toClick('button#submit');
|
||||||
|
|
||||||
|
await uiUnblocked();
|
||||||
|
|
||||||
// Add shipping zone method
|
// Add shipping zone method
|
||||||
await page.waitFor(1000);
|
await page.waitFor(1000);
|
||||||
await expect(page).toClick('button.wc-shipping-zone-add-method', {text:'Add shipping method'});
|
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).toSelect('select[name="add_method_id"]', zoneMethod);
|
||||||
await expect(page).toClick('button#btn-ok');
|
await expect(page).toClick('button#btn-ok');
|
||||||
await page.waitForSelector('#zone_locations');
|
await page.waitForSelector('#zone_locations');
|
||||||
|
|
||||||
|
await uiUnblocked();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue