-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: Cypress test for the paymentlink
- Loading branch information
1 parent
0a8e772
commit b405c33
Showing
5 changed files
with
108 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 49 additions & 4 deletions
53
Test/End-2-end/cypress/e2e/magento/methods/paymentlink.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,54 @@ | ||
describe('Check the functionality of the payment linkt method', () => { | ||
it('Is possible to place an order using payment link', () => { | ||
import MollieHostedPaymentPage from "Pages/mollie/MollieHostedPaymentPage"; | ||
import CheckoutSuccessPage from "Pages/frontend/CheckoutSuccessPage"; | ||
import OrdersPage from "Pages/backend/OrdersPage"; | ||
import OrdersCreatePage from "Pages/backend/OrdersCreatePage"; | ||
import Cookies from "Services/Cookies"; | ||
|
||
const checkoutSuccessPage = new CheckoutSuccessPage(); | ||
const mollieHostedPaymentPage = new MollieHostedPaymentPage(); | ||
const ordersPage = new OrdersPage(); | ||
const ordersCreatePage = new OrdersCreatePage(); | ||
const cookies = new Cookies(); | ||
|
||
describe('Placing orders from the backend', () => { | ||
it('C895380: Validate that the ecommerce admin can submis an order in the backend and mark as "Paid" ', () => { | ||
cy.backendLogin(); | ||
|
||
cy.visit('/admin/sales/order'); | ||
ordersCreatePage.createNewOrderFor('Veronica Costello'); | ||
|
||
ordersCreatePage.addProduct('Erika Running Short-32-Red'); | ||
|
||
ordersCreatePage.selectShippingMethod('Fixed'); | ||
|
||
// 2.3.7 needs a double click to select the payment method, not sure why. | ||
cy.get('[for="p_method_mollie_methods_paymentlink"]').click().click(); | ||
|
||
cy.get('#mollie_methods_paymentlink_methods').select([ | ||
'banktransfer', | ||
'creditcard', | ||
'ideal', | ||
]); | ||
|
||
cookies.disableSameSiteCookieRestrictions(); | ||
|
||
ordersCreatePage.submitOrder(); | ||
|
||
cy.get('.mollie-copy-url') | ||
.invoke('attr', 'data-url') | ||
.then(href => { | ||
cy.visit(href); | ||
}); | ||
|
||
mollieHostedPaymentPage.selectPaymentMethod('iDEAL'); | ||
mollieHostedPaymentPage.selectFirstIssuer(); | ||
mollieHostedPaymentPage.selectStatus('paid'); | ||
|
||
checkoutSuccessPage.assertThatOrderSuccessPageIsShown(); | ||
|
||
cy.get('@order-id').then((orderId) => { | ||
ordersPage.openOrderById(orderId); | ||
}); | ||
|
||
cy.contains('Create New Order').click(); | ||
ordersPage.assertOrderStatusIs('Processing'); | ||
}); | ||
}); |
36 changes: 36 additions & 0 deletions
36
Test/End-2-end/cypress/support/pages/backend/OrdersCreatePage.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export default class OrdersCreatePage { | ||
createNewOrderFor(customerName) { | ||
cy.visit('/admin/sales/order'); | ||
|
||
cy.contains('Create New Order').click(); | ||
|
||
cy.contains(customerName).click(); | ||
} | ||
|
||
addProduct(productName) { | ||
cy.get('.action-add').contains('Add Products').click(); | ||
|
||
cy.contains(productName).click(); | ||
|
||
cy.get('.action-add').contains('Add Selected Product(s) to Order').click(); | ||
cy.get('.order-tables').should('contain', productName); | ||
} | ||
|
||
selectShippingMethod(method) { | ||
cy.get('#order-shipping-method-summary').contains('Get shipping methods and rates').click(); | ||
|
||
cy.get('#order-shipping-method-choose').contains(method).click(); | ||
} | ||
|
||
submitOrder() { | ||
cy.get('.actions .save').contains('Submit Order').click(); | ||
|
||
cy.url().should('include', 'admin/sales/order/view/order_id/'); | ||
|
||
cy.contains('You created the order.'); | ||
|
||
cy.get('[name="order_id"]').invoke('val').then(id => { | ||
cy.wrap(id).as('order-id'); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters