From 962e5bdb92c6457f8296561f5d8ae989ac3e4f62 Mon Sep 17 00:00:00 2001 From: Milos Petrovic <> Date: Sat, 16 Jan 2021 17:32:51 +0100 Subject: [PATCH] adding test for updating existing products --- sample-data/sample_products2.csv | 27 +++++++++++ .../wp-admin-product-import-products.test.js | 48 ++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 sample-data/sample_products2.csv diff --git a/sample-data/sample_products2.csv b/sample-data/sample_products2.csv new file mode 100644 index 00000000000..a13719ed058 --- /dev/null +++ b/sample-data/sample_products2.csv @@ -0,0 +1,27 @@ +ID,Type,SKU,Name,Published,Is featured?,Visibility in catalog,Short description,Description,Date sale price starts,Date sale price ends,Tax status,Tax class,In stock?,Stock,Low stock amount,Backorders allowed?,Sold individually?,Weight (kg),Length (cm),Width (cm),Height (cm),Allow customer reviews?,Purchase note,Sale price,Regular price,Categories,Tags,Shipping class,Images,Download limit,Download expiry days,Parent,Grouped products,Upsells,Cross-sells,External URL,Button text,Position,Attribute 1 name,Attribute 1 value(s),Attribute 1 visible,Attribute 1 global,Attribute 2 name,Attribute 2 value(s),Attribute 2 visible,Attribute 2 global,Meta: _wpcom_is_markdown,Download 1 name,Download 1 URL,Download 2 name,Download 2 URL +10,simple,,test,1,0,visible,,,,,taxable,,1,,,0,0,,,,,1,,,,Uncategorized,,,,,,,,,,,,0,,,,,,,,,,,,, +12,variable,woo-vneck-tee,V-Neck T-Shirt,1,1,visible,This is a variable product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,,Clothing > Tshirts,,,"https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/vneck-tee-2.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/vnech-tee-green-1.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/vnech-tee-blue-1.jpg",,,,,,,,,0,Color,"Blue, Green, Red",1,1,Size,"Large, Medium, Small",1,1,1,,,, +13,variable,woo-hoodie,Hoodie,1,0,visible,This is a variable product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,,Clothing > Hoodies,,,"https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-2.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-blue-1.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-green-1.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-with-logo-2.jpg",,,,,,,,,0,Color,"Blue, Green, Red",1,1,Logo,"Yes, No",1,0,1,,,, +14,simple,woo-hoodie-with-logo,Hoodie with Logo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,47,Clothing > Hoodies,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-with-logo-2.jpg,,,,,,,,,0,Color,Blue,1,1,,,,,1,,,, +15,simple,woo-tshirt,T-Shirt,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,20,Clothing > Tshirts,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/tshirt-2.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,1,,,, +16,simple,woo-beanie,Beanie,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,18,22,Clothing > Accessories,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/beanie-2.jpg,,,,,,,,,0,Color,Red,1,1,,,,,1,,,, +17,simple,woo-belt,Belt,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,55,67,Clothing > Accessories,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/belt-2.jpg,,,,,,,,,0,,,,,,,,,1,,,, +18,simple,woo-cap,Cap,1,1,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,16,20,Clothing > Accessories,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/cap-2.jpg,,,,,,,,,0,Color,Yellow,1,1,,,,,1,,,, +19,simple,woo-sunglasses,Sunglasses,1,1,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,92,Clothing > Accessories,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/sunglasses-2.jpg,,,,,,,,,0,,,,,,,,,1,,,, +20,simple,woo-hoodie-with-pocket,Hoodie with Pocket,1,1,hidden,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,35,47,Clothing > Hoodies,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-with-pocket-2.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,1,,,, +21,simple,woo-hoodie-with-zipper,Hoodie with Zipper,1,1,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,47,Clothing > Hoodies,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-with-zipper-2.jpg,,,,,,,,,0,,,,,,,,,1,,,, +22,simple,woo-long-sleeve-tee,Long Sleeve Tee,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,27,Clothing > Tshirts,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/long-sleeve-tee-2.jpg,,,,,,,,,0,Color,Green,1,1,,,,,1,,,, +23,simple,woo-polo,Polo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,22,Clothing > Tshirts,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/polo-2.jpg,,,,,,,,,0,Color,Blue,1,1,,,,,1,,,, +24,"simple, downloadable, virtual",woo-album,Album,1,0,visible,"This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,1,,,17,Music,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/album-1.jpg,1,1,,,,,,,0,,,,,,,,,1,Single 1,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg,Single 2,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/album.jpg +25,"simple, downloadable, virtual",woo-single,Single,1,0,visible,"This is a simple, virtual product.","Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,1,,2,5,Music,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/single-1.jpg,1,1,,,,,,,0,,,,,,,,,1,Single,https://demo.woothemes.com/woocommerce/wp-content/uploads/sites/56/2017/08/single.jpg,, +26,variation,woo-vneck-tee-red,V-Neck T-Shirt - Red,1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,0,,,22,,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/vneck-tee-2.jpg,,,woo-vneck-tee,,,,,,0,Color,Red,,1,Size,,,1,,,,, +27,variation,woo-vneck-tee-green,V-Neck T-Shirt - Green,1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,0,,,22,,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/vnech-tee-green-1.jpg,,,woo-vneck-tee,,,,,,0,Color,Green,,1,Size,,,1,,,,, +28,variation,woo-vneck-tee-blue,V-Neck T-Shirt - Blue,1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,0,,,17,,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/vnech-tee-blue-1.jpg,,,woo-vneck-tee,,,,,,0,Color,Blue,,1,Size,,,1,,,,, +29,variation,woo-hoodie-red,"Hoodie - Red, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,0,,42,47,,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-2.jpg,,,woo-hoodie,,,,,,1,Color,Red,,1,Logo,No,,0,,,,, +30,variation,woo-hoodie-green,"Hoodie - Green, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,0,,,47,,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-green-1.jpg,,,woo-hoodie,,,,,,2,Color,Green,,1,Logo,No,,0,,,,, +31,variation,woo-hoodie-blue,"Hoodie - Blue, No",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,0,,,47,,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-blue-1.jpg,,,woo-hoodie,,,,,,3,Color,Blue,,1,Logo,No,,0,,,,, +32,simple,Woo-tshirt-logo,T-Shirt with Logo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,20,Clothing > Tshirts,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/t-shirt-with-logo-1.jpg,,,,,,,,,0,Color,Gray,1,1,,,,,1,,,, +33,simple,Woo-beanie-logo,Beanie with Logo,1,0,visible,This is a simple product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,18,22,Clothing > Accessories,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/beanie-with-logo-1.jpg,,,,,,,,,0,Color,Red,1,1,,,,,1,,,, +34,grouped,logo-collection,Logo Collection,1,0,visible,This is a grouped product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,,Clothing,,,"https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/logo-1.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/beanie-with-logo-1.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/t-shirt-with-logo-1.jpg, https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-with-logo-2.jpg",,,,"woo-hoodie-with-logo, woo-tshirt, woo-beanie",,,,,0,,,,,,,,,1,,,, +35,external,wp-pennant,WordPress Pennant,1,0,visible,This is an external product.,"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",,,taxable,,1,,,0,0,,,,,1,,,13.05,Decor,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/pennant-1.jpg,,,,,,,https://mercantile.wordpress.org/product/wordpress-pennant/,Buy on the WordPress swag store!,0,,,,,,,,,1,,,, +36,variation,woo-hoodie-blue-logo,"Hoodie - Blue, Yes",1,0,visible,,"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum sagittis orci ac odio dictum tincidunt. Donec ut metus leo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed luctus, dui eu sagittis sodales, nulla nibh sagittis augue, vel porttitor diam enim non metus. Vestibulum aliquam augue neque. Phasellus tincidunt odio eget ullamcorper efficitur. Cras placerat ut turpis pellentesque vulputate. Nam sed consequat tortor. Curabitur finibus sapien dolor. Ut eleifend tellus nec erat pulvinar dignissim. Nam non arcu purus. Vivamus et massa massa.",,,taxable,,1,,,0,0,,,,,0,,,47,,,,https://lazy-condor.jurassic.ninja/wp-content/uploads/2021/01/hoodie-with-logo-2.jpg,,,woo-hoodie,,,,,,0,Color,Blue,,1,Logo,Yes,,0,,,,, \ No newline at end of file diff --git a/tests/e2e/core-tests/specs/merchant/wp-admin-product-import-products.test.js b/tests/e2e/core-tests/specs/merchant/wp-admin-product-import-products.test.js index c258e1db2ee..6f3da3d2807 100644 --- a/tests/e2e/core-tests/specs/merchant/wp-admin-product-import-products.test.js +++ b/tests/e2e/core-tests/specs/merchant/wp-admin-product-import-products.test.js @@ -3,7 +3,8 @@ * Internal dependencies */ const { - moveAllItemsToTrash + moveAllItemsToTrash, + setCheckbox } = require( '@woocommerce/e2e-utils' ); /** @@ -55,6 +56,51 @@ const runImportProductsTest = () => { // Compare imported product names await expect(product_names).toEqual(linkTexts.sort()); }); + + + it('Import example file and update existing products', async () => { + + let filePath = path.resolve('../../../sample-data/sample_products.csv'); + + const product_names = ["V-Neck T-Shirt", "Hoodie", "Hoodie with Logo", "T-Shirt", "Beanie", + "Belt", "Cap", "Sunglasses", "Hoodie with Pocket", "Hoodie with Zipper", "Long Sleeve Tee", + "Polo", "Album", "Single", "T-Shirt with Logo", "Beanie with Logo", "Logo Collection", "WordPress Pennant"].sort(); + + const product_prices = [] + + // Click import + await expect(page).toClick('a[href*="product_importer"]'); + + // Upload file + await page.waitForSelector('#upload'); + const input = await page.$('input[type=file]'); + await input.uploadFile(filePath); + + // Check 'Update existing products' checkbox + setCheckbox('#woocommerce-importer-update-existing') + + // Click on Continue + await expect(page).toClick('button[value="Continue"]'); + + // Click on Run the importer + await page.waitForSelector('button[value="Run the importer"]'); + await expect(page).toClick('button[value="Run the importer"]'); + + // Waiting for importer to finish + await page.waitForSelector('section.woocommerce-importer-done', {visible:true, timeout: 60000}); + + // 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'); + + // Getting product names + await page.waitForSelector('td.price.column-price'); + let prices = await page.$$eval('td.price.column-price', elements => elements.map(item => item.text)); + + debugger; + // Compare imported product names + await expect(product_names).toEqual(linkTexts.sort()); + }); }); afterEach(async () => {