Add new e2e test case customer can pay for his order

This commit is contained in:
Veljko V 2021-01-14 13:45:12 +01:00
parent b36a06ca08
commit 98823ba8d0
4 changed files with 57 additions and 2 deletions

View File

@ -11,6 +11,7 @@ const runInitialStoreSettingsTest = require( './activate-and-setup/setup.test' )
// Shopper tests
const runCartPageTest = require( './shopper/front-end-cart.test' );
const runCheckoutPageTest = require( './shopper/front-end-checkout.test' );
const runMyAccountPayOrderTest = require( './shopper/front-end-my-account-pay-order.test' );
const runMyAccountPageTest = require( './shopper/front-end-my-account.test' );
const runSingleProductPageTest = require( './shopper/front-end-single-product.test' );
@ -35,6 +36,7 @@ const runSetupOnboardingTests = () => {
const runShopperTests = () => {
runCartPageTest();
runCheckoutPageTest();
runMyAccountPayOrderTest();
runMyAccountPageTest();
runSingleProductPageTest();
};
@ -60,6 +62,7 @@ module.exports = {
runSetupOnboardingTests,
runCartPageTest,
runCheckoutPageTest,
runMyAccountPayOrderTest,
runMyAccountPageTest,
runSingleProductPageTest,
runShopperTests,

View File

@ -0,0 +1,46 @@
/* eslint-disable jest/no-export, jest/no-disabled-tests */
/**
* Internal dependencies
*/
const {
shopper,
merchant,
createSimpleProduct,
uiUnblocked
} = require( '@woocommerce/e2e-utils' );
let simplePostIdValue;
const config = require( 'config' );
const simpleProductName = config.get( 'products.simple.name' );
const runMyAccountPayOrderTest = () => {
describe('Customer can pay for his order through my account', () => {
beforeAll(async () => {
await merchant.login();
simplePostIdValue = await createSimpleProduct();
await merchant.logout();
await shopper.login();
await shopper.goToProduct(simplePostIdValue);
await shopper.addToCartFromShopPage(simpleProductName);
await shopper.goToCheckout();
await shopper.fillBillingDetails(config.get('addresses.customer.billing'));
await uiUnblocked();
await shopper.placeOrder();
const orderElement = await page.$(".order");
const orderId = await page.evaluate(orderElement => orderElement.textContent, orderElement);
await shopper.logout();
await merchant.login();
await merchant.updateOrderStatus(orderId, 'Pending payment');
await merchant.logout();
})
it('allows customer to pay for his order in my account', async () => {
await shopper.login();
await shopper.goToOrders();
await expect(page.url()).toMatch('my-account/orders');
await expect(page).toMatchElement('h1', {text: 'Orders'});
});
});
}
module.exports = runMyAccountPayOrderTest;

View File

@ -1,5 +1,6 @@
{
"url": "http://localhost:8084/",
"appName": "woocommerce_e2e",
"users": {
"admin": {
"username": "admin",
@ -12,8 +13,7 @@
},
"products": {
"simple": {
"name": "Simple product",
"price": "9.99"
"name": "Simple product"
},
"variable": {
"name": "Variable Product with Three Variations"

View File

@ -0,0 +1,6 @@
/*
* Internal dependencies
*/
const { runMyAccountPayOrderTest } = require( '@woocommerce/e2e-core-tests' );
runMyAccountPayOrderTest();