Add new e2e test shopper order email receiving
This commit is contained in:
parent
2243e6f60b
commit
950d08b7a5
|
@ -3,6 +3,7 @@
|
|||
## Added
|
||||
|
||||
- Support for re-running setup and shopper tests
|
||||
- Shopper Order Email Receiving
|
||||
|
||||
## Fixed
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@ The functions to access the core tests are:
|
|||
- `runCheckoutLoginAccountTest` - Shopper can login to an account during checkout
|
||||
- `runMyAccountCreateAccountTest` - Shopper can create an account via my account page
|
||||
- `runCartRedirectionTest` - Shopper is redirected to the cart page after adding to cart
|
||||
- `runOrderEmailReceivingTest` - Shopper can receive an email for his order
|
||||
|
||||
### REST API
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ const runVariableProductUpdateTest = require( './shopper/front-end-variable-prod
|
|||
const runCheckoutCreateAccountTest = require( './shopper/front-end-checkout-create-account.test' );
|
||||
const runCheckoutLoginAccountTest = require( './shopper/front-end-checkout-login-account.test' );
|
||||
const runCartRedirectionTest = require( './shopper/front-end-cart-redirection.test' );
|
||||
const runOrderEmailReceivingTest = require( './shopper/front-end-order-email-receiving.test' );
|
||||
|
||||
// Merchant tests
|
||||
const runAddNewShippingZoneTest = require ( './merchant/wp-admin-settings-shipping-zones.test' );
|
||||
|
@ -70,7 +71,8 @@ const runShopperTests = () => {
|
|||
runVariableProductUpdateTest();
|
||||
runCheckoutCreateAccountTest();
|
||||
runCheckoutLoginAccountTest();
|
||||
runCartRedirectionTest();
|
||||
runCartRedirectionTest();
|
||||
runOrderEmailReceivingTest();
|
||||
};
|
||||
|
||||
const runMerchantTests = () => {
|
||||
|
@ -144,8 +146,9 @@ module.exports = {
|
|||
runAddShippingClassesTest,
|
||||
runAnalyticsPageLoadsTest,
|
||||
runCheckoutCreateAccountTest,
|
||||
runImportProductsTest,
|
||||
runImportProductsTest,
|
||||
runCheckoutLoginAccountTest,
|
||||
runCartRedirectionTest,
|
||||
runMyAccountCreateAccountTest,
|
||||
runOrderEmailReceivingTest,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
/* eslint-disable jest/no-export, jest/no-disabled-tests, jest/expect-expect */
|
||||
/**
|
||||
* Internal dependencies
|
||||
*/
|
||||
const {
|
||||
shopper,
|
||||
merchant,
|
||||
createSimpleProduct,
|
||||
uiUnblocked,
|
||||
} = require( '@woocommerce/e2e-utils' );
|
||||
|
||||
let simplePostIdValue;
|
||||
let orderId;
|
||||
const config = require( 'config' );
|
||||
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 () => {
|
||||
await merchant.login();
|
||||
simplePostIdValue = await createSimpleProduct();
|
||||
await merchant.logout();
|
||||
});
|
||||
|
||||
it('should receive order email after purchasing an item', async () => {
|
||||
await shopper.login();
|
||||
|
||||
// Go to the shop and purchase an item
|
||||
await shopper.goToProduct(simplePostIdValue);
|
||||
await shopper.addToCart(simpleProductName);
|
||||
await shopper.goToCheckout();
|
||||
await uiUnblocked();
|
||||
await shopper.placeOrder();
|
||||
// Get order ID from the order received html element on the page
|
||||
orderId = await page.$$eval(".woocommerce-order-overview__order strong", elements => elements.map(item => item.textContent));
|
||||
|
||||
// Verify the new order email has been received
|
||||
await merchant.login();
|
||||
await merchant.openEmailLog();
|
||||
await expect( page ).toMatchElement( '.column-receiver', { text: customerEmail } );
|
||||
await expect( page ).toMatchElement( '.column-subject', { text: `[${storeName}]: New order #${orderId}` } );
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = runOrderEmailReceivingTest;
|
|
@ -0,0 +1,6 @@
|
|||
/*
|
||||
* Internal dependencies
|
||||
*/
|
||||
const { runOrderEmailReceivingTest } = require( '@woocommerce/e2e-core-tests' );
|
||||
|
||||
runOrderEmailReceivingTest();
|
Loading…
Reference in New Issue