diff --git a/tests/cypress/e2e/admin.cy.js b/tests/cypress/e2e/admin.cy.js index a74c895..cd5d515 100644 --- a/tests/cypress/e2e/admin.cy.js +++ b/tests/cypress/e2e/admin.cy.js @@ -14,13 +14,13 @@ describe('KOMOJU for WooCommerce: Admin', () => { it('lets me add and remove specialized payment gateways', () => { cy.setupKomoju(['konbini', 'credit_card']); - cy.contains('Payments').click(); + cy.clickPaymentTab(); cy.get('.form-table').should('include.text', 'Komoju - Konbini'); cy.get('.form-table').should('include.text', 'Komoju - Credit Card'); cy.setupKomoju(['paypay', 'linepay']); - cy.contains('Payments').click(); + cy.clickPaymentTab(); cy.get('.form-table').should('not.include.text', 'Komoju - Konbini'); cy.get('.form-table').should('not.include.text', 'Komoju - Credit Card'); diff --git a/tests/cypress/e2e/checkout.cy.js b/tests/cypress/e2e/checkout.cy.js index 5a60bc4..6da7f9b 100644 --- a/tests/cypress/e2e/checkout.cy.js +++ b/tests/cypress/e2e/checkout.cy.js @@ -10,7 +10,7 @@ describe('KOMOJU for WooCommerce: Checkout', () => { it('lets me make a payment using the specialized konbini gateway', () => { cy.setupKomoju(['konbini', 'credit_card']); - cy.contains('Payments').click(); + cy.clickPaymentTab(); cy.enablePaymentGateway('komoju_konbini'); cy.goToStore(); cy.addItemAndProceedToCheckout(); @@ -38,7 +38,7 @@ describe('KOMOJU for WooCommerce: Checkout', () => { it('lets me make a payment using the specialized credit card gateway', () => { cy.setupKomoju(['credit_card']); - cy.contains('Payments').click(); + cy.clickPaymentTab(); cy.enablePaymentGateway('komoju_credit_card'); cy.contains('Save changes').click(); cy.goToStore(); @@ -62,7 +62,7 @@ describe('KOMOJU for WooCommerce: Checkout', () => { it('lets me use the specialized WebMoney gateway, despite it being unsupported by Fields', () => { cy.setupKomoju(['credit_card', 'konbini', 'web_money']); - cy.contains('Payments').click(); + cy.clickPaymentTab(); cy.enablePaymentGateway('komoju_web_money'); cy.contains('Save changes').click(); cy.goToStore(); @@ -83,7 +83,7 @@ describe('KOMOJU for WooCommerce: Checkout', () => { it('lets me turn checkout icons on and off', () => { cy.setupKomoju(['konbini', 'credit_card']); - cy.contains('Payments').click(); + cy.clickPaymentTab(); cy.enablePaymentGateway('komoju_credit_card'); cy.get('[data-gateway_id="komoju_credit_card"] a.button') diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index d932b5c..71599ac 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -204,4 +204,8 @@ Cypress.Commands.add('addItemAndProceedToCheckout', () => { cy.wait(100); cy.contains('Go to checkout').click(); cy.wait(100); -}); \ No newline at end of file +}); + +Cypress.Commands.add('clickPaymentTab', () => { + cy.visit('/wp-admin/admin.php?page=wc-settings&tab=checkout'); +});