Update test

This commit is contained in:
Veljko 2021-03-13 20:49:45 +01:00
parent dfc38562ce
commit 6d24f4dc22
1 changed files with 3 additions and 10 deletions

View File

@ -10,6 +10,7 @@ const {
addShippingZoneAndMethod, addShippingZoneAndMethod,
clearAndFillInput, clearAndFillInput,
selectOptionInSelect2, selectOptionInSelect2,
evalAndClick,
} = require( '@woocommerce/e2e-utils' ); } = require( '@woocommerce/e2e-utils' );
const config = require( 'config' ); const config = require( 'config' );
@ -27,21 +28,13 @@ const runAddNewShippingZoneTest = () => {
await createSimpleProduct(); await createSimpleProduct();
await merchant.openSettings('shipping'); await merchant.openSettings('shipping');
// Check if you can go via blank shipping zones, otherwise remove first two zones // Check if you can go via blank shipping zones, otherwise remove one existing zone
// This is a workaround to avoid flakyness and to give this test more confidence // This is a workaround to avoid flakyness and to give this test more confidence
try { try {
await page.click('.wc-shipping-zones-blank-state > a.wc-shipping-zone-add'); await page.click('.wc-shipping-zones-blank-state > a.wc-shipping-zone-add');
} catch (error) { } catch (error) {
await page.evaluate(() => { await evalAndClick('.wc-shipping-zone-delete');
document.querySelector('.wc-shipping-zone-delete').click();
});
await page.waitFor(1000);
await page.keyboard.press('Enter');
await page.evaluate(() => {
document.querySelector('.wc-shipping-zone-delete').click();
});
await page.waitFor(1000);
await page.keyboard.press('Enter'); await page.keyboard.press('Enter');
} }
}); });