Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions tests/integration-test/cypress/e2e/PageObjects/objects.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,27 @@ class Order {
cy.get('.checkout-button').click()
}

surcharge_payment(CC_TERMINAL_NAME) {

cy.contains(CC_TERMINAL_NAME).click({ force: true })
//billing details
cy.get('#billing_first_name').clear().type('Test')
cy.get('#billing_last_name').clear().type('Person-dk')
cy.get('#billing_address_1').clear().type('65 Nygårdsvej')
cy.get('#billing_postcode').clear().type('2100')
cy.get('#billing_city').clear().type('København Ø')
cy.get('#billing_phone').clear().type('33 13 71 12')
cy.get('#billing_email').clear().type('customer@email.dk')
cy.get('#place_order').click().wait(3000)
cy.get('body').should('contain.text', 'surcharge')
cy.get('[id=creditCardNumberInput]').type('4111111111111111')
cy.get('#emonth').select('12')
cy.get('#eyear').select('2025')
cy.get('#cvcInput').type('123')
cy.get('#cardholderNameInput').type('testname')
cy.get('#pensioCreditCardPaymentSubmitButton').click().wait(2000)
cy.get('.entry-title').should('include.text', 'Order received')
}
}

export default Order
36 changes: 36 additions & 0 deletions tests/integration-test/cypress/e2e/examples/payments.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,42 @@ describe('WooCommerce', function () {
})
})

it('Surcharge Payment', function () {

const ord = new Order()
ord.clrcookies()
ord.visit()
cy.get('body').then(($body) => {
if ($body.text().includes('€')) {
ord.admin()
ord.change_currency_to_DKK()
ord.visit()
}
})
ord.addproduct()
cy.fixture('config').then((admin) => {
if (admin.CC_TERMINAL_NAME != "") {
cy.get('body').then(($a) => {
if ($a.find("label:contains('" + admin.CC_TERMINAL_NAME + "')").length) {
ord.surcharge_payment(admin.CC_TERMINAL_NAME)
ord.admin()
ord.capture()
ord.refund()
} else {
cy.log(admin.CC_TERMINAL_NAME + ' not found in page')
this.skip()
}

})

}
else {
cy.log('CC_TERMINAL_NAME skipped')
this.skip()
}
})
})

it('iDEAL Payment', function () {
const ord = new Order()
ord.visit()
Expand Down