diff --git a/tests/e2e/core-tests/specs/index.js b/tests/e2e/core-tests/specs/index.js index 8c8bd03b152..8496219af50 100644 --- a/tests/e2e/core-tests/specs/index.js +++ b/tests/e2e/core-tests/specs/index.js @@ -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, diff --git a/tests/e2e/core-tests/specs/shopper/front-end-my-account-pay-order.test.js b/tests/e2e/core-tests/specs/shopper/front-end-my-account-pay-order.test.js new file mode 100644 index 00000000000..dde62dbf3b8 --- /dev/null +++ b/tests/e2e/core-tests/specs/shopper/front-end-my-account-pay-order.test.js @@ -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; diff --git a/tests/e2e/env/config/default.json b/tests/e2e/env/config/default.json index 9dd72fb0f9c..e01ee4e9a27 100644 --- a/tests/e2e/env/config/default.json +++ b/tests/e2e/env/config/default.json @@ -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" diff --git a/tests/e2e/specs/front-end/test-my-account-pay-order.js b/tests/e2e/specs/front-end/test-my-account-pay-order.js new file mode 100644 index 00000000000..a0722df86c0 --- /dev/null +++ b/tests/e2e/specs/front-end/test-my-account-pay-order.js @@ -0,0 +1,6 @@ +/* + * Internal dependencies + */ +const { runMyAccountPayOrderTest } = require( '@woocommerce/e2e-core-tests' ); + +runMyAccountPayOrderTest();