Merge branch 'trunk' into e2e/add-build-to-e2e-core-tests
This commit is contained in:
commit
9d85ba8f00
|
@ -1,9 +1,5 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
## Changes
|
|
||||||
|
|
||||||
- Removed the node-config dependency
|
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
- Moved `merchant.login()` out of `beforeAll()` block and into test body for retried runs.
|
- Moved `merchant.login()` out of `beforeAll()` block and into test body for retried runs.
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jest/globals": "^26.4.2",
|
"@jest/globals": "^26.4.2",
|
||||||
"@wordpress/deprecated": "^3.2.3",
|
"@wordpress/deprecated": "^3.2.3",
|
||||||
|
"config": "3.3.3",
|
||||||
"faker": "^5.1.0"
|
"faker": "^5.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -38,8 +39,7 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@woocommerce/api": "^0.2.0",
|
"@woocommerce/api": "^0.2.0",
|
||||||
"@woocommerce/e2e-utils": "^0.1.6",
|
"@woocommerce/e2e-utils": "^0.1.6"
|
||||||
"@woocommerce/e2e-environment": "^0.2.3"
|
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -12,7 +12,7 @@ const {
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
import deprecated from '@wordpress/deprecated';
|
import deprecated from '@wordpress/deprecated';
|
||||||
const {
|
const {
|
||||||
it,
|
it,
|
||||||
|
|
|
@ -6,7 +6,7 @@ const { HTTPClientFactory, Coupon } = require( '@woocommerce/api' );
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const { it, describe, beforeAll } = require( '@jest/globals' );
|
const { it, describe, beforeAll } = require( '@jest/globals' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ const { HTTPClientFactory, ExternalProduct } = require( '@woocommerce/api' );
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const { it, describe, beforeAll } = require( '@jest/globals' );
|
const { it, describe, beforeAll } = require( '@jest/globals' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -10,7 +10,7 @@ const {
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const { it, describe, beforeAll } = require( '@jest/globals' );
|
const { it, describe, beforeAll } = require( '@jest/globals' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ const { HTTPClientFactory, Order } = require( '@woocommerce/api' );
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const { it, describe, beforeAll } = require( '@jest/globals' );
|
const { it, describe, beforeAll } = require( '@jest/globals' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -6,7 +6,7 @@ const { HTTPClientFactory } = require( '@woocommerce/api' );
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const { it, describe, beforeAll } = require( '@jest/globals' );
|
const { it, describe, beforeAll } = require( '@jest/globals' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,7 @@ const { HTTPClientFactory, VariableProduct, ProductVariation } = require( '@wooc
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const {
|
const {
|
||||||
it,
|
it,
|
||||||
describe,
|
describe,
|
||||||
|
|
|
@ -11,8 +11,8 @@ const {
|
||||||
utils,
|
utils,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
const discountedPrice = simpleProductPrice - 5.00;
|
const discountedPrice = simpleProductPrice - 5.00;
|
||||||
|
|
||||||
const couponDialogMessage = 'Enter a coupon code to apply. Discounts are applied to line totals, before taxes.';
|
const couponDialogMessage = 'Enter a coupon code to apply. Discounts are applied to line totals, before taxes.';
|
||||||
|
|
|
@ -9,9 +9,9 @@ const {
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
// TODO create a function for the logic below getConfigSimpleProduct(), see: https://github.com/woocommerce/woocommerce/issues/29072
|
// TODO create a function for the logic below getConfigSimpleProduct(), see: https://github.com/woocommerce/woocommerce/issues/29072
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
const simpleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const simpleProductPrice = config.has( 'products.simple.price' ) ? config.get( 'products.simple.price' ) : '9.99';
|
||||||
|
|
||||||
const runMerchantOrdersCustomerPaymentPage = () => {
|
const runMerchantOrdersCustomerPaymentPage = () => {
|
||||||
let orderId;
|
let orderId;
|
||||||
|
|
|
@ -9,10 +9,10 @@ const {
|
||||||
deleteAllEmailLogs,
|
deleteAllEmailLogs,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const customerEmail = config.get( 'addresses.customer.billing.email' );
|
const customerEmail = config.get( 'addresses.customer.billing.email' );
|
||||||
const adminEmail = config.get( 'users.admin.email', 'admin@woocommercecoree2etestsuite.com' );
|
const adminEmail = config.has( 'users.admin.email' ) ? config.get( 'users.admin.email' ) : 'admin@woocommercecoree2etestsuite.com';
|
||||||
const storeName = config.get( 'storeName', 'WooCommerce Core E2E Test Suite' );
|
const storeName = 'WooCommerce Core E2E Test Suite';
|
||||||
|
|
||||||
let orderId;
|
let orderId;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ const {
|
||||||
withRestApi,
|
withRestApi,
|
||||||
AdminEdit,
|
AdminEdit,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const {
|
const {
|
||||||
HTTPClientFactory,
|
HTTPClientFactory,
|
||||||
VariableProduct,
|
VariableProduct,
|
||||||
|
|
|
@ -12,8 +12,8 @@ const {
|
||||||
clickAndWaitForSelector,
|
clickAndWaitForSelector,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
|
|
||||||
const runRefundOrderTest = () => {
|
const runRefundOrderTest = () => {
|
||||||
describe('WooCommerce Orders > Refund an order', () => {
|
describe('WooCommerce Orders > Refund an order', () => {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
|
const config = require( 'config' );
|
||||||
|
|
||||||
const {
|
const {
|
||||||
merchant,
|
merchant,
|
||||||
withRestApi,
|
withRestApi,
|
||||||
|
|
|
@ -24,11 +24,11 @@ const {
|
||||||
it,
|
it,
|
||||||
describe,
|
describe,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
|
|
||||||
const VirtualProductName = 'Virtual Product Name';
|
const VirtualProductName = 'Virtual Product Name';
|
||||||
const NonVirtualProductName = 'Non-Virtual Product Name';
|
const NonVirtualProductName = 'Non-Virtual Product Name';
|
||||||
const simpleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
|
|
||||||
const openNewProductAndVerify = async () => {
|
const openNewProductAndVerify = async () => {
|
||||||
// Go to "add product" page
|
// Go to "add product" page
|
||||||
|
|
|
@ -8,9 +8,9 @@ const {
|
||||||
createSimpleProduct
|
createSimpleProduct
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
const simpleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
|
|
||||||
const runProductSearchTest = () => {
|
const runProductSearchTest = () => {
|
||||||
describe('Products > Search and View a product', () => {
|
describe('Products > Search and View a product', () => {
|
||||||
|
|
|
@ -21,8 +21,8 @@ const {
|
||||||
beforeAll,
|
beforeAll,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const simpleProductPrice = config.has( 'products.simple.price' ) ? config.get( 'products.simple.price' ) : '9.99';
|
||||||
const california = 'state:US:CA';
|
const california = 'state:US:CA';
|
||||||
const sanFranciscoZIP = '94107';
|
const sanFranciscoZIP = '94107';
|
||||||
const shippingZoneNameUS = 'US with Flat rate';
|
const shippingZoneNameUS = 'US with Flat rate';
|
||||||
|
|
|
@ -18,8 +18,8 @@ const {
|
||||||
beforeAll,
|
beforeAll,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const firstProductPrice = config.get( 'products.simple.price', '9.99' );
|
const firstProductPrice = config.has( 'products.simple.price' ) ? config.get( 'products.simple.price' ) : '9.99';
|
||||||
const secondProductPrice = '4.99';
|
const secondProductPrice = '4.99';
|
||||||
const fourProductPrice = firstProductPrice * 4;
|
const fourProductPrice = firstProductPrice * 4;
|
||||||
var twoProductsPrice = (+firstProductPrice) + (+secondProductPrice);
|
var twoProductsPrice = (+firstProductPrice) + (+secondProductPrice);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
afterAll,
|
afterAll,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
|
|
||||||
const runCartRedirectionTest = () => {
|
const runCartRedirectionTest = () => {
|
||||||
|
|
|
@ -17,9 +17,9 @@ const {
|
||||||
beforeAll,
|
beforeAll,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
const singleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const singleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
const twoProductPrice = singleProductPrice * 2;
|
const twoProductPrice = singleProductPrice * 2;
|
||||||
|
|
||||||
const runCartPageTest = () => {
|
const runCartPageTest = () => {
|
||||||
|
|
|
@ -21,7 +21,7 @@ const {
|
||||||
beforeAll,
|
beforeAll,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const customerBilling = config.get( 'addresses.customer.billing' );
|
const customerBilling = config.get( 'addresses.customer.billing' );
|
||||||
|
|
||||||
const runCheckoutCreateAccountTest = () => {
|
const runCheckoutCreateAccountTest = () => {
|
||||||
|
|
|
@ -19,7 +19,7 @@ const {
|
||||||
beforeAll,
|
beforeAll,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require('config');
|
||||||
|
|
||||||
const runCheckoutLoginAccountTest = () => {
|
const runCheckoutLoginAccountTest = () => {
|
||||||
describe('Shopper Checkout Login Account', () => {
|
describe('Shopper Checkout Login Account', () => {
|
||||||
|
|
|
@ -9,9 +9,9 @@ const {
|
||||||
uiUnblocked,
|
uiUnblocked,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
const singleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const singleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
const twoProductPrice = singleProductPrice * 2;
|
const twoProductPrice = singleProductPrice * 2;
|
||||||
const threeProductPrice = singleProductPrice * 3;
|
const threeProductPrice = singleProductPrice * 3;
|
||||||
const fourProductPrice = singleProductPrice * 4;
|
const fourProductPrice = singleProductPrice * 4;
|
||||||
|
|
|
@ -11,7 +11,7 @@ const {
|
||||||
|
|
||||||
let simplePostIdValue;
|
let simplePostIdValue;
|
||||||
let orderNum;
|
let orderNum;
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
|
|
||||||
const runMyAccountPayOrderTest = () => {
|
const runMyAccountPayOrderTest = () => {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
let simplePostIdValue;
|
let simplePostIdValue;
|
||||||
let orderId;
|
let orderId;
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
const customerEmail = config.get( 'addresses.customer.billing.email' );
|
const customerEmail = config.get( 'addresses.customer.billing.email' );
|
||||||
const storeName = 'WooCommerce Core E2E Test Suite';
|
const storeName = 'WooCommerce Core E2E Test Suite';
|
||||||
|
|
|
@ -17,11 +17,11 @@ const {
|
||||||
beforeAll,
|
beforeAll,
|
||||||
} = require( '@jest/globals' );
|
} = require( '@jest/globals' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
const singleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const singleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
const singleProductPrice2 = '1' + singleProductPrice;
|
const singleProductPrice2 = config.has('products.simple.price') ? '1' + singleProductPrice : '19.99';
|
||||||
const singleProductPrice3 = '2' + singleProductPrice;
|
const singleProductPrice3 = config.has('products.simple.price') ? '2' + singleProductPrice : '29.99';
|
||||||
const clothing = 'Clothing';
|
const clothing = 'Clothing';
|
||||||
const audio = 'Audio';
|
const audio = 'Audio';
|
||||||
const hardware = 'Hardware';
|
const hardware = 'Hardware';
|
||||||
|
|
|
@ -9,7 +9,7 @@ const {
|
||||||
uiUnblocked
|
uiUnblocked
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
|
|
||||||
// Variables for simple product
|
// Variables for simple product
|
||||||
const simpleProductName = config.get( 'products.simple.name' );
|
const simpleProductName = config.get( 'products.simple.name' );
|
||||||
|
@ -20,7 +20,7 @@ const defaultVariableProduct = config.get( 'products.variable' );
|
||||||
let variableProductId;
|
let variableProductId;
|
||||||
|
|
||||||
// Variables for grouped product
|
// Variables for grouped product
|
||||||
const simpleProductPrice = config.get( 'products.simple.price', '9.99' );
|
const simpleProductPrice = config.has('products.simple.price') ? config.get('products.simple.price') : '9.99';
|
||||||
const simple1 = {
|
const simple1 = {
|
||||||
name: simpleProductName + ' 1',
|
name: simpleProductName + ' 1',
|
||||||
regularPrice: simpleProductPrice
|
regularPrice: simpleProductPrice
|
||||||
|
|
|
@ -6,7 +6,7 @@ const {
|
||||||
shopper,
|
shopper,
|
||||||
createVariableProduct,
|
createVariableProduct,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require('config');
|
||||||
|
|
||||||
let variablePostIdValue;
|
let variablePostIdValue;
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ const runVariableProductUpdateTest = () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = runVariableProductUpdateTest;
|
module.exports = runVariableProductUpdateTest;
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
|
||||||
## Added
|
|
||||||
|
|
||||||
- Added a `config` export to the `@woocommerce/e2e-environment` package that has all data and methods of the [config](https://github.com/lorenwest/node-config) package
|
|
||||||
- it provides its own `get()` method that accepts an optional default parameter to be used if the property is not found in the config file.
|
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Added `post-results-to-github-pr.js` to post smoke test results to a GitHub PR.
|
- Added `post-results-to-github-pr.js` to post smoke test results to a GitHub PR.
|
||||||
- Added jest flags to generate a json test report
|
- Added jest flags to generate a json test report
|
||||||
- Added more entries to `default.json`
|
- Added more entries to `default.json`
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
|
||||||
- Added `await` for every call to `shopper.logout`
|
- Added `await` for every call to `shopper.logout`
|
||||||
|
|
|
@ -98,22 +98,6 @@ The E2E environment has the following methods to let us control Jest's overall b
|
||||||
E2E_RETRY_TIMES=2 pnpx wc-e2e test:e2e
|
E2E_RETRY_TIMES=2 pnpx wc-e2e test:e2e
|
||||||
```
|
```
|
||||||
|
|
||||||
### Default Environment Configurations
|
|
||||||
|
|
||||||
The E2E environment exports a config object which provides all the functionality of the [config](https://www.npmjs.com/package/config) package along with extending the `get` method to accept an optional second argument that will be used if the property is not found in the config file.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
|
||||||
|
|
||||||
// 'users.admin.email' doesn't exist
|
|
||||||
const adminEmail = config.get( 'users.admin.email', 'admin@woocommercecoree2etestsuite.com' );
|
|
||||||
|
|
||||||
console.log( adminEmail );
|
|
||||||
// admin@woocommercecoree2etestsuite.com
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note**: If the default parameter is not found and no optional parameter is provided, an error will be thrown.
|
|
||||||
|
|
||||||
#### Test Screenshots
|
#### Test Screenshots
|
||||||
|
|
||||||
The test sequencer provides a screenshot function for test failures. To enable screenshots on test failure use
|
The test sequencer provides a screenshot function for test failures. To enable screenshots on test failure use
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
/**
|
|
||||||
* External Dependencies
|
|
||||||
*/
|
|
||||||
const config = require( 'config' );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Since the 'config' object is not extensible, we create an empty 'e2eConfig' object and map
|
|
||||||
* its prototype to the 'config' object. This allows us to extend the new 'e2eConfig' object
|
|
||||||
* while still having access to all the data and methods of 'config'
|
|
||||||
*/
|
|
||||||
const e2eConfig = Object.create( config );
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param property { string } - the property to be fetched from the config file
|
|
||||||
* @param defaultValue { string | number | boolean | null } - default value if 'property' is not found
|
|
||||||
* @returns { string | number | boolean }
|
|
||||||
* @throws Error
|
|
||||||
*/
|
|
||||||
e2eConfig.get = ( property, defaultValue = null ) => {
|
|
||||||
if ( config.has( property ) ) {
|
|
||||||
return config.get( property );
|
|
||||||
} else if ( defaultValue ) {
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
`Configuration property "${ property }" is not defined and no defaultValue has been provided`
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = e2eConfig;
|
|
|
@ -1,7 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
const config = require('./config');
|
|
||||||
const jestConfig = require( './jest.config' );
|
const jestConfig = require( './jest.config' );
|
||||||
const jestPuppeteerConfig = require( './jest-puppeteer.config' );
|
const jestPuppeteerConfig = require( './jest-puppeteer.config' );
|
||||||
const jestobjectConfig = require('./jest-object.config');
|
const jestobjectConfig = require('./jest-object.config');
|
||||||
|
@ -13,7 +12,6 @@ const {
|
||||||
} = require( './use-config' );
|
} = require( './use-config' );
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
config,
|
|
||||||
jestConfig,
|
jestConfig,
|
||||||
...jestobjectConfig,
|
...jestobjectConfig,
|
||||||
jestPuppeteerConfig,
|
jestPuppeteerConfig,
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
## Changes
|
|
||||||
|
|
||||||
- Removed node-config dependency
|
|
||||||
- Added @woocommerce/e2e-environment peerDependency
|
|
||||||
- Updated the package to use the custom node-config object from @woocommerce/e2e-environment
|
|
||||||
|
|
||||||
## Fixed
|
## Fixed
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"@automattic/puppeteer-utils": "github:Automattic/puppeteer-utils#0f3ec50",
|
"@automattic/puppeteer-utils": "github:Automattic/puppeteer-utils#0f3ec50",
|
||||||
"@wordpress/deprecated": "^3.2.3",
|
"@wordpress/deprecated": "^3.2.3",
|
||||||
"@wordpress/e2e-test-utils": "^4.16.1",
|
"@wordpress/e2e-test-utils": "^4.16.1",
|
||||||
|
"config": "3.3.3",
|
||||||
"faker": "^5.1.0",
|
"faker": "^5.1.0",
|
||||||
"fishery": "^1.2.0"
|
"fishery": "^1.2.0"
|
||||||
},
|
},
|
||||||
|
@ -34,8 +35,7 @@
|
||||||
"eslint": "^8.1.0"
|
"eslint": "^8.1.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@woocommerce/api": "^0.2.0",
|
"@woocommerce/api": "^0.2.0"
|
||||||
"@woocommerce/e2e-environment": "^0.2.3"
|
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { HTTPClientFactory } from '@woocommerce/api';
|
import { HTTPClientFactory } from '@woocommerce/api';
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
import { simpleProductFactory } from './factories/simple-product';
|
import { simpleProductFactory } from './factories/simple-product';
|
||||||
import { variableProductFactory } from './factories/variable-product';
|
import { variableProductFactory } from './factories/variable-product';
|
||||||
import { variationFactory } from './factories/variation';
|
import { variationFactory } from './factories/variation';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
const baseUrl = config.get( 'url' );
|
const baseUrl = config.get( 'url' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
|
@ -440,9 +440,10 @@ const merchant = {
|
||||||
*/
|
*/
|
||||||
collapseAdminMenu: async ( collapse = true ) => {
|
collapseAdminMenu: async ( collapse = true ) => {
|
||||||
const collapseButton = await page.$( '.folded #collapse-button' );
|
const collapseButton = await page.$( '.folded #collapse-button' );
|
||||||
if ( ( ! collapse ) == collapseButton ) {
|
if ( ( ! collapseButton ) == collapse ) {
|
||||||
await collapseButton.click();
|
await collapseButton.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* External dependencies
|
* External dependencies
|
||||||
*/
|
*/
|
||||||
const { pressKeyWithModifier } = require( '@wordpress/e2e-test-utils' );
|
const { pressKeyWithModifier } = require( '@wordpress/e2e-test-utils' );
|
||||||
const { config } = require( '@woocommerce/e2e-environment' );
|
const config = require( 'config' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
|
|
|
@ -39,6 +39,11 @@
|
||||||
"sort-packages": true,
|
"sort-packages": true,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": "7.0.33"
|
"php": "7.0.33"
|
||||||
|
},
|
||||||
|
"allow-plugins": {
|
||||||
|
"automattic/jetpack-autoloader": true,
|
||||||
|
"composer/installers": true,
|
||||||
|
"bamarni/composer-bin-plugin": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
|
|
@ -579,7 +579,7 @@ jQuery( function( $ ) {
|
||||||
var scrollElement = $( '.woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout' );
|
var scrollElement = $( '.woocommerce-NoticeGroup-updateOrderReview, .woocommerce-NoticeGroup-checkout' );
|
||||||
|
|
||||||
if ( ! scrollElement.length ) {
|
if ( ! scrollElement.length ) {
|
||||||
scrollElement = $( '.form.checkout' );
|
scrollElement = $( 'form.checkout' );
|
||||||
}
|
}
|
||||||
$.scroll_to_notices( scrollElement );
|
$.scroll_to_notices( scrollElement );
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
"options": {
|
"options": {
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"command": "grunt assets",
|
"command": "pnpx grunt assets",
|
||||||
"forwardAllArgs": false
|
"forwardAllArgs": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -25,11 +25,11 @@
|
||||||
"options": {
|
"options": {
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"command": "grunt eslint",
|
"command": "pnpx grunt eslint",
|
||||||
"forwardAllArgs": false
|
"forwardAllArgs": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "grunt stylelint",
|
"command": "pnpx grunt stylelint",
|
||||||
"forwardAllArgs": false
|
"forwardAllArgs": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
"build-watch": {
|
"build-watch": {
|
||||||
"executor": "@nrwl/workspace:run-commands",
|
"executor": "@nrwl/workspace:run-commands",
|
||||||
"options": {
|
"options": {
|
||||||
"command": "grunt watch",
|
"command": "pnpx grunt watch",
|
||||||
"cwd": "plugins/woocommerce/legacy"
|
"cwd": "plugins/woocommerce/legacy"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -113,10 +113,12 @@ importers:
|
||||||
'@wordpress/babel-preset-default': 3.0.2
|
'@wordpress/babel-preset-default': 3.0.2
|
||||||
'@wordpress/browserslist-config': ^4.1.0
|
'@wordpress/browserslist-config': ^4.1.0
|
||||||
'@wordpress/deprecated': ^3.2.3
|
'@wordpress/deprecated': ^3.2.3
|
||||||
|
config: 3.3.3
|
||||||
faker: ^5.1.0
|
faker: ^5.1.0
|
||||||
dependencies:
|
dependencies:
|
||||||
'@jest/globals': 26.6.2
|
'@jest/globals': 26.6.2
|
||||||
'@wordpress/deprecated': 3.2.3
|
'@wordpress/deprecated': 3.2.3
|
||||||
|
config: 3.3.3
|
||||||
faker: 5.5.3
|
faker: 5.5.3
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@babel/cli': 7.12.8_@babel+core@7.12.9
|
'@babel/cli': 7.12.8_@babel+core@7.12.9
|
||||||
|
@ -216,6 +218,7 @@ importers:
|
||||||
'@wordpress/browserslist-config': ^4.1.0
|
'@wordpress/browserslist-config': ^4.1.0
|
||||||
'@wordpress/deprecated': ^3.2.3
|
'@wordpress/deprecated': ^3.2.3
|
||||||
'@wordpress/e2e-test-utils': ^4.16.1
|
'@wordpress/e2e-test-utils': ^4.16.1
|
||||||
|
config: 3.3.3
|
||||||
eslint: ^8.1.0
|
eslint: ^8.1.0
|
||||||
faker: ^5.1.0
|
faker: ^5.1.0
|
||||||
fishery: ^1.2.0
|
fishery: ^1.2.0
|
||||||
|
@ -223,6 +226,7 @@ importers:
|
||||||
'@automattic/puppeteer-utils': github.com/Automattic/puppeteer-utils/0f3ec50
|
'@automattic/puppeteer-utils': github.com/Automattic/puppeteer-utils/0f3ec50
|
||||||
'@wordpress/deprecated': 3.2.3
|
'@wordpress/deprecated': 3.2.3
|
||||||
'@wordpress/e2e-test-utils': 4.16.1_jest@27.3.1
|
'@wordpress/e2e-test-utils': 4.16.1_jest@27.3.1
|
||||||
|
config: 3.3.3
|
||||||
faker: 5.5.3
|
faker: 5.5.3
|
||||||
fishery: 1.4.0
|
fishery: 1.4.0
|
||||||
devDependencies:
|
devDependencies:
|
||||||
|
@ -7568,7 +7572,6 @@ packages:
|
||||||
engines: {node: '>= 6.0.0'}
|
engines: {node: '>= 6.0.0'}
|
||||||
dependencies:
|
dependencies:
|
||||||
json5: 2.2.0
|
json5: 2.2.0
|
||||||
dev: true
|
|
||||||
|
|
||||||
/config/3.3.6:
|
/config/3.3.6:
|
||||||
resolution: {integrity: sha512-Hj5916C5HFawjYJat1epbyY2PlAgLpBtDUlr0MxGLgo3p5+7kylyvnRY18PqJHgnNWXcdd0eWDemT7eYWuFgwg==}
|
resolution: {integrity: sha512-Hj5916C5HFawjYJat1epbyY2PlAgLpBtDUlr0MxGLgo3p5+7kylyvnRY18PqJHgnNWXcdd0eWDemT7eYWuFgwg==}
|
||||||
|
|
Loading…
Reference in New Issue