Skip to content

Commit

Permalink
small updates for test code
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonasB88 committed Feb 26, 2024
1 parent d4e3835 commit 35da04a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/ps1785/03_mollie.ps1785.PaymentTestsOrdersAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ it('C1765085: Billie Checkouting [Orders API]', () => {
it('C1765086: Billie Order Shipping, Refunding [Orders API]', () => {
cy.OrderShippingRefundingOrdersAPI()
})
it('C1860460: Pay with Klarna UK Checkouting [Orders API]', () => { // currently not supported for PS, skipping temporary
it('C1860460: Pay with Klarna UK Checkouting [Orders API]', () => {
cy.visit('/en/order-history')
cy.contains('Reorder').click()
cy.contains('UK').click({force:true})
Expand All @@ -333,7 +333,7 @@ it('C1860460: Pay with Klarna UK Checkouting [Orders API]', () => { // currently
cy.get('[class="button form__button"]').click()
cy.get('#content-hook_order_confirmation > .card-block').should('be.visible')
});
it.only('C1860461: Pay with Klarna UK Order Shipping, Refunding [Orders API]', () => { // currently not supported for PS, skipping temporary
it('C1860461: Pay with Klarna UK Order Shipping, Refunding [Orders API]', () => { // currently not supported for PS, skipping temporary
cy.OrderShippingRefundingOrdersAPI()
})
})
26 changes: 5 additions & 21 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Cypress.Commands.add("ConfOrdersAPI1784", () => {
})
Cypress.Commands.add("ConfPaymentsAPI1784", () => {

const paymentMethods = ["giropay", "eps", "przelewy24", "kbc", "belfius", "bancontact", "sofort", "creditcard", "ideal", "banktransfer", "paypal", "applepay", "klarna"];
const paymentMethods = ["giropay", "eps", "przelewy24", "kbc", "belfius", "bancontact", "creditcard", "ideal", "banktransfer", "paypal", "applepay", "klarna"];

// Iterate through the paymentMethods array using forEach
paymentMethods.forEach(method => {
Expand Down Expand Up @@ -87,14 +87,7 @@ Cypress.Commands.add("OrderRefundingShippingOrdersAPI", () => {
cy.visit('/admin1/index.php?controller=AdminOrders')
cy.get(':nth-child(1) > .column-payment').click()
cy.scrollTo('bottom')
//Refunding dropdown in React
cy.get('.btn-group-action > .btn-group > .dropdown-toggle').eq(0).then(($body) => {
if ($body.length > 0) {
// If the element doesn't exist, skip the test
cy.log('Element not found possibly due to to the distractions from the Mollie API. Skipping the Test')
console.log('Element not found possibly due to to the distractions from the Mollie API. Skipping the Test')
return
} else {
// Refunding dropdown in React
cy.get('.btn-group-action > .btn-group > .dropdown-toggle').eq(0).click()
cy.get('[role="button"]').eq(2).click()
cy.get('[class="swal-button swal-button--confirm"]').click()
Expand All @@ -109,21 +102,13 @@ Cypress.Commands.add("OrderRefundingShippingOrdersAPI", () => {
cy.get(':nth-child(2) > .swal-button').click()
cy.get('#mollie_order > :nth-child(1) > .alert').contains('Shipment was made successfully!')
cy.get('[class="alert alert-success"]').should('be.visible')
}
})
// Add more actions as needed
})
Cypress.Commands.add("OrderShippingRefundingOrdersAPI", () => {
cy.visit('/admin1/index.php?controller=AdminOrders')
cy.get(':nth-child(1) > .column-payment').click()
cy.scrollTo('bottom')
//Shipping button in React
cy.get('.btn-group > [title=""]').then(($body) => {
if ($body.length > 0) {
// If the element doesn't exist, skip the test
cy.log('Element not found possibly due to to the distractions from the Mollie API. Skipping the Test')
console.log('Element not found possibly due to to the distractions from the Mollie API. Skipping the Test')
return
} else {
// Shipping button in React
cy.get('.btn-group > [title=""]').eq(0).click()
cy.get('[class="swal-button swal-button--confirm"]').click()
cy.get('.swal-modal').should('exist')
Expand All @@ -138,8 +123,7 @@ Cypress.Commands.add("OrderShippingRefundingOrdersAPI", () => {
cy.get('[role="button"]').eq(2).click()
cy.get('[class="swal-button swal-button--confirm"]').click()
cy.get('[class="alert alert-success"]').should('be.visible')
}
})
// Add more actions as needed
})
Cypress.Commands.add("OrderRefundingPartialPaymentsAPI", () => {
cy.visit('/admin1/index.php?controller=AdminOrders')
Expand Down

0 comments on commit 35da04a

Please sign in to comment.