Add first test import products

This commit is contained in:
Veljko 2021-03-18 13:42:59 +01:00
parent f73fdfa4f6
commit 4f98833094
1 changed files with 13 additions and 13 deletions

View File

@ -31,14 +31,12 @@ const runImportProductsTest = () => {
it('can upload the CSV file and import products', async () => {
// Verify error message if you go withot provided CSV file
await expect(page).toClick('button[value="Continue"]');
await page.waitForSelector('div.error inline');
await expect(page).toMatchElement('div.error inline > p', errorMessage);
await page.waitForSelector('div.error');
await expect(page).toMatchElement('div.error > p', errorMessage);
// Put the CSV products file and proceed further
const uploader = await page.$("input[type=file]");
await uploader.uploadFile(filePath);
await setCheckbox('#woocommerce-importer-update-existing');
await page.waitFor(2000);
await expect(page).toClick('button[value="Continue"]');
// Click on Run the importer
@ -47,10 +45,12 @@ const runImportProductsTest = () => {
// Waiting for importer to finish
await page.waitForSelector('section.woocommerce-importer-done', {visible:true, timeout: 60000});
await page.waitForSelector('.woocommerce-importer-done');
await expect(page).toMatchElement('.woocommerce-importer-done', {text: 'Import complete!'});
// Click on view products
await page.waitForSelector('div.wc-actions a.button.button-primary');
await expect(page).toClick('div.wc-actions a.button.button-primary');
await page.waitForSelector('div.wc-actions > a.button.button-primary');
await expect(page).toClick('div.wc-actions > a.button.button-primary');
// Getting product names
await page.waitForSelector('a.row-title');