diff --git a/plugins/woocommerce/changelog/tests-52957 b/plugins/woocommerce/changelog/tests-52957 new file mode 100644 index 0000000000000..2f56587ae63f2 --- /dev/null +++ b/plugins/woocommerce/changelog/tests-52957 @@ -0,0 +1,4 @@ +Significance: minor +Type: dev + +Update existing tests with the Playwright utils from the @woocommerce/e2e-utils-playwright package diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/command-palette.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/command-palette.spec.js index bf5502915ff31..6a7b6e7f87d47 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/command-palette.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/command-palette.spec.js @@ -1,5 +1,9 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); -const { disableWelcomeModal } = require( '../../utils/editor' ); + +/** + * External dependencies + */ +import { disableWelcomeModal } from '@woocommerce/e2e-utils-playwright'; // need to figure out whether tests are being run on a mac const macOS = process.platform === 'darwin'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js index 6e4365b84eff7..9496189746388 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-cart-block.spec.js @@ -1,14 +1,20 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); const { - goToPageEditor, fillPageTitle, - insertBlock, transformIntoBlocks, publishPage, - closeChoosePatternModal, } = require( '../../utils/editor' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); +/** + * External dependencies + */ +import { + closeChoosePatternModal, + goToPageEditor, + insertBlock, +} from '@woocommerce/e2e-utils-playwright'; + const test = baseTest.extend( { storageState: process.env.ADMINSTATE, testPageTitlePrefix: 'Transformed cart', diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js index 7279c31fbea20..c68b711dd073b 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-checkout-block.spec.js @@ -1,16 +1,22 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); const { - goToPageEditor, - getCanvas, fillPageTitle, - insertBlock, transformIntoBlocks, publishPage, - openEditorSettings, - closeChoosePatternModal, } = require( '../../utils/editor' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); +/** + * External dependencies + */ +import { + closeChoosePatternModal, + openEditorSettings, + getCanvas, + insertBlock, + goToPageEditor, +} from '@woocommerce/e2e-utils-playwright'; + const simpleProductName = 'Very Simple Product'; const singleProductPrice = '999.00'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-page.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-page.spec.js index ac3ae015b2ac0..f2c6fc9cec05a 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-page.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-page.spec.js @@ -1,11 +1,14 @@ const { test: baseTest } = require( '../../fixtures/fixtures' ); -const { - goToPageEditor, - fillPageTitle, - getCanvas, - publishPage, +const { fillPageTitle, publishPage } = require( '../../utils/editor' ); + +/** + * External dependencies + */ +import { closeChoosePatternModal, -} = require( '../../utils/editor' ); + getCanvas, + goToPageEditor, +} from '@woocommerce/e2e-utils-playwright'; const test = baseTest.extend( { storageState: process.env.ADMINSTATE, diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-post.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-post.spec.js index 19a7d337f8674..7db2c6eab01f9 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-post.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-post.spec.js @@ -2,10 +2,14 @@ const { test: baseTest } = require( '../../fixtures/fixtures' ); const { goToPostEditor, fillPageTitle, - getCanvas, publishPage, } = require( '../../utils/editor' ); +/** + * External dependencies + */ +import { getCanvas } from '@woocommerce/e2e-utils-playwright'; + const test = baseTest.extend( { storageState: process.env.ADMINSTATE, } ); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-blocks.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-blocks.spec.js index fd290338d2dcf..a1f12f0efa5a2 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-blocks.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-blocks.spec.js @@ -1,13 +1,16 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); -const { +const { fillPageTitle, publishPage } = require( '../../utils/editor' ); +const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); + +/** + * External dependencies + */ +import { + closeChoosePatternModal, + getCanvas, goToPageEditor, - fillPageTitle, insertBlock, - getCanvas, - publishPage, - closeChoosePatternModal, -} = require( '../../utils/editor' ); -const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); +} from '@woocommerce/e2e-utils-playwright'; const simpleProductName = 'Simplest Product'; const singleProductPrice = '555.00'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-patterns.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-patterns.spec.js index 671788097b429..c0ea36a77744e 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-patterns.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/merchant/create-woocommerce-patterns.spec.js @@ -1,13 +1,16 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); -const { +const { fillPageTitle, publishPage } = require( '../../utils/editor' ); +const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); + +/** + * External dependencies + */ +import { + closeChoosePatternModal, + getCanvas, goToPageEditor, - fillPageTitle, insertBlock, - getCanvas, - publishPage, - closeChoosePatternModal, -} = require( '../../utils/editor' ); -const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); +} from '@woocommerce/e2e-utils-playwright'; // some WooCommerce Patterns to use const wooPatterns = [ diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/add-to-cart.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/add-to-cart.spec.js index 3ac5dfeb6eaf5..159657428f10e 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/add-to-cart.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/add-to-cart.spec.js @@ -1,6 +1,10 @@ const { test, expect } = require( '@playwright/test' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; -const { addAProductToCart } = require( '../../utils/cart' ); + +/** + * External dependencies + */ +import { addAProductToCart } from '@woocommerce/e2e-utils-playwright'; const productName = `Cart product test ${ Date.now() }`; const productPrice = '13.99'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js index 6cbac02dd9111..d8be4d092114a 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-calculate-shipping.spec.js @@ -1,11 +1,15 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); -const { - goToPageEditor, - fillPageTitle, +const { fillPageTitle } = require( '../../utils/editor' ); + +/** + * External dependencies + */ +import { + addAProductToCart, insertBlockByShortcut, + goToPageEditor, publishPage, -} = require( '../../utils/editor' ); -const { addAProductToCart } = require( '../../utils/cart' ); +} from '@woocommerce/e2e-utils-playwright'; const firstProductName = 'First Product'; const firstProductPrice = '10.00'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-coupons.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-coupons.spec.js index a1975e84a8b6a..2fe49abf8be1f 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-coupons.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block-coupons.spec.js @@ -1,11 +1,15 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); -const { - goToPageEditor, - fillPageTitle, +const { fillPageTitle } = require( '../../utils/editor' ); + +/** + * External dependencies + */ +import { + addAProductToCart, insertBlockByShortcut, + goToPageEditor, publishPage, -} = require( '../../utils/editor' ); -const { addAProductToCart } = require( '../../utils/cart' ); +} from '@woocommerce/e2e-utils-playwright'; const simpleProductName = 'Cart Coupons Product'; const singleProductFullPrice = '110.00'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block.spec.js index 5d49eb8464c9f..e590ff02d8f69 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-block.spec.js @@ -1,11 +1,15 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); -const { - goToPageEditor, - fillPageTitle, +const { fillPageTitle } = require( '../../utils/editor' ); + +/** + * External dependencies + */ +import { + addAProductToCart, insertBlockByShortcut, + goToPageEditor, publishPage, -} = require( '../../utils/editor' ); -const { addAProductToCart } = require( '../../utils/cart' ); +} from '@woocommerce/e2e-utils-playwright'; const simpleProductName = 'Single Simple Product'; const simpleProductDesc = 'Lorem ipsum dolor sit amet.'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-calculate-shipping.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-calculate-shipping.spec.js index 856e3333ec766..8266c004b7dd2 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-calculate-shipping.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-calculate-shipping.spec.js @@ -1,4 +1,7 @@ -const { addAProductToCart } = require( '../../utils/cart' ); +/** + * External dependencies + */ +import { addAProductToCart } from '@woocommerce/e2e-utils-playwright'; const { test, expect } = require( '@playwright/test' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-block-calculate-tax.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-block-calculate-tax.spec.js index 92ea087cdcce5..712040eda37f0 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-block-calculate-tax.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-block-calculate-tax.spec.js @@ -1,13 +1,17 @@ const { test, expect } = require( '@playwright/test' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; -const { - goToPageEditor, - fillPageTitle, +const { fillPageTitle } = require( '../../utils/editor' ); +const { random } = require( '../../utils/helpers' ); + +/** + * External dependencies + */ +import { + addAProductToCart, insertBlockByShortcut, + goToPageEditor, publishPage, -} = require( '../../utils/editor' ); -const { addAProductToCart } = require( '../../utils/cart' ); -const { random } = require( '../../utils/helpers' ); +} from '@woocommerce/e2e-utils-playwright'; const productName = 'First Product Cart Block Taxing'; const productPrice = '100.00'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-calculate-tax.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-calculate-tax.spec.js index f4c1740683b00..dbbc1b51c2c7e 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-calculate-tax.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-calculate-tax.spec.js @@ -1,9 +1,13 @@ const { test, expect } = require( '@playwright/test' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const { customer } = require( '../../test-data/data' ); -const { addAProductToCart } = require( '../../utils/cart' ); const { random } = require( '../../utils/helpers' ); +/** + * External dependencies + */ +import { addAProductToCart } from '@woocommerce/e2e-utils-playwright'; + const productName = `Taxed products are awesome ${ random() }`; const productPrice = '200.00'; const messyProductPrice = '13.47'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-coupons.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-coupons.spec.js index 200f47cde1ae5..8df63493e3665 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-coupons.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-coupons.spec.js @@ -1,4 +1,7 @@ -const { addAProductToCart } = require( '../../utils/cart' ); +/** + * External dependencies + */ +import { addAProductToCart } from '@woocommerce/e2e-utils-playwright'; const { test, expect } = require( '@playwright/test' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-restricted-coupons.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-restricted-coupons.spec.js index 44e594c66f051..11e82b73e841b 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-restricted-coupons.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/cart-checkout-restricted-coupons.spec.js @@ -1,6 +1,11 @@ +/** + * External dependencies + */ +import { + addAProductToCart, + getOrderIdFromUrl, +} from '@woocommerce/e2e-utils-playwright'; const { test, expect } = require( '@playwright/test' ); -const { getOrderIdFromUrl } = require( '../../utils/order' ); -const { addAProductToCart } = require( '../../utils/cart' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const includedProductName = 'Included test product'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block-coupons.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block-coupons.spec.js index c0501f9f0ecdd..6e289c1e0ee3b 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block-coupons.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block-coupons.spec.js @@ -1,10 +1,13 @@ -const { - goToPageEditor, - fillPageTitle, +/** + * External dependencies + */ +import { + addAProductToCart, insertBlockByShortcut, publishPage, -} = require( '../../utils/editor' ); -const { addAProductToCart } = require( '../../utils/cart' ); + goToPageEditor, +} from '@woocommerce/e2e-utils-playwright'; +const { fillPageTitle } = require( '../../utils/editor' ); const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); const { random } = require( '../../utils/helpers' ); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block.spec.js index ced090e4a7b34..38a5323e28aa8 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-block.spec.js @@ -1,10 +1,4 @@ -const { - goToPageEditor, - fillPageTitle, - insertBlockByShortcut, - publishPage, -} = require( '../../utils/editor' ); -const { addAProductToCart } = require( '../../utils/cart' ); +const { fillPageTitle } = require( '../../utils/editor' ); const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; @@ -12,11 +6,18 @@ const { admin, customer } = require( '../../test-data/data' ); const { logIn } = require( '../../utils/login' ); const { setFilterValue, clearFilters } = require( '../../utils/filters' ); -const { +/** + * External dependencies + */ +import { + insertBlockByShortcut, + goToPageEditor, + publishPage, + addAProductToCart, + getOrderIdFromUrl, fillShippingCheckoutBlocks, fillBillingCheckoutBlocks, -} = require( '../../utils/checkout' ); -const { getOrderIdFromUrl } = require( '../../utils/order' ); +} from '@woocommerce/e2e-utils-playwright'; const guestEmail = 'checkout-guest@example.com'; const newAccountEmail = `marge-${ new Date() diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-create-account.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-create-account.spec.js index f0ad43fec8ab6..d60385faaed32 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-create-account.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-create-account.spec.js @@ -1,8 +1,14 @@ const { test, expect } = require( '@playwright/test' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const { admin } = require( '../../test-data/data' ); -const { getOrderIdFromUrl } = require( '../../utils/order' ); -const { addAProductToCart } = require( '../../utils/cart' ); + +/** + * External dependencies + */ +import { + addAProductToCart, + getOrderIdFromUrl, +} from '@woocommerce/e2e-utils-playwright'; const billingEmail = 'marge-test-account@example.com'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-login.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-login.spec.js index 1eaadf1a5dd28..719913f9a0fe2 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-login.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout-login.spec.js @@ -1,6 +1,11 @@ +/** + * External dependencies + */ +import { + addAProductToCart, + getOrderIdFromUrl, +} from '@woocommerce/e2e-utils-playwright'; const { test, expect } = require( '@playwright/test' ); -const { getOrderIdFromUrl } = require( '../../utils/order' ); -const { addAProductToCart } = require( '../../utils/cart' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const customer = { diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout.spec.js index e09d44a4a86a5..6d35c1dfb2044 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/checkout.spec.js @@ -2,9 +2,15 @@ const { test, expect } = require( '@playwright/test' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const { admin, customer } = require( '../../test-data/data' ); const { setFilterValue, clearFilters } = require( '../../utils/filters' ); -const { addProductsToCart } = require( '../../utils/pdp' ); -const { addAProductToCart } = require( '../../utils/cart' ); -const { getOrderIdFromUrl } = require( '../../utils/order' ); + +/** + * External dependencies + */ +import { + addAProductToCart, + addOneOrMoreProductToCart, + getOrderIdFromUrl, +} from '@woocommerce/e2e-utils-playwright'; const guestEmail = 'checkout-guest@example.com'; @@ -152,7 +158,7 @@ test.describe( page, } ) => { // this time we're going to add two products to the cart - await addProductsToCart( page, simpleProductName, '2' ); + await addOneOrMoreProductToCart( page, simpleProductName, '2' ); await page.goto( '/checkout/' ); await expect( @@ -177,7 +183,7 @@ test.describe( test( 'allows customer to fill billing details', async ( { page } ) => { // this time we're going to add three products to the cart - await addProductsToCart( page, simpleProductName, '3' ); + await addOneOrMoreProductToCart( page, simpleProductName, '3' ); await page.goto( '/checkout/' ); await expect( @@ -302,7 +308,7 @@ test.describe( test( 'allows customer to fill shipping details', async ( { page, } ) => { - await addProductsToCart( page, simpleProductName, '2' ); + await addOneOrMoreProductToCart( page, simpleProductName, '2' ); await page.goto( '/checkout/' ); await expect( @@ -342,7 +348,7 @@ test.describe( test( 'allows guest customer to place an order', async ( { page } ) => { await test.step( 'Add 2 products to the cart', async () => { - await addProductsToCart( page, simpleProductName, '2' ); + await addOneOrMoreProductToCart( page, simpleProductName, '2' ); } ); await test.step( 'Go to checkout and confirm that products and totals are as expected', async () => { @@ -509,7 +515,7 @@ test.describe( ) ).toBeVisible(); - await addProductsToCart( page, simpleProductName, '2' ); + await addOneOrMoreProductToCart( page, simpleProductName, '2' ); await page.goto( '/checkout/' ); await expect( diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js index bd78bb53de467..0f273977e5dd7 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/mini-cart.spec.js @@ -1,11 +1,15 @@ const { test, expect } = require( '@playwright/test' ); -const { +const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; +const { random } = require( '../../utils/helpers' ); + +/** + * External dependencies + */ +import { openEditorSettings, getCanvas, goToPageEditor, -} = require( '../../utils/editor' ); -const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; -const { random } = require( '../../utils/helpers' ); +} from '@woocommerce/e2e-utils-playwright'; const miniCartPageTitle = `Mini Cart ${ random() }`; const miniCartPageSlug = miniCartPageTitle.replace( / /gi, '-' ).toLowerCase(); diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/order-email-receiving.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/order-email-receiving.spec.js index c653f8066e025..55f65b7e189d3 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/order-email-receiving.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/order-email-receiving.spec.js @@ -1,8 +1,14 @@ const { test, expect } = require( '@playwright/test' ); const { customer, storeDetails } = require( '../../test-data/data' ); const { api } = require( '../../utils' ); -const { getOrderIdFromUrl } = require( '../../utils/order' ); -const { addAProductToCart } = require( '../../utils/cart' ); + +/** + * External dependencies + */ +import { + addAProductToCart, + getOrderIdFromUrl, +} from '@woocommerce/e2e-utils-playwright'; let productId, orderId, zoneId; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/product-tags-attributes.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/product-tags-attributes.spec.js index 5221f51f19c37..4921baf78d635 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/product-tags-attributes.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/product-tags-attributes.spec.js @@ -1,7 +1,10 @@ +/** + * External dependencies + */ +import { getCanvas, goToPageEditor } from '@woocommerce/e2e-utils-playwright'; const { test, expect, request } = require( '@playwright/test' ); const { admin } = require( '../../test-data/data' ); const pageTitle = 'Product Showcase'; -const { goToPageEditor, getCanvas } = require( '../../utils/editor' ); const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default; const singleProductPrice1 = '5.00'; diff --git a/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js b/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js index 5bc40f1bd0a22..f5da103aada57 100644 --- a/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js +++ b/plugins/woocommerce/tests/e2e-pw/tests/shopper/shop-products-filter-by-price.spec.js @@ -1,13 +1,17 @@ const { test: baseTest, expect } = require( '../../fixtures/fixtures' ); -const { - goToPageEditor, - fillPageTitle, +const { fillPageTitle } = require( '../../utils/editor' ); +const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); + +/** + * External dependencies + */ +import { + getCanvas, insertBlock, insertBlockByShortcut, + goToPageEditor, publishPage, - getCanvas, -} = require( '../../utils/editor' ); -const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); +} from '@woocommerce/e2e-utils-playwright'; const singleProductPrice1 = '10'; const singleProductPrice2 = '50';