diff --git a/.github/workflows/end-2-end-test.yml b/.github/workflows/end-2-end-test.yml index 14ff4a960e1..c6b6e5773b0 100644 --- a/.github/workflows/end-2-end-test.yml +++ b/.github/workflows/end-2-end-test.yml @@ -76,12 +76,13 @@ jobs: MAGENTO_URL=$(docker exec magento-project-community-edition /bin/bash -c "curl -s ngrok:4040/api/tunnels |jq -r \".tunnels[0].public_url\"") echo "magento_url=$MAGENTO_URL" >> $GITHUB_ENV - # Note the `mollie-pwa.html` file, as it is copied to the pub folder. This is so that it can be accessed by Cypress. + # Note the `mollie-pwa-*.html` files, as it is copied to the pub folder. This is so that it can be accessed by Cypress. - name: Upload the code into the docker container run: | sed -i '/version/d' ./composer.json && \ docker cp $(pwd) magento-project-community-edition:/data/extensions/ && \ - docker cp $(pwd)/Test/End-2-end/cypress/fixtures/mollie-pwa.html magento-project-community-edition:/data/pub/opt/ && \ + docker cp $(pwd)/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html magento-project-community-edition:/data/pub/opt/ && \ + docker cp $(pwd)/Test/End-2-end/cypress/fixtures/mollie-pwa-rest.html magento-project-community-edition:/data/pub/opt/ && \ docker exec magento-project-community-edition ./install-composer-package mollie/magento2:@dev - name: Activate the extension diff --git a/Test/End-2-end/cypress/e2e/magento/graphql/place-order.cy.js b/Test/End-2-end/cypress/e2e/magento/api/graphql-place-order.cy.js similarity index 92% rename from Test/End-2-end/cypress/e2e/magento/graphql/place-order.cy.js rename to Test/End-2-end/cypress/e2e/magento/api/graphql-place-order.cy.js index b4251d1c255..b9f88195d70 100644 --- a/Test/End-2-end/cypress/e2e/magento/graphql/place-order.cy.js +++ b/Test/End-2-end/cypress/e2e/magento/api/graphql-place-order.cy.js @@ -13,9 +13,9 @@ const mollieHostedPaymentPage = new MollieHostedPaymentPage(); const checkoutSuccessPage = new CheckoutSuccessPage(); const ordersPage = new OrdersPage(); -describe('Check that the headless endpoints work as expected', () => { +describe('Check that the headless GraphQL endpoints work as expected', () => { it('C1835263: Validate that an order can be placed through GraphQL ', () => { - cy.visit('opt/mollie-pwa.html'); + cy.visit('opt/mollie-pwa-graphql.html'); cy.get('[data-key="start-checkout-process"]').click(); diff --git a/Test/End-2-end/cypress/e2e/magento/api/rest-place-order.cy.js b/Test/End-2-end/cypress/e2e/magento/api/rest-place-order.cy.js new file mode 100644 index 00000000000..71328dbebcf --- /dev/null +++ b/Test/End-2-end/cypress/e2e/magento/api/rest-place-order.cy.js @@ -0,0 +1,49 @@ +/* + * Copyright Magmodules.eu. All rights reserved. + * See COPYING.txt for license details. + */ + +import Cookies from "Services/Cookies"; +import MollieHostedPaymentPage from "Pages/mollie/MollieHostedPaymentPage"; +import CheckoutSuccessPage from "Pages/frontend/CheckoutSuccessPage"; +import OrdersPage from "Pages/backend/OrdersPage"; + +const cookies = new Cookies(); +const mollieHostedPaymentPage = new MollieHostedPaymentPage(); +const checkoutSuccessPage = new CheckoutSuccessPage(); +const ordersPage = new OrdersPage(); + +describe('Check that the headless REST endpoints work as expected', () => { + it('C1988313: Validate that an order can be placed through REST', () => { + cy.visit('opt/mollie-pwa-rest.html'); + + cy.get('[data-key="start-checkout-process"]').click(); + + cy.get('[data-key="mollie_methods_ideal"]').click(); + + cy.get('[data-key="place-order-action"]').click(); + + cy.get('[data-key="order-id"]').then((element) => { + cy.wrap(element.text()).as('order-id'); + }); + + cookies.disableSameSiteCookieRestrictions(); + + cy.get('[data-key="redirect-url"]').then((element) => { + cy.visit(element.attr('href')); + }); + + mollieHostedPaymentPage.selectFirstIssuer(); + mollieHostedPaymentPage.selectStatus('paid'); + + checkoutSuccessPage.assertThatOrderSuccessPageIsShown(); + + cy.backendLogin(false); + + cy.get('@order-id').then((orderId) => { + ordersPage.openOrderById(orderId); + }); + + ordersPage.assertOrderStatusIs('Processing'); + }); +}) diff --git a/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html b/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html new file mode 100644 index 00000000000..fcea4e2c5e7 --- /dev/null +++ b/Test/End-2-end/cypress/fixtures/mollie-pwa-graphql.html @@ -0,0 +1,834 @@ + + + + +
payment/mollie_general/type
)
+ Order ID: {{ orderId }}
+1. Please open this url and select a payment status (or not):
+ {{ redirectUrl }}2. When you have opened the url, click here to get the payment status:
+ + +payment/mollie_general/type
)
+ Order ID: {{ orderId }}
+1. Please open this url and select a payment status (or not):
+ {{ redirectUrl }}2. When you have opened the url, check the status in the backend of your webshop.
+