From 1c1fceb304e0ce63cc36bf08e425c81ccc1be445 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Fri, 14 Jan 2022 15:44:08 -0400 Subject: [PATCH] e2e-core-test package cleanup --- packages/js/e2e-core-tests/project.json | 30 +++++++++++++++++++ .../merchant/wp-admin-order-refund.test.js | 1 - .../wp-admin-order-status-filters.test.js | 2 -- .../wp-admin-product-edit-details.test.js | 7 ++++- .../merchant/wp-admin-product-new.test.js | 2 +- .../wp-admin-settings-general.test.js | 2 +- .../wp-admin-settings-product.test.js | 2 +- ...wp-admin-settings-shipping-classes.test.js | 4 +++ .../front-end-cart-calculate-shipping.test.js | 6 +--- .../shopper/front-end-cart-coupons.test.js | 7 +---- .../src/specs/shopper/front-end-cart.test.js | 8 ++--- .../front-end-checkout-coupons.test.js | 7 +---- .../front-end-checkout-create-account.test.js | 6 +--- .../front-end-checkout-login-account.test.js | 6 +--- .../specs/shopper/front-end-checkout.test.js | 5 ++++ ...ront-end-my-account-create-account.test.js | 5 ++++ .../front-end-my-account-pay-order.test.js | 5 ++++ .../shopper/front-end-my-account.test.js | 5 ++++ .../front-end-order-email-receiving.test.js | 14 ++++----- ...ont-end-product-browse-search-sort.test.js | 6 +--- .../shopper/front-end-single-product.test.js | 6 +++- .../src/factories/grouped-product.js | 6 ++-- 22 files changed, 83 insertions(+), 59 deletions(-) diff --git a/packages/js/e2e-core-tests/project.json b/packages/js/e2e-core-tests/project.json index 9beb7a7bd5a..ccff2f7a31e 100644 --- a/packages/js/e2e-core-tests/project.json +++ b/packages/js/e2e-core-tests/project.json @@ -9,6 +9,36 @@ "action": "add", "cwd": "packages/js/e2e-core-tests" } + }, + "build": { + "executor": "@nrwl/workspace:run-script", + "options": { + "script": "build" + } + }, + "clean": { + "executor": "@nrwl/workspace:run-script", + "options": { + "script": "clean" + } + }, + "compile": { + "executor": "@nrwl/workspace:run-script", + "options": { + "script": "compile" + } + }, + "prepare": { + "executor": "@nrwl/workspace:run-script", + "options": { + "script": "prepare" + } + }, + "lint": { + "executor": "@nrwl/workspace:run-script", + "options": { + "script": "lint" + } } } } diff --git a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-refund.test.js b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-refund.test.js index a2cc152406f..60f7ee5b53c 100644 --- a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-refund.test.js +++ b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-refund.test.js @@ -7,7 +7,6 @@ const { verifyCheckboxIsSet, verifyValueOfInputField, uiUnblocked, - evalAndClick, createOrder, clickAndWaitForSelector, } = require( '@woocommerce/e2e-utils' ); diff --git a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-status-filters.test.js b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-status-filters.test.js index 5a2740774cd..75b970184c1 100644 --- a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-status-filters.test.js +++ b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-order-status-filters.test.js @@ -1,8 +1,6 @@ /** * Internal dependencies */ -const config = require( 'config' ); - const { merchant, withRestApi, diff --git a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-edit-details.test.js b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-edit-details.test.js index 41cf52e4afb..7e3bbf489de 100644 --- a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-edit-details.test.js +++ b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-edit-details.test.js @@ -7,9 +7,14 @@ const { merchant, uiUnblocked, verifyAndPublish, - createSimpleProduct + createSimpleProduct, } = require( '@woocommerce/e2e-utils' ); +/** + * External dependencies + */ +const { it, describe, beforeAll } = require( '@jest/globals' ); + let productId; const runProductEditDetailsTest = () => { diff --git a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-new.test.js b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-new.test.js index 457013a6463..e5ca29f502a 100644 --- a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-new.test.js +++ b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-product-new.test.js @@ -11,7 +11,7 @@ const { setBrowserViewport, verifyAndPublish, waitForSelector, - waitForSelectorWithoutThrow + waitForSelectorWithoutThrow, } = require( '@woocommerce/e2e-utils' ); const { waitAndClick, diff --git a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-general.test.js b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-general.test.js index a5ea6ecc555..9198d5ceb4e 100644 --- a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-general.test.js +++ b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-general.test.js @@ -5,7 +5,7 @@ const { merchant, settingsPageSaveChanges, - verifyValueOfInputField + verifyValueOfInputField, } = require( '@woocommerce/e2e-utils' ); /** diff --git a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-product.test.js b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-product.test.js index 37aa5884247..433196ad442 100644 --- a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-product.test.js +++ b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-product.test.js @@ -8,7 +8,7 @@ const { settingsPageSaveChanges, unsetCheckbox, verifyCheckboxIsSet, - verifyCheckboxIsUnset + verifyCheckboxIsUnset, } = require( '@woocommerce/e2e-utils' ); const runProductSettingsTest = () => { diff --git a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-shipping-classes.test.js b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-shipping-classes.test.js index eeaf345facc..1eeea39852e 100644 --- a/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-shipping-classes.test.js +++ b/packages/js/e2e-core-tests/src/specs/merchant/wp-admin-settings-shipping-classes.test.js @@ -2,6 +2,10 @@ * Internal dependencies */ const { merchant, withRestApi } = require('@woocommerce/e2e-utils'); + +/** + * External dependencies + */ const { lorem, helpers } = require('faker'); const runAddShippingClassesTest = () => { diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-calculate-shipping.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-calculate-shipping.test.js index 98add6b0d52..f44a828e81c 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-calculate-shipping.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-calculate-shipping.test.js @@ -12,11 +12,7 @@ const { /** * External dependencies */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); +const { it, describe, beforeAll } = require( '@jest/globals' ); const config = require( 'config' ); const firstProductPrice = config.has( 'products.simple.price' ) ? config.get( 'products.simple.price' ) : '9.99'; diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-coupons.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-coupons.test.js index 464856ded67..928df8fc16a 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-coupons.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart-coupons.test.js @@ -3,7 +3,6 @@ */ const { shopper, - createCoupon, createSimpleProduct, uiUnblocked, applyCoupon, @@ -14,11 +13,7 @@ const { getCouponId, getCouponsTable } = require( '../utils/coupons' ); /** * External dependencies */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); +const { it, describe, beforeAll } = require( '@jest/globals' ); const runCartApplyCouponsTest = () => { describe('Cart applying coupons', () => { diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart.test.js index fea98893cf7..b16a15441e1 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-cart.test.js @@ -5,17 +5,13 @@ const { shopper, withRestApi, createSimpleProduct, - uiUnblocked + uiUnblocked, } = require( '@woocommerce/e2e-utils' ); /** * External dependencies */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); +const { it, describe, beforeAll } = require( '@jest/globals' ); const config = require( 'config' ); const simpleProductName = config.get( 'products.simple.name' ); diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-coupons.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-coupons.test.js index dded5cc3587..bb1fcc05305 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-coupons.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-coupons.test.js @@ -3,7 +3,6 @@ */ const { shopper, - createCoupon, createSimpleProduct, uiUnblocked, applyCoupon, @@ -15,11 +14,7 @@ const { getCouponId, getCouponsTable } = require( '../utils/coupons' ); /** * External dependencies */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); +const { it, describe, beforeAll } = require( '@jest/globals' ); const runCheckoutApplyCouponsTest = () => { diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-create-account.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-create-account.test.js index 71dc37a1bdf..5f8d506216a 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-create-account.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-create-account.test.js @@ -15,11 +15,7 @@ /** * External dependencies */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); +const { it, describe, beforeAll } = require( '@jest/globals' ); const config = require( 'config' ); const customerBilling = config.get( 'addresses.customer.billing' ); diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-login-account.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-login-account.test.js index b81d115cd36..ab444a64529 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-login-account.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout-login-account.test.js @@ -13,11 +13,7 @@ /** * External dependencies */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); +const { it, describe, beforeAll } = require( '@jest/globals' ); const config = require('config'); diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout.test.js index 47999a5d07d..5c2e068f41f 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-checkout.test.js @@ -9,6 +9,11 @@ const { uiUnblocked, } = require( '@woocommerce/e2e-utils' ); +/** + * External dependencies + */ +const { it, describe, beforeAll, afterAll } = require( '@jest/globals' ); + const config = require( 'config' ); const simpleProductName = config.get( 'products.simple.name' ); const singleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99'; diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-create-account.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-create-account.test.js index 77bc4ec92fa..d62d31f4821 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-create-account.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-create-account.test.js @@ -9,6 +9,11 @@ const { withRestApi, } = require( '@woocommerce/e2e-utils' ); +/** + * External dependencies + */ +const { it, describe, beforeAll, afterAll } = require( '@jest/globals' ); + const customerEmailAddress = 'john.doe.test@example.com'; const runMyAccountCreateAccountTest = () => { diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-pay-order.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-pay-order.test.js index 4b6e9ca6609..6e9e61ba663 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-pay-order.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account-pay-order.test.js @@ -9,6 +9,11 @@ const { uiUnblocked } = require( '@woocommerce/e2e-utils' ); +/** + * External dependencies + */ +const { it, describe, beforeAll, afterAll } = require( '@jest/globals' ); + let simplePostIdValue; let orderNum; const config = require( 'config' ); diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account.test.js index 3073d867976..51d495b30a0 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-my-account.test.js @@ -6,6 +6,11 @@ const { shopper, } = require( '@woocommerce/e2e-utils' ); +/** + * External dependencies + */ +const { it, describe } = require( '@jest/globals' ); + const pages = [ ['Orders', 'my-account/orders', shopper.goToOrders], ['Downloads', 'my-account/downloads', shopper.goToDownloads], diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-order-email-receiving.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-order-email-receiving.test.js index 45961523c36..a56e10ef109 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-order-email-receiving.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-order-email-receiving.test.js @@ -10,6 +10,11 @@ deleteAllEmailLogs, } = require( '@woocommerce/e2e-utils' ); +/** + * External dependencies + */ +const { it, describe, beforeAll, afterAll } = require( '@jest/globals' ); + let simplePostIdValue; let orderId; const config = require( 'config' ); @@ -17,15 +22,6 @@ const simpleProductName = config.get( 'products.simple.name' ); const customerEmail = config.get( 'addresses.customer.billing.email' ); const storeName = 'WooCommerce Core E2E Test Suite'; -/** - * External dependencies - */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); - const runOrderEmailReceivingTest = () => { describe('Shopper Order Email Receiving', () => { beforeAll(async () => { diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-product-browse-search-sort.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-product-browse-search-sort.test.js index a0a1a298582..e5bcdadb73a 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-product-browse-search-sort.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-product-browse-search-sort.test.js @@ -11,11 +11,7 @@ const { /** * External dependencies */ -const { - it, - describe, - beforeAll, -} = require( '@jest/globals' ); +const { it, beforeAll } = require( '@jest/globals' ); const config = require( 'config' ); const simpleProductName = config.get( 'products.simple.name' ); diff --git a/packages/js/e2e-core-tests/src/specs/shopper/front-end-single-product.test.js b/packages/js/e2e-core-tests/src/specs/shopper/front-end-single-product.test.js index 6a04850ca52..f5db7c73f1a 100644 --- a/packages/js/e2e-core-tests/src/specs/shopper/front-end-single-product.test.js +++ b/packages/js/e2e-core-tests/src/specs/shopper/front-end-single-product.test.js @@ -6,9 +6,13 @@ const { createSimpleProduct, createVariableProduct, createGroupedProduct, - uiUnblocked + uiUnblocked, } = require( '@woocommerce/e2e-utils' ); +/** + * External dependencies + */ +const { it, describe, beforeAll } = require( '@jest/globals' ); const config = require( 'config' ); // Variables for simple product diff --git a/packages/js/e2e-utils/src/factories/grouped-product.js b/packages/js/e2e-utils/src/factories/grouped-product.js index cb2315f586c..53f1962b9ef 100644 --- a/packages/js/e2e-utils/src/factories/grouped-product.js +++ b/packages/js/e2e-utils/src/factories/grouped-product.js @@ -2,10 +2,8 @@ import { GroupedProduct } from '@woocommerce/api'; import { Factory } from 'fishery'; /** - * Creates a new factory for creating variable products. - * This does not include creating product variations. - * Instead, use `variationFactory()` for that. - * + * Creates a new factory for creating grouped products. + * * @param {HTTPClient} httpClient The HTTP client we will give the repository. * @return {AsyncFactory} The factory for creating models. */