diff --git a/tests/e2e/Error Handling/_error_handling.spec.js b/tests/e2e/Error Handling/_error_handling.spec.js deleted file mode 100644 index d59ed7578..000000000 --- a/tests/e2e/Error Handling/_error_handling.spec.js +++ /dev/null @@ -1,59 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../Shared/base-test'); -const {getLogByName} = require("../Shared/wooUtils"); -const assert = require('assert'); - -test.describe(' - Error Handling', () => { - let log; - test.beforeAll(async () => { - const searchString = `mollie-payments-for-woocommerce`; - log = await getLogByName(searchString, __dirname); - }); - - const testData = [ - { - testId: "C419987", - mollieStatus: "Paid", - searchLine: "onWebhookPaid processing paid order via Mollie plugin fully completed" - }, - { - testId: "C420052", - mollieStatus: "Authorized", - searchLine: "onWebhookAuthorized called for order", - }, - { - testId: "C420052", - mollieStatus: "Open", - searchLine: "Customer returned to store, but payment still pending for order", - }, - { - testId: "C419988", - mollieStatus: "Failed", - searchLine: "onWebhookFailed called for order", - }, - { - testId: "C420050", - mollieStatus: "Canceled", - searchLine: "Pending payment", - }, - { - testId: "C420051", - mollieStatus: "Expired", - searchLine: "Pending payment", - }, - { - testId: "C420054", - mollieStatus: "Pending", - wooStatus: "Pending payment", - }, - ]; - - testData.forEach(({ testId, mollieStatus, searchLine }) => { - test(`[${testId}] Validate that "${mollieStatus} transaction is logged"`, async ({ page, products, context }) => { - const pattern = new RegExp(searchLine, 'g'); - console.log(pattern) - const containsPattern = pattern.test(log); - assert.ok(containsPattern, 'The file content does not contain the desired string'); - }); - }); -}); diff --git a/tests/e2e/Mollie Settings tab/General/_mollie_settings_tab_general.spec.js b/tests/e2e/Mollie Settings tab/General/_mollie_settings_tab_general.spec.js deleted file mode 100644 index 50ffadce2..000000000 --- a/tests/e2e/Mollie Settings tab/General/_mollie_settings_tab_general.spec.js +++ /dev/null @@ -1,72 +0,0 @@ -const {expect} = require('@playwright/test'); -const {test} = require('../../Shared/base-test'); -const {resetSettings, insertAPIKeys} = require("../../Shared/mollieUtils"); - -test.describe('_Mollie Settings tab - General', () => { - test.beforeEach(async ({page}) => { - await page.goto('wp-admin/admin.php?page=wc-settings&tab=mollie_settings'); - }); - - -test('[C420150] Validate that Mollie General section is displayed per UI design', async ({page}) => { - await expect(await page.isVisible('text=Mollie Settings')).toBeTruthy(); - await expect(await page.isVisible('text=General')).toBeTruthy(); - await expect(await page.isVisible('text=Live API Key')).toBeTruthy(); - }); -test('[C3333] Validate that the ecommerce admin have access to Documentation/Support through the Setting page', async ({page, context}) => { - await page.click('text=Plugin Documentation'); - await expect(page.url()).toBe('https://github.com/mollie/WooCommerce/wiki'); - await page.goto('wp-admin/admin.php?page=wc-settings&tab=mollie_settings'); - await page.click('text=Contact Support'); - await expect(page.url()).toBe('https://www.mollie.com/contact/merchants'); - }); - -test('[C3511] Validate an error message is returned when the test key is not valid/empty', async ({page}) => { - await resetSettings(page); - await page.goto('wp-admin/admin.php?page=wc-settings&tab=mollie_settings'); - await expect(await page.isVisible('text=Communicating with Mollie failed')).toBeTruthy(); - }); -test('[C3510] Validate that test/live keys are valid', async ({page}) => { - await insertAPIKeys(page); - expect(await page.isVisible('text=Connected')).toBeTruthy(); - }); - - -test('[C3330] Validate that the ecommerce admin can activate debug mode', async ({page}) => { - await page.goto('wp-admin/admin.php?page=wc-settings&tab=mollie_settings'); - await expect(await page.isVisible('text=Enable test mode')).toBeTruthy(); - //expect enable test mode checkbox to be checked - await expect(await page.getByRole('group', { name: 'Enable test mode' }).locator('label')).toBeChecked(); - }); - - - -test.skip('[C3507] Validate the connection to Mollie OAuth is working as expected when consent is approved', async ({page}) => { - // Your code here... - }); - - -test.skip('[C3508] Validate no connection is created using Mollie OAuth when consent is denied', async ({page}) => { - // Your code here... - }); - - -test.skip('[C3509] Validate that the connection through hosted onboarding is working', async ({page}) => { - // Your code here... - }); - -test.skip('[C3512] Validate all payment methods are displayed and only activate the ones approved in Mollie dashboard', async ({page}) => { - // Your code here... - }); - - -test.skip('[C3513] Validate when a payment method is activated in the ecommerce platform that this one also gets activated in Mollie dashboard', async ({page}) => { - // Your code here... - }); - - -test.skip('[C3514] Validate that only the activated payment methods in Mollie dashboard are displayed in the ecommerce platform', async ({page}) => { - // Your code here... - }); - -}); diff --git a/tests/e2e/Mollie Settings tab/Mollie Components/_mollie_settings_tab_mollie_components.spec.js b/tests/e2e/Mollie Settings tab/Mollie Components/_mollie_settings_tab_mollie_components.spec.js deleted file mode 100644 index 4d5f4f7a2..000000000 --- a/tests/e2e/Mollie Settings tab/Mollie Components/_mollie_settings_tab_mollie_components.spec.js +++ /dev/null @@ -1,35 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Mollie Settings tab - Mollie Components', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -test.skip('[C420151] Validate that Mollie Components section is displayed per UI design', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C420144] Validate base style change of Mollie components on classic checkout', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C420145] Validate base style change of Mollie components on block checkout', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C420146] Validate invalid status style change of Mollie components on block checkout', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C420147] Validate invalid status style change of Mollie components on classic checkout', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings.spec.js deleted file mode 100644 index 7f393d7bf..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings.spec.js +++ /dev/null @@ -1,82 +0,0 @@ -const {test} = require('../../Shared/base-test'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {normalizedName} = require("../../Shared/gateways"); -const {resetSettings, insertAPIKeys, setOrderAPI, beforePlacingOrder} = require("../../Shared/mollieUtils"); -const {addProductToCart, emptyCart} = require("../../Shared/wooUtils"); -const {expect} = require("@playwright/test"); - -test.describe('_Mollie Settings tab - Payment method settings', () => { - // Set up parameters or perform actions before all tests - test.beforeAll(async ({browser, products}) => { - const page = await browser.newPage(); - await addProductToCart(page, products.simple.sku); - }); - test.afterAll(async ({browser, products, gateways}) => { - const page = await browser.newPage(); - await emptyCart(page); - }); - - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.bancontact; - context.tabUrl = gatewaySettingsRoot + context.method.id; - context.title = normalizedName(context.method.defaultTitle); - await page.goto(context.tabUrl); - }); - -test('[C3325] Validate that the ecommerce admin can change the payment name', async ({page, context}) => { - await page.locator(`input[name="mollie_wc_gateway_${context.method.id}_title"]`).fill(`${context.title} edited`); - await page.click('text=Save changes'); - await page.goto('/checkout'); - await expect(await page.isVisible(`text=${title} edited`)).toBeTruthy(); - }); - -test('[C3326] Validate that the ecommerce admin can change the payment logo', async ({page, context}) => { - await page.getByLabel('Enable custom logo').check(); - await page.click('text=Save changes'); - await page.getByLabel('Upload custom logo').setInputFiles('tests/e2e/Shared/test-logo.png'); - await page.click('text=Save changes'); - await page.goto('/checkout'); - const url = await page.$eval(`text=${context.title} edited >> img`, img => img.src); - await expect(url).toContain(`test-logo.png`) - }); - -test('[C3327] Validate that the ecommerce admin can change the payment description', async ({page}) => { - await page.locator(`textarea[name="mollie_wc_gateway_${context.method.id}_description"]`).fill(`${context.title} description edited`); - await page.click('text=Save changes'); - await page.goto('/checkout'); - await expect(await page.isVisible(`text=${context.title} description edited`)).toBeTruthy(); - }); - -test('[C420329] Validate selling only to specific countries', async ({page, context}) => { - const previousValue = await page.getByRole('link', {name: 'Select none'}).isVisible(); - if (previousValue) { - await page.click('text=Select none'); - await page.click('text=Save changes'); - } - await page.locator('[placeholder="Choose countries…"]').click(); - await page.locator('[placeholder="Choose countries…"]').fill('spa'); - await page.locator('li[role="option"]:has-text("Spain")').click(); - await page.click('text=Save changes'); - await page.goto('/checkout'); - await expect(await page.getByText(`${context.title} edited`).count()).toEqual(0); - - }); - -test.skip('[C420330] Validate that order expiry time can be activated and changed', async ({page}) => { - await page.getByLabel('Activate expiry time setting').check(); - await page.getByLabel('Expiry time', {exact: true}).fill('1'); - await page.click('text=Save changes'); - await expect(await page.getByLabel('Activate expiry time setting').isChecked()).toBeTruthy(); - await expect(await page.getByLabel('Expiry time', {exact: true})).toHaveValue('1'); - }); - -test.skip('[C420331] Validate that initial order status can be set to "On Hold"', async ({page}) => { - await expect(await page.getByRole('combobox', {name: 'Initial order status'})).toHaveValue('on-hold'); - }); - -test.skip('[C420332] Validate that initial order status can be set to "Pending payment"', async ({page}) => { - await page.getByLabel('Initial order status').selectOption('pending'); - await page.click('text=Save changes'); - await expect(await page.getByRole('combobox', {name: 'Initial order status'})).toHaveValue('pending'); - }); -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_apple_pay_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_apple_pay_settings.spec.js deleted file mode 100644 index afaba2609..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_apple_pay_settings.spec.js +++ /dev/null @@ -1,68 +0,0 @@ -const {expect, webkit} = require('@playwright/test'); -const {test} = require('../../Shared/base-test'); -const {settingsNames, classicCheckoutTransaction} = require('../../Shared/mollieUtils'); -const {sharedUrl: {mollieSettingsTab, gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting} = require("../../Shared/wpUtils"); - -test.describe('_Mollie Settings tab_Payment method settings - Apple Pay settings', () => { - // Force Webkit browser for all tests within this suite - test.use(webkit); - -test.skip('[C420309] Validate Apple Pay surcharge with no Fee, no fee will be added to total', async ({page, products, gateways}) => { - //there seems to be a problem with the automation of the Apple Pay payment method tests - const method = gateways.applepay; - const tabUrl = gatewaySettingsRoot + method.id; - await page.goto(tabUrl); - const settingName = settingsNames.surcharge(method.id); - await selectOptionSetting(page, settingName, tabUrl, 'no_fee'); - const result = await classicCheckoutTransaction(page, products.simple, method) - expect(result.amount).toBe(products.simple.price); - }); - - -test.skip('[C420310] Validate fixed fee for Apple Pay surcharge', async ({page}) => { - // Your code here... - }); - - -test.skip('[C420311] Validate percentage fee for Apple Pay surcharge', async ({page}) => { - // Your code here... - }); - - -test.skip('[C420312] Validate fixed fee and percentage for Apple Pay surcharge', async ({page}) => { - // Your code here... - }); - - -test.skip('[C420313] Validate surcharge for Apple Pay when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({page}) => { - // - }); - - -test.skip('[C420314] Validate surcharge for Apple Pay when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({page}) => { - // Your code here... - }); - - -test.skip('[C420315] Validate surcharge for Apple Pay when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({page}) => { - // Your code here... - }); - - -test.skip('[C420316] Validate Apple Pay surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({page}) => { - // Your code here... - }); - - -test.skip('[C420317] Validate surcharge for Apple Pay when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({page}) => { - // Your code here... - }); - - -test.skip('[C420318] Validate surcharge for Apple Pay when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({page}) => { - // Your code here... - }); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_bancontact_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_bancontact_settings.spec.js deleted file mode 100644 index 0838ffb93..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_bancontact_settings.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - setOrderAPI, - insertAPIKeys, - resetSettings, - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -// Set up parameters or perform actions before all tests -test.beforeAll(async ({browser}) => { - // Create a new page instance - const page = await browser.newPage(); - // Reset to the default state - await resetSettings(page); - await insertAPIKeys(page); - // Orders API - await setOrderAPI(page); -}); - -test.describe('_Mollie Settings tab_Payment method settings - Bancontact settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.bancontact; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - -test('[C129502] Validate Bancontact surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - -test('[C129503] Validate fixed fee for Bancontact surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - -test('[C129504] Validate percentage fee for Bancontact surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - -test('[C129505] Validate fixed fee and percentage for Bancontact surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - -test('[C129506] Validate surcharge for Bancontact when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - -test('[C129798] Validate surcharge for Bancontact when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - -test('[C129799] Validate surcharge for Bancontact when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - -test('[C129800] Validate Bancontact surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - -test('[C129801] Validate surcharge for Bancontact when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - -test('[C129802] Validate surcharge for Bancontact when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - -test.skip('[C93487] Validate expiry time for Bancontact', async ({ page}) => { - // Your code here... -}); -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_belfius_direct_net_settilngs.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_belfius_direct_net_settilngs.spec.js deleted file mode 100644 index 526625ab1..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_belfius_direct_net_settilngs.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - classicCheckoutTransaction, noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting, fillNumberSettings} = require("../../Shared/wpUtils"); - -test.describe('_Mollie Settings tab_Payment method settings - Belfius Direct Net settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.belfius; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C138011] Validate Belfius Direct Net surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C138012] Validate fixed fee for Belfius Direct Net surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C138013] Validate percentage fee for Belfius Direct Net surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C138014] Validate fixed fee and percentage for Belfius Direct Net surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C138015] Validate surcharge for Belfius Direct Net when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C138016] Validate surcharge for Belfius Direct Net when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C138017] Validate surcharge for Belfius Direct Net when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C138018] Validate Belfius Direct Net surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C138019] Validate surcharge for Belfius Direct Net when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C138020] Validate surcharge for Belfius Direct Net when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_billie_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_billie_settings.spec.js deleted file mode 100644 index 816c8e0a2..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_billie_settings.spec.js +++ /dev/null @@ -1,70 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - classicCheckoutTransaction, noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting, fillNumberSettings} = require("../../Shared/wpUtils"); - -test.describe('_Mollie Settings tab_Payment method settings - Billie settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.billie; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test.skip('[C354664] Validate Billie surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C354665] Validate fixed fee for Billie surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C354666] Validate percentage fee for Billie surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C354667] Validate fixed fee and percentage for Billie surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C354668] Validate surcharge for Billie when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C354669] Validate surcharge for Billie when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C354670] Validate surcharge for Billie when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test.skip('[C354671] Validate Billie surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C354672] Validate surcharge for Billie when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C354673] Validate surcharge for Billie when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_credit_card_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_credit_card_settings.spec.js deleted file mode 100644 index c860cd084..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_credit_card_settings.spec.js +++ /dev/null @@ -1,162 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - classicCheckoutTransaction -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting, fillNumberSettings} = require("../../Shared/wpUtils"); - -test.describe('_Mollie Settings tab_Payment method settings - Credit card settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.creditcard; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test.skip('[C3331] Validate that the ecommerce admin can activate the use of Mollie Components', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C3730] Validate that the ecommerce admin has activated Mollie Components by default for new installations', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C89350] Validate Credit card surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'no_fee'); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = result.totalAmount.slice(0, -1).trim(); - let expected = products.simple.price.slice(0, -1).trim(); - expect(expected).toEqual(total); -}); - - -test('[C89351] Validate percentage fee for Credit card surcharge', async ({ page, products, context}) => { - const fee = 10; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'percentage'); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page,percentageFeeSetting, context.tabUrl, fee); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^d.-]/g, "")); - let expected = productPrice + (productPrice * fee/100); - expect(total).toEqual(expected); -}); - - -test('[C89352] Validate fixed fee and percentage for Credit card surcharge', async ({ page, products, context}) => { - const fee = 10; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee_percentage'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page,fixedFeeSetting, context.tabUrl, fee); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page,percentageFeeSetting, context.tabUrl, fee); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^d.-]/g, "")); - let expected = productPrice + fee + (productPrice * fee/100); - expect(total).toEqual(expected); -}); - - -test('[C89353] Validate Credit card surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - const fee = 10; - const limit = 30; - const productQuantity = 2; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page,fixedFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page,limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^d.-]/g, "")); - let expected = parseFloat(products.simple.price.replace(",", ".").replace(/[^d.-]/g, "")) * productQuantity; - expect(total).toEqual(expected); -}); - - -test('[C89354] Validate surcharge for Credit card when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - const fee = 10; - const limit = 30; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page,fixedFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page,limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^d.-]/g, "")); - let expected = parseFloat(products.simple.price.replace(",", ".").replace(/[^d.-]/g, "")) + fee; - expect(total).toEqual(expected); -}); - - -test('[C89355] Validate surcharge for Credit card when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - const fee = 10; - const limit = 30; - const productQuantity = 2; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee_percentage'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page,fixedFeeSetting, context.tabUrl, fee); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page,percentageFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page,limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^d.-]/g, "")) * productQuantity; - expect(total).toEqual(productPrice); -}); - - -test('[C89356] Validate surcharge for Credit card when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - const fee = 10; - const limit = 30; - const productQuantity = 2; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'percentage'); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page,percentageFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page,limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^d.-]/g, "")) * productQuantity; - expect(total).toEqual(productPrice); -}); - - -test.skip('[C89357] Validate surcharge for Credit card if merchant change currency in store, currency is also changed in surcharge section for Mollie payment method', async ({ page}) => { - // Your code here... -}); - - -test('[C94865] Validate fixed fee for Credit card surcharge', async ({ page, products, context}) => { - const fee = 10; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page,fixedFeeSetting, context.tabUrl, fee); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^d.-]/g, "")); - let expected = parseFloat(products.simple.price.replace(",", ".").replace(/[^d.-]/g, "")) + fee; - expect(total).toEqual(expected); -}); - - -test.skip('[C100198] Validate surcharge for Credit card when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C100199] Validate surcharge for Credit card when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C94864] Validate expiry time for Credit card', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_eps_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_eps_settings.spec.js deleted file mode 100644 index 7f6c5fde1..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_eps_settings.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - classicCheckoutTransaction, noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting, fillNumberSettings} = require("../../Shared/wpUtils"); -const {expect} = require("@playwright/test"); - -test.describe('_Mollie Settings tab_Payment method settings - EPS settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.eps; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C133658] Validate EPS surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C133659] Validate fixed fee for EPS surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C133660] Validate percentage fee for EPS surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C133661] Validate fixed fee and percentage for EPS surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C133662] Validate surcharge for EPS when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C133663] Validate surcharge for EPS when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C133664] Validate surcharge for EPS when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C133665] Validate EPS surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C133666] Validate surcharge for EPS when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C133667] Validate surcharge for EPS when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_gift_cards_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_gift_cards_settings.spec.js deleted file mode 100644 index fae0882f0..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_gift_cards_settings.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting, fillNumberSettings} = require("../../Shared/wpUtils"); -const {expect} = require("@playwright/test"); - -test.describe('_Mollie Settings tab_Payment method settings - Gift cards settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.giftcard; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C130896] Validate Gift Card surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C130897] Validate fixed fee for Gift Card surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C130898] Validate percentage fee for Gift Card surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C130899] Validate fixed fee and percentage for Gift Card surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C130900] Validate surcharge for Gift Card when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C130901] Validate surcharge for Gift Card when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C130902] Validate surcharge for Gift Card when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C130903] Validate Gift Card surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C130904] Validate surcharge for Gift Card when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C130905] Validate surcharge for Gift Card when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_giropay_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_giropay_settings.spec.js deleted file mode 100644 index eae57786f..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_giropay_settings.spec.js +++ /dev/null @@ -1,71 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting, fillNumberSettings} = require("../../Shared/wpUtils"); -const {expect} = require("@playwright/test"); - -test.describe('_Mollie Settings tab_Payment method settings - Giropay settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.giropay; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C136539] Validate Giropay surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C136540] Validate fixed fee for Giropay surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C136541] Validate percentage fee for Giropay surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C136542] Validate fixed fee and percentage for Giropay surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C136543] Validate surcharge for Giropay when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C136544] Validate surcharge for Giropay when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C136545] Validate surcharge for Giropay when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C136546] Validate Giropay surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C137063] Validate surcharge for Giropay when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C137322] Validate surcharge for Giropay when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_ideal_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_ideal_settings.spec.js deleted file mode 100644 index d1d7f4b9d..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_ideal_settings.spec.js +++ /dev/null @@ -1,81 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - classicCheckoutTransaction, noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); -const {selectOptionSetting, fillNumberSettings} = require("../../Shared/wpUtils"); -const {expect} = require("@playwright/test"); - -test.describe('_Mollie Settings tab_Payment method settings - iDEAL settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.ideal; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test.skip('[C3362] Validate that the iDEAL issuer list available in payment selection', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C89358] Validate expiry time for IDEAL', async ({ page}) => { - // Your code here... -}); - - -test('[C130856] Validate iDEAL surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C130857] Validate fixed fee for iDEAL surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C130858] Validate percentage fee for iDEAL surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C130859] Validate fixed fee and percentage for iDEAL surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C130860] Validate surcharge for iDEAL when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C130861] Validate surcharge for iDEAL when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C130862] Validate surcharge for iDEAL when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C130863] Validate iDEAL surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C130864] Validate surcharge for iDEAL when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C130865] Validate surcharge for iDEAL when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_in3_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_in3_settings.spec.js deleted file mode 100644 index 40bd0f550..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_in3_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - in3 settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.in3; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test.skip('[C106908] Validate in3 surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C106909] Validate fixed fee for in3 surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C106910] Validate percentage fee for in3 surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C106911] Validate fixed fee and percentage for in3 surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C106912] Validate surcharge for in3 when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C106913] Validate surcharge for in3 when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C106914] Validate surcharge for in3 when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C106915] Validate in3 surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C106916] Validate surcharge for in3 when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C106917] Validate surcharge for in3 when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_kbc_cbc_payment_button_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_kbc_cbc_payment_button_settings.spec.js deleted file mode 100644 index 6239742a4..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_kbc_cbc_payment_button_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - KBC_CBC Payment Button settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.kbc; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C133668] Validate KBC_CBC surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C133669] Validate fixed fee for KBC_CBC surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C133670] Validate percentage fee for KBC_CBC surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C133671] Validate fixed fee and percentage for KBC_CBC surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C133672] Validate surcharge for KBC_CBC when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C133673] Validate surcharge for KBC_CBC when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C133674] Validate surcharge for KBC_CBC when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C133675] Validate KBC_CBC surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C133676] Validate surcharge for KBC_CBC when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C133677] Validate surcharge for KBC_CBC when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_later_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_later_settings.spec.js deleted file mode 100644 index ae1ecbf41..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_later_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - fixedFeeAndPercentageOverLimit, percentageFeeOverLimit, fixedFeeOverLimit, - fixedAndPercentageUnderLimit, percentageFeeUnderLimitTest, fixedFeeUnderLimitTest, fixedAndPercentageFeeTest, - percentageFeeTest, fixedFeeTest, noFeeAdded -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - Klarna Pay later settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.klarnapaylater; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C130871] Validate Klarna Pay later surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C130873] Validate fixed fee for Klarna Pay later surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C130875] Validate percentage fee for Klarna Pay later surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C130876] Validate fixed fee and percentage for Klarna Pay later surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C130880] Validate surcharge for Klarna Pay later when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C130881] Validate surcharge for Klarna Pay later when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C130882] Validate surcharge for Klarna Pay later when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C130883] Validate Klarna Pay later surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C130884] Validate surcharge for Klarna Pay later when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C130885] Validate surcharge for Klarna Pay later when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_now_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_now_settings.spec.js deleted file mode 100644 index 03d888bd6..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_now_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - fixedFeeAndPercentageOverLimit, percentageFeeOverLimit, fixedFeeOverLimit, - fixedAndPercentageUnderLimit, percentageFeeUnderLimitTest, fixedFeeUnderLimitTest, fixedAndPercentageFeeTest, - percentageFeeTest, fixedFeeTest, noFeeAdded -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - Klarna Pay Now settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.klarnapaynow; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C136519] Validate Klarna Pay Now surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C136520] Validate fixed fee for Klarna Pay Now surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C136521] Validate percentage fee for Klarna Pay Now surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C136522] Validate fixed fee and percentage for Klarna Pay Now surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C136523] Validate surcharge for Klarna Pay Now when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C136524] Validate surcharge for Klarna Pay Now when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C136525] Validate surcharge for Klarna Pay Now when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C136526] Validate Klarna Pay Now surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C136527] Validate surcharge for Klarna Pay Now when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C136528] Validate surcharge for Klarna Pay Now when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_slice_it_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_slice_it_settings.spec.js deleted file mode 100644 index efb7ad8e6..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_slice_it_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - fixedFeeAndPercentageOverLimit, percentageFeeOverLimit, fixedFeeOverLimit, - fixedAndPercentageUnderLimit, percentageFeeUnderLimitTest, fixedFeeUnderLimitTest, fixedAndPercentageFeeTest, - percentageFeeTest, fixedFeeTest, noFeeAdded -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - Klarna Slice it settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.klarnasliceit; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C127227] Validate Klarna Slice it surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C127817] Validate fixed fee for Klarna Slice it surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C127818] Validate percentage fee for Klarna Slice it surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C127819] Validate fixed fee and percentage for Klarna Slice it surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C127820] Validate surcharge for Klarna Slice it when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C127821] Validate surcharge for Klarna Slice it when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C127822] Validate surcharge for Klarna Slice it when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C128597] Validate Klarna Slice it surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C129200] Validate surcharge for Klarna Slice it when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C106918] Validate surcharge for Klarna Slice it when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_mybank_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_mybank_settings.spec.js deleted file mode 100644 index 9d9e9814c..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_mybank_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - fixedFeeAndPercentageOverLimit, percentageFeeOverLimit, fixedFeeOverLimit, - fixedAndPercentageUnderLimit, percentageFeeUnderLimitTest, fixedFeeUnderLimitTest, fixedAndPercentageFeeTest, - percentageFeeTest, fixedFeeTest, noFeeAdded -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - MyBank settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.mybank; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C420319] Validate MyBank surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C420320] Validate fixed fee for MyBank surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C420321] Validate percentage fee for MyBank surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C420322] Validate fixed fee and percentage for MyBank surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C420323] Validate surcharge for MyBank when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C420324] Validate surcharge for MyBank when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C420325] Validate surcharge for MyBank when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test.skip('[C420326] Validate MyBank surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C420327] Validate surcharge for MyBank when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C420328] Validate surcharge for MyBank when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paypal_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paypal_settings.spec.js deleted file mode 100644 index 0381a1b6a..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paypal_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - PayPal settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.paypal; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C130886] Validate PayPal surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C130887] Validate fixed fee for PayPal surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C130888] Validate percentage fee for PayPal surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C130889] Validate fixed fee and percentage for PayPal surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C130890] Validate surcharge for Klarna Pay later when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C130891] Validate surcharge for PayPal when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C130892] Validate surcharge for PayPal when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C130893] Validate PayPal surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C130894] Validate surcharge for PayPal when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C130895] Validate surcharge for PayPal when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paysafecard_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paysafecard_settings.spec.js deleted file mode 100644 index 74c67ccfb..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paysafecard_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - paysafecard settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.paysafecard; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C420131] Validate paysafecard surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C420132] Validate fixed fee for paysafecard surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C420133] Validate percentage fee for paysafecard surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C420134] Validate fixed fee and percentage for paysafecard surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C420135] Validate surcharge for paysafecard when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C420136] Validate surcharge for paysafecard when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C420137] Validate surcharge for paysafecard when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test.skip('[C420138] Validate paysafecard surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C420139] Validate surcharge for paysafecard when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C420140] Validate surcharge for paysafecard when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_przelewy24_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_przelewy24_settings.spec.js deleted file mode 100644 index 6af7248a6..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_przelewy24_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - Przelewy24 settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.przelewy24; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C129803] Validate Przelewy24 surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C129804] Validate fixed fee for Przelewy24 surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C129805] Validate percentage fee for Przelewy24 surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C129806] Validate fixed fee and percentage for Przelewy24 surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C129807] Validate surcharge for Przelewy24 when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C129808] Validate surcharge for Przelewy24 when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C129809] Validate surcharge for Przelewy24 when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C129810] Validate Przelewy24 surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C129811] Validate surcharge for Przelewy24 when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C129812] Validate surcharge for Przelewy24 when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sepa_bank_transfer_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sepa_bank_transfer_settings.spec.js deleted file mode 100644 index 16bfdbc55..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sepa_bank_transfer_settings.spec.js +++ /dev/null @@ -1,74 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - SEPA Bank Transfer settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.banktransfer; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test.skip('[C127228] Validate expiry time for SEPA Bank Transfer', async ({ page}) => { - // Your code here... -}); - - -test('[C136529] Validate Bank Transfer surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C136530] Validate fixed fee for Bank Transfer surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C136531] Validate percentage fee for Bank Transfer surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C136532] Validate fixed fee and percentage for Bank Transfer surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C136533] Validate surcharge for Bank Transfer when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C136534] Validate surcharge for Bank Transfer when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C136535] Validate surcharge for Bank Transfer when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C136536] Validate Bank Transfer surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C136537] Validate surcharge for Bank Transfer when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C136538] Validate surcharge for Bank Transfer when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sofort_banking_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sofort_banking_settings.spec.js deleted file mode 100644 index 942e7b5e2..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sofort_banking_settings.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - SOFORT Banking settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.sofort; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test('[C129201] Validate SOFORT Banking surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C129493] Validate fixed fee for SOFORT Banking surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C129494] Validate percentage fee for SOFORT Banking it surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C129495] Validate fixed fee and percentage for SOFORT Banking surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C129496] Validate surcharge for SOFORT Banking when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C129497] Validate surcharge for SOFORT Banking when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C129498] Validate surcharge for SOFORT Banking when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C129499] Validate SOFORT Banking surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C129500] Validate surcharge for SOFORT Banking when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C129501] Validate surcharge for SOFORT Banking when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_voucher_settings.spec.js b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_voucher_settings.spec.js deleted file mode 100644 index 685c654e5..000000000 --- a/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_voucher_settings.spec.js +++ /dev/null @@ -1,79 +0,0 @@ -const { test } = require('../../Shared/base-test'); -const { - settingsNames, - noFeeAdded, fixedFeeTest, percentageFeeTest, fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, percentageFeeUnderLimitTest, fixedAndPercentageUnderLimit, fixedFeeOverLimit, - percentageFeeOverLimit, fixedFeeAndPercentageOverLimit -} = require('../../Shared/mollieUtils'); -const {sharedUrl: {gatewaySettingsRoot}} = require('../../Shared/sharedUrl'); - -test.describe('_Mollie Settings tab_Payment method settings - Voucher settings', () => { - test.beforeEach(async ({page, context, gateways}) => { - context.method = gateways.voucher; - context.tabUrl = gatewaySettingsRoot + context.method.id; - await page.goto(context.tabUrl); - context.surchargeSetting = settingsNames.surcharge(context.method.id); - }); - - -test.skip('[C3365] Validate Voucher payment method is not visible when there is no voucher product in the cart', async ({ page}) => { - // Your code here... -}); - - -test.skip('[C3366] Validate Voucher payment method is visible when there is a combination of products (voucher eligible and not eligible)', async ({ page}) => { - // Your code here... -}); - - -test('[C129813] Validate Voucher surcharge with no Fee, no fee will be added to total', async ({ page, products, context}) => { - await noFeeAdded(page, context, products); -}); - - -test('[C129814] Validate fixed fee for Voucher surcharge', async ({ page, products, context}) => { - await fixedFeeTest(page, context, products); -}); - - -test('[C129815] Validate percentage fee for Voucher surcharge', async ({ page, products, context}) => { - await percentageFeeTest(page, context, products); -}); - - -test('[C129816] Validate fixed fee and percentage for Voucher surcharge', async ({ page, products, context}) => { - await fixedAndPercentageFeeTest(page, context, products); -}); - - -test('[C129817] Validate surcharge for Voucher when is selected fixed fee for payment surcharge and surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedFeeUnderLimitTest(page, context, products); -}); - - -test('[C129818] Validate surcharge for Voucher when is selected percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await percentageFeeUnderLimitTest(page, context, products); -}); - - -test('[C129819] Validate surcharge for Voucher when is selected fixed fee and percentage for payment surcharge and Surcharge only under this limit in € is setup, surcharge will be added for total under limit', async ({ page, products, context}) => { - await fixedAndPercentageUnderLimit(page, context, products); -}); - - -test('[C129820] Validate Voucher surcharge for fixed fee if surcharge limit in € is setup, gateway fee will not be added if surcharge exceeded limit', async ({ page, products, context}) => { - await fixedFeeOverLimit(page, context, products); -}); - - -test('[C129821] Validate surcharge for Voucher when is selected percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await percentageFeeOverLimit(page, context, products); -}); - - -test('[C129822] Validate surcharge for Voucher when is selected fixed fee and percentage fee for payment surcharge and Surcharge only under this limit in € is setup, surcharge will no be added for price above limit', async ({ page, products, context}) => { - await fixedFeeAndPercentageOverLimit(page, context, products); -}); - - -}); diff --git a/tests/e2e/Plugins page/_plugins_page.spec.js b/tests/e2e/Plugins page/_plugins_page.spec.js deleted file mode 100644 index 662e897c3..000000000 --- a/tests/e2e/Plugins page/_plugins_page.spec.js +++ /dev/null @@ -1,40 +0,0 @@ -const {expect} = require('@playwright/test'); -const {test} = require('../Shared/base-test'); -const {deactivateWPPlugin, activateWPPlugin, gotoWPPlugins} = require("../Shared/wpUtils"); - - test.beforeEach(async ({page}) => { - await gotoWPPlugins(page); - }); - -//TestId-C3317 - test('[C3317] Validate installation of the latest plugin version', async ({page}) => { - await expect(page.getByTestId('mollie-payments-for-woocommerce')).toHaveText(/7.3.7/); //TODO: remove this and retrieve the version from the plugin - }); - -//TestId-C419986 - test('[C419986] Validate that the latest plugin version is displayed per UI design', async ({page}) => { - await expect(page.getByTestId('mollie-payments-for-woocommerce')).toHaveClass(/active/); - }); - -//TestId-C3318 - test.skip('[C3318] Validate uninstalling the latest plugin version', async ({page}) => { - // Your code here... - }); - -//TestId-C3319 - test('[C3319] Validate deactivation of the latest plugin version', async ({page}) => { - await deactivateWPPlugin(page, 'Mollie Payments for WooCommerce'); - await expect(page.getByTestId('mollie-payments-for-woocommerce')).toHaveClass(/inactive/); - //restore state - await activateWPPlugin(page, 'Mollie Payments for WooCommerce'); - }); - -//TestId-C3322 - test.skip('[C3322] Validate manual plugin update', async ({page}) => { - // Your code here... - }); - -//TestId-C3328 - test.skip('[C3328] Validate automatic plugin update', async ({page}) => { - // Your code here... - }); diff --git a/tests/e2e/README.md b/tests/e2e/README.md deleted file mode 100644 index 832dbe952..000000000 --- a/tests/e2e/README.md +++ /dev/null @@ -1,13 +0,0 @@ - -### Setup E2E tests -In your test environment -- Import the products -- -Check the language of the site, must be English unless specified -- Update the env with url and credentials -- VSCode has a playwright plugin -- Install and activate basic auth plugin: https://github.com/WP-API/Basic-Auth -- Run ngrok to expose the site and be able to test the webhooks -``` -$ npx playwright test -``` - diff --git a/tests/e2e/Shared/base-test.js b/tests/e2e/Shared/base-test.js deleted file mode 100644 index 7bc45e0be..000000000 --- a/tests/e2e/Shared/base-test.js +++ /dev/null @@ -1,8 +0,0 @@ -const base = require('@playwright/test'); -const {allProducts} = require('./products'); -const {allMethods} = require('./gateways'); - -exports.test = base.test.extend({ - products: [allProducts, { option: true }], - gateways: [allMethods, { option: true }], -}); diff --git a/tests/e2e/Shared/default.example.json b/tests/e2e/Shared/default.example.json deleted file mode 100644 index fbc67b27c..000000000 --- a/tests/e2e/Shared/default.example.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "url": "http://stagingsite/", - "users": { - "admin": { - "username": "username", - "password": "password" - }, - "customer": { - "username": "customer", - "password": "password" - } - }, - "products": { - "simple": { - "name": "Simple product" - }, - "variable": { - "name": "Variable Product with Three Attributes", - "defaultAttributes": [ - { - "id": 0, - "name": "Size", - "option": "Medium" - }, - { - "id": 0, - "name": "Colour", - "option": "Blue" - } - ], - "attributes": [ - { - "id": 0, - "name": "Colour", - "isVisibleOnProductPage": true, - "isForVariations": true, - "options": [ - "Red", - "Green", - "Blue" - ], - "sortOrder": 0 - }, - { - "id": 0, - "name": "Size", - "isVisibleOnProductPage": true, - "isForVariations": true, - "options": [ - "Small", - "Medium", - "Large" - ], - "sortOrder": 0 - }, - { - "id": 0, - "name": "Logo", - "isVisibleOnProductPage": true, - "isForVariations": true, - "options": [ - "Woo", - "WordPress" - ], - "sortOrder": 0 - } - ] - }, - "variations": [ - { - "regularPrice": "19.99", - "attributes": [ - { - "name": "Size", - "option": "Large" - }, - { - "name": "Colour", - "option": "Red" - } - ] - }, - { - "regularPrice": "18.99", - "attributes": [ - { - "name": "Size", - "option": "Medium" - }, - { - "name": "Colour", - "option": "Green" - } - ] - }, - { - "regularPrice": "17.99", - "attributes": [ - { - "name": "Size", - "option": "Small" - }, - { - "name": "Colour", - "option": "Blue" - } - ] - } - ], - "grouped": { - "name": "Grouped Product with Three Children", - "groupedProducts": [ - { - "name": "Base Unit", - "regularPrice": "29.99" - }, - { - "name": "Add-on A", - "regularPrice": "11.95" - }, - { - "name": "Add-on B", - "regularPrice": "18.97" - } - ] - }, - "external": { - "name": "External product", - "regularPrice": "24.99", - "buttonText": "Buy now", - "externalUrl": "https://wordpress.org/plugins/woocommerce" - } - }, - "coupons": { - "percentage": { - "code": "20percent", - "discountType": "percent", - "amount": "20.00" - } - }, - "addresses": { - "admin": { - "store": { - "firstname": "John", - "lastname": "Doe", - "company": "Automattic", - "country": "United States (US)", - "addressfirstline": "addr 1", - "addresssecondline": "addr 2", - "countryandstate": "United States (US) — California", - "city": "San Francisco", - "state": "CA", - "postcode": "94107" - } - }, - "customer": { - "billing": { - "firstname": "John", - "lastname": "Doe", - "company": "Inpsyde", - "country": "Italy", - "addressfirstline": "addr 1", - "addresssecondline": "addr 2", - "city": "Como", - "state": "CO", - "postcode": "22100", - "phone": "123456789", - "email": "john.doe@example.com" - }, - "shipping": { - "firstname": "John", - "lastname": "Doe", - "company": "Inpsyde", - "country": "Italy", - "addressfirstline": "addr 1", - "addresssecondline": "addr 2", - "city": "Como", - "state": "Co", - "postcode": "22100" - } - } - }, - "onboardingwizard": { - "industry": "Test industry", - "numberofproducts": "1 - 10", - "sellingelsewhere": "No" - }, - "settings": { - "shipping": { - "zonename": "United States", - "zoneregions": "United States (US)", - "shippingmethod": "Free shipping" - } - } -} - diff --git a/tests/e2e/Shared/gateways.js b/tests/e2e/Shared/gateways.js deleted file mode 100644 index 53e618b88..000000000 --- a/tests/e2e/Shared/gateways.js +++ /dev/null @@ -1,17 +0,0 @@ -const methodsConfig = require('../methodsConfig.json') - - -const banktransfer = methodsConfig.banktransfer; -const ideal = methodsConfig.ideal; -const creditcard = methodsConfig.creditcard; -const paypal = methodsConfig.paypal; -const normalizedName = (name) => { - name = name.replace('\", \"mollie-payments-for-woocommerce\")', ''); - return name.replace('__(\"', ''); -} -const getMethodNames = () => { - return Object.values(methodsConfig).map((method) => normalizedName(method.defaultTitle)); -}; -const allMethodsIds = Object.keys(methodsConfig); -const allMethods = methodsConfig; -module.exports = {banktransfer, ideal, creditcard, paypal, normalizedName, getMethodNames, allMethods, allMethodsIds}; diff --git a/tests/e2e/Shared/mollieUtils.js b/tests/e2e/Shared/mollieUtils.js deleted file mode 100644 index 889187f4f..000000000 --- a/tests/e2e/Shared/mollieUtils.js +++ /dev/null @@ -1,404 +0,0 @@ -const {sharedUrl: {mollieSettingsTab}} = require('../Shared/sharedUrl'); -const {loginAdmin, selectOptionSetting, fillNumberSettings} = require("./wpUtils"); -const {wooOrderPaidPage, wooOrderDetailsPageOnPaid, wooOrderRetryPage, wooOrderDetailsPageOnFailed, wooOrderCanceledPage, wooOrderDetailsPageOnCanceled} = require('../Shared/testMollieInWooPage'); -const {addProductToCart, fillCustomerInCheckout} = require('../Shared/wooUtils'); -const {normalizedName} = require("./gateways"); -const {expect} = require("@playwright/test"); -const {fillCustomerInCheckoutBlock, selectPaymentMethodInCheckout, captureTotalAmountCheckout, - captureTotalAmountBlockCheckout -} = require("./wooUtils"); - -const settingsNames = { - surcharge: (method) => `mollie_wc_gateway_${method}_payment_surcharge`, - fixedFee: (method) => `mollie_wc_gateway_${method}_fixed_fee`, - percentage: (method) => `mollie_wc_gateway_${method}_percentage`, - limitFee: (method) => `mollie_wc_gateway_${method}_maximum_limit`, - components: (method) => `mollie_wc_gateway_${method}_mollie_components_enabled`, -} - -const noticeLines = { - paid: (method) => `Order completed using Mollie – ${method} payment`, - open: (method) => `Mollie – ${method} payment still pending`, - completed: (method) => `Order completed using Mollie – ${method} payment`, - failed: (method) => `${method} payment started`, - canceled: (method) => `${method} payment started`, - expired: (method) => `${method} payment started`, - authorized: (method) => `Order authorized using Mollie – ${method} payment`, -} -/** - * @param {import('@playwright/test').Page} page - */ -const setOrderAPI = async (page) => { - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_api_switch', 'order') - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); -} - -/** - * @param {import('@playwright/test').Page} page - */ -const setPaymentAPI = async (page) => { - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_api_switch', 'payment') - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); -} - -/** - * @param {import('@playwright/test').Page} page - * @param status - */ -const markStatusInMollie = async (page, status) =>{ - const mollieHeader = await page.innerText('.header__info'); - const mollieOrder = mollieHeader.substring(6, mollieHeader.length) - await page.locator('text=' + status).click(); - await page.locator('text=Continue').click(); - return mollieOrder; -} - -const fillCreditCardForm = async (page) => { - await page.getByLabel('Card holder').fill('test'); - - - await page.getByLabel('Card number').fill('4543474002249996'); - await page.locator('iframe[name="expiryDate-input"]').fill('12/25'); - await page.locator('iframe[name="verificationCode-input"]').fill( '123'); - await page.getByRole('button', { name: 'Pay ›' }).click(); -}; -const processMollieCheckout = async (page, status) => { - const expectedUrl = 'https://www.mollie.com/checkout/test-mode?'; - const creditCardUrl = 'https://www.mollie.com/checkout/credit-card'; - console.log(page.url().toString()); - if (page.url().toString().startsWith(creditCardUrl)) { - await fillCreditCardForm(page); - return await markStatusInMollie(page, status); - } - - if (page.url().toString().startsWith(expectedUrl)) { - return await markStatusInMollie(page, status); - } else { - // find the first button - const button = await page.$('button'); - await button.click(); - return await markStatusInMollie(page, status); - } -} - -/** - * @param {import('@playwright/test').Page} page - */ -const insertCorrectAPIKeys = async (page) =>{ - await page.goto(mollieSettingsTab); - await page.locator(`input[name="mollie-payments-for-woocommerce_live_api_key"]`).fill(process.env.MOLLIE_LIVE_API_KEY); - await page.locator(`input[name="mollie-payments-for-woocommerce_test_mode_enabled"]`).check(); - await page.locator(`input[name="mollie-payments-for-woocommerce_test_api_key"]`).fill(process.env.MOLLIE_TEST_API_KEY); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); -} - -/** - * @param {import('@playwright/test').Page} page - */ -const insertIncorrectAPIKeys = async (page) =>{ - await page.goto(mollieSettingsTab); - await page.locator(`input[name="mollie-payments-for-woocommerce_live_api_key"]`).fill('live_1234567890'); - await page.locator(`input[name="mollie-payments-for-woocommerce_test_mode_enabled"]`).check(); - await page.locator(`input[name="mollie-payments-for-woocommerce_test_api_key"]`).fill('test_1234567890'); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); -} - -/** - * @param {import('@playwright/test').Page} page - */ -const resetSettings = async (page) => { - await page.goto(mollieSettingsTab + '§ion=advanced'); - await Promise.all([ - page.waitForNavigation(), - await page.locator('text=clear now').click() - ]); -} - -/** - * @param {import('@playwright/test').Page} page - * @param testedProduct - * @param testedGateway - * @param productQuantity - */ -const beforePlacingOrder = async (page, testedProduct, testedGateway, productQuantity, checkoutUrl) => { - for (let i = productQuantity; i >0; i--) { - await addProductToCart(page, testedProduct.sku); - } - - await page.goto(checkoutUrl); - - //Capture WooCommerce total amount - const totalAmount = await captureTotalAmountCheckout(page); - - // CUSTOMER DETAILS - await fillCustomerInCheckout(page); - - // Check testedGateway option NO ISSUERS DROPDOWN - const title = normalizedName(testedGateway.defaultTitle); - await selectPaymentMethodInCheckout(page, title); - if (testedGateway.paymentFields) { - await page.locator(`select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_${testedGateway.id}"]`).selectOption({index: 1}); - } - // Click text=Place order - await Promise.all([ - page.waitForNavigation(/*{ url: 'https://www.mollie.com/checkout/test-mode?method=GATEWAY&token=XXX' }*/), - page.locator('text=Place order').click() - ]); - return totalAmount; -} - -const beforePlacingOrderBlock = async (page, testedProduct, testedGateway, productQuantity, checkoutUrl) => { - for (let i = productQuantity; i >0; i--) { - await addProductToCart(page, testedProduct.sku); - } - - await page.goto(checkoutUrl); - - //Capture WooCommerce total amount - const totalAmount = await captureTotalAmountBlockCheckout(page); - // CUSTOMER DETAILS - await fillCustomerInCheckoutBlock(page); - - // Check testedGateway option NO ISSUERS DROPDOWN - const title = normalizedName(testedGateway.defaultTitle); - await page.getByText(title, { exact: true }).click(); - if (testedGateway.paymentFields) { - await page.locator(`select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_${testedGateway.id}"]`).selectOption({index: 1}); - } - // Click text=Place order - await Promise.all([ - page.waitForNavigation(/*{ url: 'https://www.mollie.com/checkout/test-mode?method=GATEWAY&token=XXX' }*/), - page.locator('text=Place order').click() - ]); - return totalAmount; -} - -/** - * @param {import('@playwright/test').Page} page - * @param testedProduct - * @param testedGateway - * @param productQuantity - * @param status - */ -const classicCheckoutTransaction = async (page, testedProduct, testedGateway, productQuantity = 1, status = "Paid", checkoutUrl ='/checkout/') => { - let whichCheckout = checkoutUrl === '/checkout/' ? 'classic' : 'block'; - let totalAmount; - if (whichCheckout === 'classic') { - totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway, productQuantity, checkoutUrl); - } else { - totalAmount = await beforePlacingOrderBlock(page, testedProduct, testedGateway, productQuantity, checkoutUrl); - } - // IN MOLLIE - // Capture order number in Mollie and mark as required - const mollieOrder = await processMollieCheckout(page, status); - - return {mollieOrder: mollieOrder, totalAmount: totalAmount}; -} - -const classicCheckoutPaidTransactionFullRefund = async (page, testedProduct, testedGateway) => { - await beforePlacingOrder(page, testedProduct, testedGateway); - const mollieOrder = await markStatusInMollie(page, "Paid"); - await wooOrderDetailsPageOnPaid(page, mollieOrder, testedGateway); - await page.locator('text=This order is no longer editable. Refund >> button').click(); - await page.locator('input[class="refund_order_item_qty"]').fill('1'); - page.on('dialog', dialog => dialog.accept()); - await page.getByRole('button', {name: 'Mollie'}).click(); - await expect(page.locator('#select2-order_status-container')).toContainText("Refunded"); -} - -const classicCheckoutPaidTransactionPartialRefund = async (page, testedProduct, testedGateway) => { - await beforePlacingOrder(page, testedProduct, testedGateway); - const mollieOrder = await markStatusInMollie(page, "Paid"); - await wooOrderDetailsPageOnPaid(page, mollieOrder, testedGateway); - await page.locator('text=This order is no longer editable. Refund >> button').click(); - await page.locator('input[class="refund_order_item_qty"]').fill('0.5'); - page.on('dialog', dialog => dialog.accept()); - await page.locator('#woocommerce-order-items > div.inside > div.wc-order-data-row.wc-order-refund-items.wc-order-data-row-toggle > div.refund-actions > button.button.button-primary.do-api-refund').click(); - await expect(page.locator('#select2-order_status-container')).toContainText("Processing"); - await expect(page.getByText('EUR9.90 refunded')).toBeVisible(); -} - -const checkExpiredAtMollie = async (page) => { - //this assumes the page is mollie checkout - await expect(page.getByText('The payment has been set to expired successfully.')).toBeVisible(); -} - -const fixedFeeTest = async (page, context, products) => { - const fee = 10; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page, fixedFeeSetting, context.tabUrl, fee); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let expected = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")) + fee; - expect(total).toEqual(expected); -} - -const percentageFeeTest = async (page, context, products) => { - const fee = 10; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'percentage'); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page, percentageFeeSetting, context.tabUrl, fee); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")); - let expected = productPrice + (productPrice * fee / 100); - expect(total).toEqual(expected); -} - -const fixedAndPercentageFeeTest = async (page, context, products) => { - const fee = 10; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee_percentage'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page, fixedFeeSetting, context.tabUrl, fee); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page, percentageFeeSetting, context.tabUrl, fee); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")); - let expected = productPrice + fee + (productPrice * fee / 100); - expect(total).toEqual(expected); -} - -const fixedFeeUnderLimitTest = async (page, context, products) => { - const fee = 10; - const limit = 30; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page, fixedFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page, limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let expected = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")) + fee; - expect(total).toEqual(expected); -} - -const percentageFeeUnderLimitTest = async (page, context, products) => { - const fee = 10; - const limit = 30; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'percentage'); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page, percentageFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page, limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")); - let expected = productPrice + (productPrice * fee / 100); - expect(total).toEqual(expected); -} - -const fixedAndPercentageUnderLimit = async (page, context, products) => { - const fee = 10; - const limit = 30; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee_percentage'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page, fixedFeeSetting, context.tabUrl, fee); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page, percentageFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page, limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")); - let expected = productPrice + fee + (productPrice * fee / 100); - expect(total).toEqual(expected); -} - -const fixedFeeOverLimit = async (page, context, products) => { - const fee = 10; - const limit = 30; - const productQuantity = 2; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page, fixedFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page, limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity); - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let expected = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")) * productQuantity; - expect(total).toEqual(expected); -} - -const percentageFeeOverLimit = async (page, context, products) => { - const fee = 10; - const limit = 30; - const productQuantity = 2; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'percentage'); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page, percentageFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page, limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")) * productQuantity; - expect(total).toEqual(productPrice); -} - -const fixedFeeAndPercentageOverLimit = async (page, context, products) => { - const fee = 10; - const limit = 30; - const productQuantity = 2; - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'fixed_fee_percentage'); - const fixedFeeSetting = settingsNames.fixedFee(context.method.id); - await fillNumberSettings(page, fixedFeeSetting, context.tabUrl, fee); - const percentageFeeSetting = settingsNames.percentage(context.method.id); - await fillNumberSettings(page, percentageFeeSetting, context.tabUrl, fee); - const limitFeeSetting = settingsNames.limitFee(context.method.id); - await fillNumberSettings(page, limitFeeSetting, context.tabUrl, limit); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity) - let total = parseFloat(result.totalAmount.replace(",", ".").replace(/[^\d.-]/g, "")); - let productPrice = parseFloat(products.simple.price.replace(",", ".").replace(/[^\d.-]/g, "")) * productQuantity; - expect(total).toEqual(productPrice); -} - -const noFeeAdded = async (page, context, products) => { - await selectOptionSetting(page, context.surchargeSetting, context.tabUrl, 'no_fee'); - const result = await classicCheckoutTransaction(page, products.simple, context.method) - let total = result.totalAmount.slice(0, -1).trim(); - let expected = products.simple.price.slice(0, -1).trim(); - expect(expected).toEqual(total); -} - -module.exports = { - setOrderAPI, - setPaymentAPI, - markStatusInMollie, - insertAPIKeys: insertCorrectAPIKeys, - insertIncorrectAPIKeys, - resetSettings, - beforePlacingOrder, - beforePlacingOrderBlock, - classicCheckoutTransaction, - classicCheckoutPaidTransactionFullRefund, - classicCheckoutPaidTransactionPartialRefund, - checkExpiredAtMollie, - processMollieCheckout, - settingsNames, - noticeLines, - fixedFeeTest, - percentageFeeTest, - fixedAndPercentageFeeTest, - fixedFeeUnderLimitTest, - percentageFeeUnderLimitTest, - fixedAndPercentageUnderLimit, - fixedFeeOverLimit, - percentageFeeOverLimit, - fixedFeeAndPercentageOverLimit, - noFeeAdded -}; diff --git a/tests/e2e/Shared/products.js b/tests/e2e/Shared/products.js deleted file mode 100644 index 5b6eea66d..000000000 --- a/tests/e2e/Shared/products.js +++ /dev/null @@ -1,54 +0,0 @@ -const allProducts = { - simple: { - "title": "Beanie", - 'link': '/product/beanie/', - 'sku': 'woo-beanie', - 'sale_price': '18,00 €', - 'regular_price': '20,00 €', - 'price': '18,00 €', - 'virtual': 'no', - 'downloadable': 'no', - }, - virtual: { - "title": "Album", - 'link': '/product/album/', - 'sku': 'woo-album', - 'sale_price': '15,00 €', - 'regular_price': '20,00 €', - 'price': '15,00 €', - 'virtual': 'yes', - 'downloadable': 'yes', - }, - variation: { - "title": "V-Neck T-Shirt", - 'link': "/product/v-neck-t-shirt/", - 'sku': "woo-vneck-tee", - 'sale_price': '', - 'regular_price': '', - 'price': '', - 'virtual': 'no', - 'downloadable': 'no', - }, variationRed: { - "title": "V-Neck T-Shirt - Red", - 'link': '/product/v-neck-t-shirt/?attribute_pa_color=red', - 'sku': "woo-vneck-tee-red", - 'sale_price': '', - 'regular_price': '20,00 €', - 'price': '20,00 €', - 'virtual': 'no', - 'downloadable': 'no', - }, - variationGreen: { - "title": "V-Neck T-Shirt - Green", - 'link': '/product/v-neck-t-shirt/?attribute_pa_color=green', - 'sku': "woo-vneck-tee-green", - 'sale_price': '', - 'regular_price': '20,00 €', - 'price': '20,00 €', - 'virtual': 'no', - 'downloadable': 'no', - } -}; - - -module.exports = {allProducts}; diff --git a/tests/e2e/Shared/sharedUrl.js b/tests/e2e/Shared/sharedUrl.js deleted file mode 100644 index 584d419dd..000000000 --- a/tests/e2e/Shared/sharedUrl.js +++ /dev/null @@ -1,6 +0,0 @@ -export const sharedUrl = { - mollieSettingsTab: '/wp-admin/admin.php?page=wc-settings&tab=mollie_settings', - gatewaySettingsRoot: '/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=mollie_wc_gateway_', - paypalSettings : '/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=mollie_wc_gateway_paypal', - blocksCheckout: '/checkout-block/' -} diff --git a/tests/e2e/Shared/testMollieInWooPage.js b/tests/e2e/Shared/testMollieInWooPage.js deleted file mode 100644 index 7885e7d82..000000000 --- a/tests/e2e/Shared/testMollieInWooPage.js +++ /dev/null @@ -1,50 +0,0 @@ -import {normalizedName} from "./gateways"; - -const { expect } = require('@playwright/test'); -const {sharedUrl} = require("./sharedUrl"); - -async function gotoWPPage(page, url) { - await page.goto(url); -} - -async function gotoMollieGeneralSettings(page) { - await gotoWPPage(page, sharedUrl.mollieSettingsTab); -} - -export const wooOrderPaidPage = async (page, mollieOrder, totalAmount, testedGateway) => { - // Check order number - await expect(page.locator('li.woocommerce-order-overview__order.order')).toContainText(mollieOrder); - // Check total amount in order - await expect(page.locator('li.woocommerce-order-overview__total.total > strong > span > bdi')).toContainText(totalAmount); - - if(testedGateway.id !== 'paypal'){ - // Check customer in billing details - await expect(page.getByText('My company nameJulia CallasCalle Drutal22100 BerlinGermany 1234566788 test@test.')).toBeVisible; - } - // Check Mollie method appears - const methodName = normalizedName(testedGateway.defaultTitle); - await expect(page.getByRole('cell', { name: methodName})).toBeVisible(); -} - -export const wooOrderRetryPage = async (page) => { - // Check we are in retry page - const regex = new RegExp(/checkout\/order-pay/); - await expect(page).toHaveURL(regex); -} - -export const wooOrderCanceledPage = async (page, mollieOrder, totalAmount, testedGateway) => { - await expect(page.locator('#wp--skip-link--target > div.wp-container-7.entry-content.wp-block-post-content > div > div > p')).toContainText('cancelled'); -} - -export const wooOrderDetailsPage = async (page, mollieOrder, testedGateway, status, notice) => { - await page.goto('/wp-admin/edit.php?post_type=shop_order'); - if (status === 'Expired') { - await page.waitForTimeout(2000); - } - // Check order is in status processing in order page - await expect(page.locator('#post-' + mollieOrder + '> td.order_status.column-order_status > mark > span')).toContainText(status); - await page.goto('/wp-admin/post.php?post=' + mollieOrder + '&action=edit'); - - // Check order notes has correct text - await expect(page.locator('#woocommerce-order-notes > div.inside > ul')).toContainText(notice); -} diff --git a/tests/e2e/Shared/wooUtils.js b/tests/e2e/Shared/wooUtils.js deleted file mode 100644 index 2c7134459..000000000 --- a/tests/e2e/Shared/wooUtils.js +++ /dev/null @@ -1,152 +0,0 @@ -const path = require("path"); -const fs = require("fs"); -const wooUrls = { - settingsPaymentTab: '/wp-admin/admin.php?page=wc-settings&tab=checkout' -} -async function gotoWPPage(page, url) { - await page.goto(url); -} -async function gotoWooPaymentTab(page) { - await gotoWPPage(page, wooUrls.settingsPaymentTab); -} -/** - * @param {import('@playwright/test').Page} page - * @param productSku - */ -const addProductToCart = async (page, productSku) => { - await page.goto('/shop/'); - await page.locator('[data-product_sku="' + productSku + '"].add_to_cart_button').click() -} - -const emptyCart = async (page) => { - await page.goto('/cart/'); - const canRemove = await page.getByRole('cell', { name: 'Remove this item' }).isVisible(); - if (canRemove) { - await page.getByRole('cell', { name: 'Remove this item' }).click(); - } -} - -/** - * @param {import('@playwright/test').Page} page - */ -const fillCustomerInCheckout = async (page, country = "DE") => { - await page.locator('input[name="billing_first_name"]').fill('Julia'); - await page.locator('input[name="billing_last_name"]').fill('Callas'); - await page.selectOption('select#billing_country', country); - await page.locator('input[name="billing_city"]').fill('Berlin'); - await page.locator('input[name="billing_address_1"]').fill('Calle Drutal'); - await page.locator('input[name="billing_postcode"]').fill('22100'); - await page.locator('input[name="billing_phone"]').fill('1234566788'); - await page.locator('input[name="billing_email"]').fill('test@test.com'); - const canFillCompany = await page.locator('input[name="billing_company"]').isVisible(); - if (canFillCompany) { - await page.locator('input[name="billing_company"]').fill('Test company'); - } - const canFillBirthDate = await page.locator('input[name="billing_birthdate"]').isVisible(); - if (canFillBirthDate) { - await page.locator('input[name="billing_birthdate"]').fill('01-01-1990'); - } -} - -/** - * @param {import('@playwright/test').Page} page - */ -const fillCustomerInCheckoutBlock = async (page, country = 'Germany') => { - await page.getByLabel('First name').fill('Julia'); - await page.getByLabel('Last name').fill('Callas'); - await page.getByLabel('Country/Region').fill(country); - await page.getByLabel('City').fill('Berlin'); - await page.getByLabel('Address', { exact: true }).fill('Calle Drutal'); - await page.getByLabel('Postal code').fill('22100'); - await page.getByLabel('Phone').fill('1234566788'); - await page.getByLabel('Email address').fill('test@test.com'); - const canFillCompany = await page.getByLabel('Company').isVisible(); - if (canFillCompany) { - await page.getByLabel('Company').fill('Test company'); - } - //const canFillBirthDate = await page.locator('input[name="billing_birthdate"]').isVisible(); - /*if (canFillBirthDate) { - await page.locator('input[name="billing_birthdate"]').fill('01-01-1990'); - }*/ -} - -/** - * @param {import('@playwright/test').Page} page - */ -const fillCustomerInBlockCheckout = async (page) => { - // Fill input[name="billing_first_name"] - await page.locator('input[name="billing_first_name"]').fill('Julia'); - // Fill input[name="billing_last_name"] - await page.locator('input[name="billing_last_name"]').fill('Callas'); -} - -const selectPaymentMethodInCheckout = async (page, paymentMethod) => { - await page.getByText(paymentMethod, { exact: true }).click(); -} - -const placeOrderCheckout = async (page) => { - // Click text=Place order - await page.locator('text=Place order').click() -} - -const placeOrderPayPage = async (page) => { - // Click text=Place order - await page.getByRole('button', { name: 'Pay for order' }).click() -} - -const captureTotalAmountCheckout = async (page) => { - return await page.innerText('.order-total > td > strong > span > bdi'); -} - -const captureTotalAmountPayPage = async (page) => { - return await page.innerText('.woocommerce-Price-amount.amount > bdi'); -} - -const captureTotalAmountBlockCheckout = async (page) => { - let totalLine = await page.locator('div').filter({ hasText: /^Total/ }).first() - let totalAmount = await totalLine.innerText('.woocommerce-Price-amount amount > bdi'); - // totalAmount is "Total\n72,00 €" and we need to remove the "Total\n" part - return totalAmount.substring(6, totalAmount.length); -} - -const createManualOrder = async (page, productLabel = 'Beanie') => { - await page.goto('wp-admin/post-new.php?post_type=shop_order'); - await page.click('text=Add item(s)'); - await page.click('text=Add product(s)'); - await page.getByRole('combobox', { name: 'Search for a product…' }).locator('span').nth(2).click(); - await page.locator('span > .select2-search__field').fill(productLabel); - await page.click('text=' + productLabel); - await page.locator('#btn-ok').click(); - await page.waitForTimeout(2000); - await page.getByRole('button', { name: 'Create' }).click(); - await page.click('text=Customer payment page'); -} - -const getLogByName = async (name, dirname) => { - const currentDate = new Date().toISOString().split('T')[0]; - // Construct the relative path to the log file - const logsDirectory = path.join(dirname, '..', '..', '..', '.ddev', 'wordpress', 'wp-content', 'uploads', 'wc-logs'); - const files = fs.readdirSync(logsDirectory); - const matchingFiles = files.filter(file => file.includes(`${name}-${currentDate}-`)); - // Select the first matching file - const logFileName = matchingFiles[0]; - const logFilePath = path.join(logsDirectory, logFileName); - return fs.readFileSync(logFilePath, 'utf-8'); -} - -module.exports = { - addProductToCart, - fillCustomerInCheckout, - fillCustomerInBlockCheckout, - fillCustomerInCheckoutBlock, - gotoWooPaymentTab, - placeOrderCheckout, - emptyCart, - placeOrderPayPage, - selectPaymentMethodInCheckout, - captureTotalAmountCheckout, - captureTotalAmountBlockCheckout, - captureTotalAmountPayPage, - createManualOrder, - getLogByName -} diff --git a/tests/e2e/Shared/wpUtils.js b/tests/e2e/Shared/wpUtils.js deleted file mode 100644 index ae8e4a110..000000000 --- a/tests/e2e/Shared/wpUtils.js +++ /dev/null @@ -1,77 +0,0 @@ -async function gotoWPPage(page, url) { - await page.goto(url); -} - -async function gotoWPLogin(page) { - await gotoWPPage(page, '/wp-login.php'); -} - -async function gotoWPPlugins(page) { - await gotoWPPage(page, '/wp-admin/plugins.php'); -} - -const loginAdmin = async (page) => { - await gotoWPLogin(page); - await page.locator('#user_login').fill(process.env.E2E_AUTH_USERNAME); - await page.locator('#user_pass').fill(process.env.E2E_AUTH_PW); - await Promise.all([ - page.waitForNavigation(), - page.locator('input:has-text("Log In")').click() - ]); -} - -async function deactivateWPPlugin(page, pluginName) { - await page.getByRole('link', {name: `Deactivate ${pluginName}`, exact: true}).click(); -} - -async function activateWPPlugin(page, pluginName) { - await page.getByRole('cell', {name: `${pluginName} Activate ${pluginName} | Delete ${pluginName}`}).getByRole('link', {name: `Activate ${pluginName}`}).click(); -} - -const enableCheckboxSetting = async (page, settingName, settingsTabUrl) => { - await page.goto(settingsTabUrl); - await page.locator(`input[name="${settingName}"]`).check(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); -} - -const disableCheckboxSetting = async (page, settingName, settingsTabUrl) => { - await page.goto(settingsTabUrl); - await page.locator(`input[name="${settingName}"]`).uncheck(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); -} - -async function saveSettings(page) { - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); -} - -const selectOptionSetting = async (page, settingName, settingsTabUrl, optionValue) => { - await page.goto(settingsTabUrl); - await page.selectOption(`select[name="${settingName}"]`, optionValue); - await saveSettings(page); -} - -const fillTextSettings = async (page, settingName, settingsTabUrl, value) => { - await page.goto(settingsTabUrl); - let field = await page.locator(`input[name="${settingName}"]`); - await field.fill(value); - await saveSettings(page); -} - -const fillNumberSettings = async (page, settingName, settingsTabUrl, value) => { - await page.goto(settingsTabUrl); - await page.locator(`input#${settingName}`).fill(''); - await page.type(`input#${settingName}`, value.toString()); - await saveSettings(page); -} - -module.exports = {loginAdmin, deactivateWPPlugin, activateWPPlugin, gotoWPPlugins, enableCheckboxSetting, disableCheckboxSetting, selectOptionSetting, fillTextSettings, fillNumberSettings}; - diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_apple_pay.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_apple_pay.spec.js deleted file mode 100644 index c76a721c8..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_apple_pay.spec.js +++ /dev/null @@ -1,16 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Apple Pay', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420217 -test.skip('Validate the submission of an order with Apple Pay as payment method and payment mark as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_bancontact.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_bancontact.spec.js deleted file mode 100644 index a0eb0f0d0..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_bancontact.spec.js +++ /dev/null @@ -1,80 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction, resetSettings, insertAPIKeys, setOrderAPI} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); -test.beforeAll(async ({browser}) => { - // Create a new page instance - const page = await browser.newPage(); - // Reset to the default state - await resetSettings(page); - await insertAPIKeys(page); - // Orders API - await setOrderAPI(page); -}); -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Bancontact', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.bancontact; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420230", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420231", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420232", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420233", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420234", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Bancontact as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_belfius_direct_net.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_belfius_direct_net.spec.js deleted file mode 100644 index 4d7814b8f..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_belfius_direct_net.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Belfius Direct Net', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.belfius; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420298", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420299", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420300", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420301", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Belfius Direct Net as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_billie.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_billie.spec.js deleted file mode 100644 index 3e86a4d81..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_billie.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Billie', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420302 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Authorized" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420303 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Failed" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420304 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Cancelled" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420305 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Expired" on block checkout', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_credit_card.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_credit_card.spec.js deleted file mode 100644 index 35fc84406..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_credit_card.spec.js +++ /dev/null @@ -1,115 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, settingsNames, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {disableCheckboxSetting} = require("../../Shared/wpUtils"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Credit card', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.creditcard; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420268", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420269", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420270", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420272", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420271", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test.skip(`[${testId}] Validate the submission of an order with Credit Card (Mollie Payment Screen) as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - //mollie components disabled - const settingsTab = sharedUrl.gatewaySettingsRoot + context.method.id; - const settingsName = settingsNames.components(context.method.id); - await disableCheckboxSetting(page, settingsName, settingsTab); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -//TestId-C420273 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420274 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Open" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420275 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Failed" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420276 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Expired" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420277 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Canceled" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420278 -test.skip('Validate the submission of an order with Credit Card (no 3D secure) as payment method using Mollie Components on block chcekout', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_eps.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_eps.spec.js deleted file mode 100644 index c46457571..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_eps.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - EPS', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.eps; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420260", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420261", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420262", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420263", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with EPS as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_gift_cards.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_gift_cards.spec.js deleted file mode 100644 index ecf6f1728..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_gift_cards.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Gift cards', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420258 -test.skip('Validate the submission of an order with any payment method including a Gift Card and marked as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420259 -test.skip('Validate the submission of an order were the total value is paid with a Gift Card on block checkout', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_giropay.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_giropay.spec.js deleted file mode 100644 index dc3a755ab..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_giropay.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Giropay', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.giropay; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420290", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420291", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420292", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420293", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Giropay as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_ideal.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_ideal.spec.js deleted file mode 100644 index d2186955f..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_ideal.spec.js +++ /dev/null @@ -1,72 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - iDEAL', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.ideal; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420244", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420245", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420246", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420248", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420247", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with iDEAL as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_in3.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_in3.spec.js deleted file mode 100644 index f570dd480..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_in3.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - in3', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420219 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420220 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Failed" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420221 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Cancelled" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420222 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Expired" on block checkout', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_kbc_cbc_payment_button.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_kbc_cbc_payment_button.spec.js deleted file mode 100644 index 9b13555e4..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_kbc_cbc_payment_button.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - KBC_CBC Payment Button', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.kbc; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420267", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420264", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420265", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420266", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with KBC_CBC as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_later.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_later.spec.js deleted file mode 100644 index 2b4e5e130..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_later.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Klarna Pay later', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnapaylater; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420249", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420250", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420251", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420252", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Pay later as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_now.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_now.spec.js deleted file mode 100644 index e7f4b4fa4..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_now.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Klarna Pay Now', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnapaynow; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420279", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420280", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420281", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420282", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Pay Now as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_slice_it.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_slice_it.spec.js deleted file mode 100644 index a5a2e4767..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_slice_it.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Klarna Slice it', () => { - const productQuantity = 4; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnasliceit; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420223", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420224", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420225", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420226", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Slice it as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_mybank.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_mybank.spec.js deleted file mode 100644 index d45a4042a..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_mybank.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - MyBank', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.mybank; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420286", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420287", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420288", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420289", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with MyBank as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paypal.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paypal.spec.js deleted file mode 100644 index b3f2ba45a..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paypal.spec.js +++ /dev/null @@ -1,72 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - PayPal', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.paypal; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420253", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420254", - mollieStatus: "Pending", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.methodName.toLowerCase()), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420255", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420256", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420257", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with PayPal as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paysafecard.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paysafecard.spec.js deleted file mode 100644 index ad41092c4..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paysafecard.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - paysafecard', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.paysafecard; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420306", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420307", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420308", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with paysafecard as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_przelewy24.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_przelewy24.spec.js deleted file mode 100644 index f5e6d8e3e..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_przelewy24.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Przelewy24', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.przelewy24; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420235", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420236", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420237", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420238", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Przelewy24 as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sepa_bank_transfer.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sepa_bank_transfer.spec.js deleted file mode 100644 index f64059ebc..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sepa_bank_transfer.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - SEPA Bank Transfer', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.banktransfer; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420284", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420283", - mollieStatus: "Open", - wooStatus: "On hold", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420285", - mollieStatus: "Expired", - wooStatus: "On hold", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with SEPA bank transfer as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sofort_banking.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sofort_banking.spec.js deleted file mode 100644 index a9c61ea2f..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sofort_banking.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - SOFORT Banking', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.sofort; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420227", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420229", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420228", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with SOFORT as payment method and payment mark as "${mollieStatus} on block checkout"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus, sharedUrl.blocksCheckout); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_voucher.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_voucher.spec.js deleted file mode 100644 index 77092ecac..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_voucher.spec.js +++ /dev/null @@ -1,40 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Block Checkout - Voucher', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420239 -test.skip('Validate the submission of an order with a ECO Voucher and marked as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420240 -test.skip('Validate the submission of an order with a MEAL Voucher and marked as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420241 -test.skip('Validate the submission of an order with a GIFT Voucher and marked as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420242 -test.skip('Validate the submission of an order with any payment method including a Voucher and marked as "Paid" on block checkout', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420243 -test.skip('Validate the submission of an order were the total value is paid with a Voucher on block checkout', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_apple_pay.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_apple_pay.spec.js deleted file mode 100644 index 9f9b7cb4e..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_apple_pay.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Apple Pay', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C3369 -test.skip('Validate the submission of an order with Apple Pay checkout as payment method and payment mark as "Paid"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3370 -test.skip('Validate the submission of an order with Apple Pay Direct as payment method and payment mark as "Paid"', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_bancontact.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_bancontact.spec.js deleted file mode 100644 index 5c4346479..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_bancontact.spec.js +++ /dev/null @@ -1,90 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const { - setOrderAPI, - insertAPIKeys, - resetSettings, - settingsNames, - noticeLines, - classicCheckoutTransaction, checkExpiredAtMollie -} = require('../../Shared/mollieUtils'); -const {wooOrderPaidPage, wooOrderDetailsPage, wooOrderRetryPage} = require("../../Shared/testMollieInWooPage"); -const {normalizedName} = require("../../Shared/gateways"); -const {emptyCart} = require("../../Shared/wooUtils"); - -// Set up parameters or perform actions before all tests -test.beforeAll(async ({browser}) => { - // Create a new page instance - const page = await browser.newPage(); - // Reset to the default state - await resetSettings(page); - await insertAPIKeys(page); - // Orders API - await setOrderAPI(page); -}); -test.describe('_Transaction scenarios_Payment statuses Checkout - Bancontact', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.bancontact; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3387", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3388", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3389", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3390", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3391", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Bancontact as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_belfius_direct_net.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_belfius_direct_net.spec.js deleted file mode 100644 index 434eaca83..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_belfius_direct_net.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Belfius Direct Net', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.belfius; - context.methodName = normalizedName(context.method.defaultTitle); - await page.goto('/shop/'); - await emptyCart(page); - }); - const testData = [ - { - testId: "C3428", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3429", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3430", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3431", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Belfius Direct Net as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_billie.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_billie.spec.js deleted file mode 100644 index 18b9bc73d..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_billie.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Billie', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.billie; - context.methodName = normalizedName(context.method.defaultTitle); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C354674", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C354675", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C354676", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C354677", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test.skip(`[${testId}] Validate the submission of an order with Billie as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_credit_card.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_credit_card.spec.js deleted file mode 100644 index 2da03bc9d..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_credit_card.spec.js +++ /dev/null @@ -1,116 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction, settingsNames} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {enableCheckboxSetting, disableCheckboxSetting} = require("../../Shared/wpUtils"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Credit card', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.creditcard; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3371", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3372", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3373", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3375", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3374", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Credit Card (Mollie Payment Screen) as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - //mollie components disabled - const settingsTab = sharedUrl + context.method.id; - const settingsName = settingsNames.components(context.method.id); - await disableCheckboxSetting(page, settingsName, settingsTab); - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - - -//TestId-C3376 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Paid"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3377 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Open"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3378 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Failed"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3379 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Expired"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3380 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Canceled"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3381 -test.skip('Validate the submission of an order with Credit Card (no 3D secure) as payment method using Mollie Components', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_eps.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_eps.spec.js deleted file mode 100644 index ad2f2a1f1..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_eps.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - EPS', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.eps; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3412", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3413", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3414", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3415", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Eps as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_gift_cards.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_gift_cards.spec.js deleted file mode 100644 index 416490ba7..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_gift_cards.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Gift cards', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C3438 -test.skip('Validate the submission of an order with any payment method including a Gift Card and marked as "Paid"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3439 -test.skip('Validate the submission of an order were the total value is paid with a Gift Card', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_giropay.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_giropay.spec.js deleted file mode 100644 index ceb4438a2..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_giropay.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Giropay', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.giropay; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3420", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3421", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3422", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3423", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Giropay as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_ideal.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_ideal.spec.js deleted file mode 100644 index b4450a425..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_ideal.spec.js +++ /dev/null @@ -1,73 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - iDEAL', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.ideal; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3382", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3383", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3384", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3386", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3385", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with iDeal as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_in3.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_in3.spec.js deleted file mode 100644 index a9de259b4..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_in3.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - in3', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.in3; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3731", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3732", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3733", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3734", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test.skip(`[${testId}] Validate the submission of an order with in3 as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_kbc_cbc_payment_button.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_kbc_cbc_payment_button.spec.js deleted file mode 100644 index 3a03dd8c5..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_kbc_cbc_payment_button.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - KBC_CBC Payment Button', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.kbc; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3419", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3416", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3417", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3418", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with KBC as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_later.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_later.spec.js deleted file mode 100644 index b219bdc6a..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_later.spec.js +++ /dev/null @@ -1,62 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Klarna Pay later', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnapaylater; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3401", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3402", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3403", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3404", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Pay later as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_now.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_now.spec.js deleted file mode 100644 index 542a70ea2..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_now.spec.js +++ /dev/null @@ -1,62 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Klarna Pay Now', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnapaynow; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3397", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3398", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3399", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3400", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Pay Now as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_slice_it.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_slice_it.spec.js deleted file mode 100644 index fa8f1cd87..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_slice_it.spec.js +++ /dev/null @@ -1,62 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Klarna Slice it', () => { - const productQuantity = 4; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnasliceit; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3408", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3409", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3410", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3411", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Slice it as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_mybank.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_mybank.spec.js deleted file mode 100644 index 1867d1720..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_mybank.spec.js +++ /dev/null @@ -1,64 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - MyBank', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.mybank; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420294", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420295", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420296", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420297", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with MyBank as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paypal.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paypal.spec.js deleted file mode 100644 index 20e67553d..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paypal.spec.js +++ /dev/null @@ -1,73 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - PayPal', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.paypal; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3392", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3393", - mollieStatus: "Pending", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.methodName.toLowerCase()), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3394", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3395", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3396", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with PayPal as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paysafecard.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paysafecard.spec.js deleted file mode 100644 index 3b0f29d57..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paysafecard.spec.js +++ /dev/null @@ -1,55 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - paysafecard', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.paysafecard; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C420141", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420142", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420143", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Paysafecard as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_przelewy24.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_przelewy24.spec.js deleted file mode 100644 index 77d7cc155..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_przelewy24.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Przelewy24', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.przelewy24; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3424", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3425", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3426", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3427", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Przelewy24 as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sepa_bank_transfer.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sepa_bank_transfer.spec.js deleted file mode 100644 index 2cda88823..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sepa_bank_transfer.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - SEPA Bank Transfer', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.banktransfer; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3433", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3432", - mollieStatus: "Open", - wooStatus: "On hold", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3434", - mollieStatus: "Expired", - wooStatus: "On hold", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with SEPA Bank Transfer as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sofort_banking.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sofort_banking.spec.js deleted file mode 100644 index 5676df863..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sofort_banking.spec.js +++ /dev/null @@ -1,54 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderDetailsPage, wooOrderRetryPage} = require("../../Shared/testMollieInWooPage"); -const {emptyCart} = require("../../Shared/wooUtils"); - -test.describe('_Transaction scenarios_Payment statuses Checkout - SOFORT Banking', () => { - const productQuantity = 1; - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.sofort; - context.methodName = normalizedName(context.method.defaultTitle); - await emptyCart(page); - await page.goto('/shop/'); - }); - const testData = [ - { - testId: "C3405", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C3407", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C3406", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with SOFORT Banking as payment method and payment mark as "${mollieStatus}"`, async ({ page, products, context }) => { - const result = await classicCheckoutTransaction(page, products.simple, context.method, productQuantity, mollieStatus); - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_voucher.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_voucher.spec.js deleted file mode 100644 index d892c1774..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_voucher.spec.js +++ /dev/null @@ -1,40 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses Checkout - Voucher', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C3435 -test.skip('Validate the submission of an order with a ECO Voucher and marked as "Paid"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3436 -test.skip('Validate the submission of an order with a MEAL Voucher and marked as "Paid"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3437 -test.skip('Validate the submission of an order with a GIFT Voucher and marked as "Paid"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3440 -test.skip('Validate the submission of an order with any payment method including a Voucher and marked as "Paid"', async ({ page}) => { - // Your code here... -}); - - -//TestId-C3441 -test.skip('Validate the submission of an order were the total value is paid with a Voucher', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_apple_pay.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_apple_pay.spec.js deleted file mode 100644 index 8c0379656..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_apple_pay.spec.js +++ /dev/null @@ -1,16 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Apple Pay', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420333 -test.skip('Validate the submission of an order with Apple Pay as payment method and payment mark as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_bancontact.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_bancontact.spec.js deleted file mode 100644 index 1ac6aec5c..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_bancontact.spec.js +++ /dev/null @@ -1,87 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const { execSync } = require('child_process'); -const {selectPaymentMethodInCheckout, placeOrderPayPage, captureTotalAmountPayPage, createManualOrder} = require("../../Shared/wooUtils"); -const {normalizedName} = require("../../Shared/gateways"); -const {noticeLines, checkExpiredAtMollie, classicCheckoutTransaction, processMollieCheckout, - resetSettings, - insertAPIKeys, - setOrderAPI -} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); -const {sharedUrl} = require("../../Shared/sharedUrl"); -test.beforeAll(async ({browser}) => { - // Create a new page instance - const page = await browser.newPage(); - // Reset to the default state - await resetSettings(page); - await insertAPIKeys(page); - // Orders API - await setOrderAPI(page); -}); -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Bancontact', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.bancontact; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420345", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420346", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420347", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420348", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420349", - mollieStatus: "Expired", - wooStatus: "Cancelled", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Bancontact as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_belfius_direct_net.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_belfius_direct_net.spec.js deleted file mode 100644 index b2c6ac8b3..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_belfius_direct_net.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Belfius Direct Net', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.belfius; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420409", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420410", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420411", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420412", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Belfius Direct Net as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_billie.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_billie.spec.js deleted file mode 100644 index d448b89da..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_billie.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Billie', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420413 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Authorized" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420414 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Failed" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420415 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Cancelled" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420416 -test.skip('Validate the submission of an order with Billie as payment method and payment mark as "Expired" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_credit_card.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_credit_card.spec.js deleted file mode 100644 index f293a1ce7..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_credit_card.spec.js +++ /dev/null @@ -1,76 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Credit card', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420383 -test.skip('Validate the submission of an order with Credit Card (Mollie Payment Screen) as payment method and payment mark as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420384 -test.skip('Validate the submission of an order with Credit Card (Mollie Payment Screen) as payment method and payment mark as "Open" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420385 -test.skip('Validate the submission of an order with Credit Card (Mollie Payment Screen) as payment method and payment mark as "Failed" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420386 -test.skip('Validate the submission of an order with Credit Card (Mollie Payment Screen) as payment method and payment mark as "Expired" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420387 -test.skip('Validate the submission of an order with Credit Card (Mollie Payment Screen) as payment method and payment mark as "Cancelled" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420388 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420389 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Open" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420390 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Failed" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420391 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Expired" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420392 -test.skip('Validate the submission of an order with Credit Card as payment method using Mollie Components and payment mark as "Canceled" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420393 -test.skip('Validate the submission of an order with Credit Card (no 3D secure) as payment method using Mollie Components on pay for order page', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_eps.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_eps.spec.js deleted file mode 100644 index c1f0de617..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_eps.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - EPS', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.eps; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420375", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420376", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420377", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420378", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with EPS as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_gift_cards.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_gift_cards.spec.js deleted file mode 100644 index f376fb5a2..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_gift_cards.spec.js +++ /dev/null @@ -1,22 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Gift cards', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420373 -test.skip('Validate the submission of an order with any payment method including a Gift Card and marked as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420374 -test.skip('Validate the submission of an order were the total value is paid with a Gift Card on pay for order page', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_giropay.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_giropay.spec.js deleted file mode 100644 index ad047d5a1..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_giropay.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Giropay', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.giropay; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420405", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420406", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420407", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420408", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Giropay as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_ideal.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_ideal.spec.js deleted file mode 100644 index 3387cd99d..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_ideal.spec.js +++ /dev/null @@ -1,79 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - iDEAL', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.ideal; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420359", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420360", - mollieStatus: "Open", - wooStatus: "Pending payment", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420361", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420363", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420362", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with iDEAL as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_in3.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_in3.spec.js deleted file mode 100644 index bf2b4fac5..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_in3.spec.js +++ /dev/null @@ -1,34 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - in3', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420334 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420335 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Failed" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420336 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Cancelled" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420337 -test.skip('Validate the submission of an order with IN3 as payment method and payment mark as "Expired" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_kbc_cbc_payment_button.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_kbc_cbc_payment_button.spec.js deleted file mode 100644 index 214d90881..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_kbc_cbc_payment_button.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - KBC_CBC Payment Button', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.kbc; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420379", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420380", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420381", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420382", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with KBC_CBC as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_later.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_later.spec.js deleted file mode 100644 index e68aed768..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_later.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Klarna Pay later', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnapaylater; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420364", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420365", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420366", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420367", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Pay Later as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_now.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_now.spec.js deleted file mode 100644 index ec1b143d7..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_now.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Klarna Pay Now', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnapaynow; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420394", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420395", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420396", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420397", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Pay Now as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_slice_it.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_slice_it.spec.js deleted file mode 100644 index dab23113c..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_slice_it.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Klarna Slice it', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.klarnasliceit; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420338", - mollieStatus: "Authorized", - wooStatus: "Processing", - notice: context => noticeLines.authorized(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420339", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420340", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420341", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Klarna Slice It as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_mybank.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_mybank.spec.js deleted file mode 100644 index 9205aa0c2..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_mybank.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - MyBank', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.mybank; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420401", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420402", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420403", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420404", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with MyBank as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paypal.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paypal.spec.js deleted file mode 100644 index 0c73b44a6..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paypal.spec.js +++ /dev/null @@ -1,78 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - PayPal', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.paypal; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420368", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420369", - mollieStatus: "Pending", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420370", - mollieStatus: "Failed", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420371", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420372", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with Paypal as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paysafecard.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paysafecard.spec.js deleted file mode 100644 index 7e08d6dc2..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paysafecard.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - paysafecard', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.paysafecard; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420417", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420418", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420419", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with paysafecard as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_przelewy24.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_przelewy24.spec.js deleted file mode 100644 index f76e7f5d3..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_przelewy24.spec.js +++ /dev/null @@ -1,69 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Przelewy24', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.przelewy24; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420350", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420351", - mollieStatus: "Failed", - wooStatus: "Failed", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420352", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420353", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with P24 as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sepa_bank_transfer.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sepa_bank_transfer.spec.js deleted file mode 100644 index 695883d3c..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sepa_bank_transfer.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - SEPA Bank Transfer', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.banktransfer; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420399", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420398", - mollieStatus: "Open", - wooStatus: "On hold", - notice: context => noticeLines.open(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420400", - mollieStatus: "Expired", - wooStatus: "On hold", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with SEPA bank transfer as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sofort_banking.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sofort_banking.spec.js deleted file mode 100644 index 3bfdd8795..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sofort_banking.spec.js +++ /dev/null @@ -1,60 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); -const {normalizedName} = require("../../Shared/gateways"); -const { - createManualOrder, - selectPaymentMethodInCheckout, - captureTotalAmountPayPage, - placeOrderPayPage -} = require("../../Shared/wooUtils"); -const {noticeLines, checkExpiredAtMollie, processMollieCheckout} = require("../../Shared/mollieUtils"); -const {wooOrderPaidPage, wooOrderRetryPage, wooOrderDetailsPage} = require("../../Shared/testMollieInWooPage"); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - SOFORT Banking', () => { - test.beforeEach(async ({ page , context, gateways}) => { - context.method = gateways.sofort; - context.methodName = normalizedName(context.method.defaultTitle); - await createManualOrder(page, 'Beanie') - }); - const testData = [ - { - testId: "C420342", - mollieStatus: "Paid", - wooStatus: "Processing", - notice: context => noticeLines.paid(context.methodName), - action: async (page, result, context) => { - await wooOrderPaidPage(page, result.mollieOrder, result.totalAmount, context.method); - } - }, - { - testId: "C420344", - mollieStatus: "Canceled", - wooStatus: "Pending payment", - notice: context => noticeLines.failed(context.method.id), - action: async (page) => { - await wooOrderRetryPage(page); - } - }, - { - testId: "C420343", - mollieStatus: "Expired", - wooStatus: "Pending payment", - notice: context => noticeLines.expired(context.method.id), - action: async (page) => { - await checkExpiredAtMollie(page); - } - }, - ]; - - testData.forEach(({ testId, mollieStatus, wooStatus, notice, action }) => { - test(`[${testId}] Validate the submission of an order with SOFORT as payment method and payment mark as "${mollieStatus} on pay for order page"`, async ({ page, products, context }) => { - await selectPaymentMethodInCheckout(page, context.methodName); - const totalAmount = await captureTotalAmountPayPage(page); - await placeOrderPayPage(page); - const mollieOrder = await processMollieCheckout(page, mollieStatus); - const result = {mollieOrder: mollieOrder, totalAmount: totalAmount}; - await action(page, result, context); - await wooOrderDetailsPage(page, result.mollieOrder, context.method, wooStatus, notice(context)); - }); - }); -}); diff --git a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_voucher.spec.js b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_voucher.spec.js deleted file mode 100644 index 6982b3d5d..000000000 --- a/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_voucher.spec.js +++ /dev/null @@ -1,40 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../../Shared/base-test'); - -test.describe('_Transaction scenarios_Payment statuses - Pay for order page - Voucher', () => { - test.beforeEach(async ({ page }) => { - //code before each - }); - - -//TestId-C420354 -test.skip('Validate the submission of an order with a ECO Voucher and marked as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420355 -test.skip('Validate the submission of an order with a MEAL Voucher and marked as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420356 -test.skip('Validate the submission of an order with a GIFT Voucher and marked as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420357 -test.skip('Validate the submission of an order with any payment method including a Voucher and marked as "Paid" on pay for order page', async ({ page}) => { - // Your code here... -}); - - -//TestId-C420358 -test.skip('Validate the submission of an order were the total value is paid with a Voucher on pay for order page', async ({ page}) => { - // Your code here... -}); - - -}); diff --git a/tests/e2e/WooCommerce Payments tab/_woocommerce_payments_tab.spec.js b/tests/e2e/WooCommerce Payments tab/_woocommerce_payments_tab.spec.js deleted file mode 100644 index 7966c9c00..000000000 --- a/tests/e2e/WooCommerce Payments tab/_woocommerce_payments_tab.spec.js +++ /dev/null @@ -1,43 +0,0 @@ -const {expect} = require('@playwright/test'); -const {test} = require('../Shared/base-test'); -const {gotoWooPaymentTab} = require("../Shared/wooUtils"); -const {getMethodNames} = require("../Shared/gateways"); -const {resetSettings, insertAPIKeys, setOrderAPI} = require("../Shared/mollieUtils"); - -test.describe(' - WooCommerce Payments tab', () => { - test.beforeAll(async ({browser}) => { - // Create a new page instance - const page = await browser.newPage(); - // Reset to the default state - await resetSettings(page); - await insertAPIKeys(page); - }); - test.beforeEach(async ({page}) => { - await gotoWooPaymentTab(page); - }); - - test('[C419984] Validate that all payment methods are displayed per UI design', async ({page}) => { - const methodNames = getMethodNames(); - const locator = page.locator('a.wc-payment-gateway-method-title'); - const allMethodsPresent = await locator.evaluateAll((elements, names) => { - const displayedMethods = elements.map((element) => { - let methodName = element.textContent.trim(); - methodName = methodName.replace('Mollie - ', ''); - return methodName; - }); - const foundMethods = names.map((name) => { - return displayedMethods.includes(name); - }); - return foundMethods.every((found) => found === true); - }, methodNames); - expect(allMethodsPresent).toBe(true); - }); - - test.skip('[C419985] Validate that all payment methods can be managed', async ({page}) => { - // This will be tested in the settings tab of every payment method - }); - - test.skip('[C3324] Validate that the order of the payment methods can be changed', async ({page}) => { - // This is a functionality of WooCommerce, not of the plugin - }); -}); diff --git a/tests/e2e/globalSetup.js b/tests/e2e/globalSetup.js deleted file mode 100644 index 5148a8dd9..000000000 --- a/tests/e2e/globalSetup.js +++ /dev/null @@ -1,12 +0,0 @@ -import { chromium } from '@playwright/test'; -const { loginAdmin } = require('./Shared/wpUtils'); -async function globalSetup(config) { - const { baseURL, storageState } = config.projects[0].use; - const browser = await chromium.launch(); - const page = await browser.newPage({ baseURL: baseURL, extraHTTPHeaders: {'ngrok-skip-browser-warning': '123'}}); - await loginAdmin(page); - await page.context().storageState({ path: storageState }); - await browser.close(); -} - -export default globalSetup; diff --git a/tests/e2e/methodsConfig.json b/tests/e2e/methodsConfig.json deleted file mode 100644 index 3ce25599a..000000000 --- a/tests/e2e/methodsConfig.json +++ /dev/null @@ -1,340 +0,0 @@ -{ - "applepay": { - "id": "applepay", - "defaultTitle": "__(\"Apple Pay\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"To accept payments via Apple Pay\", \"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds", - "subscriptions" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "Subscription": true - }, - "bancontact": { - "id": "bancontact", - "defaultTitle": "__(\"Bancontact\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": true, - "SEPA": true - }, - "banktransfer": { - "id": "banktransfer", - "defaultTitle": "__(\"Bank transfer\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": true, - "confirmationDelayed": true, - "SEPA": false, - "customRedirect": true - }, - "belfius": { - "id": "belfius", - "defaultTitle": "__(\"Belfius Pay Button\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": true, - "SEPA": true - }, - "billie": { - "id": "billie", - "defaultTitle": "__(\"Billie\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"To accept payments via Billie, all default WooCommerce checkout fields should be enabled and required.\",\"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "orderMandatory": true, - "errorMessage": "__(\"Company field is empty. To proceed with Billie payment the company field is required.\",\"mollie-payments-for-woocommerce\")", - "companyPlaceholder": "__(\"To proceed with Billie, please enter your company name here.\", \"mollie-payments-for-woocommerce\")" - }, - "creditcard": { - "id": "creditcard", - "defaultTitle": "__(\"Credit/Debit Card\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds", - "subscriptions" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "Subscription": true - }, - "directdebit": { - "id": "directdebit", - "defaultTitle": "__(\"SEPA Direct Debit\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"SEPA Direct Debit is used for recurring payments with WooCommerce Subscriptions, and will not be shown in the WooCommerce checkout for regular payments! You also need to enable iDEAL and/or other \"first\" payment methods if you want to use SEPA Direct Debit.\", \"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": true - }, - "eps": { - "id": "eps", - "defaultTitle": "__(\"eps\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": true, - "SEPA": true - }, - "giftcard": { - "id": "giftcard", - "defaultTitle": "__(\"Gift cards\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "__(\"Select your gift card\", \"mollie-payments-for-woocommerce\")", - "paymentFields": true, - "instructions": false, - "supports": [ - "products" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false - }, - "giropay": { - "id": "giropay", - "defaultTitle": "__(\"giropay\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": true, - "SEPA": true - }, - "ideal": { - "id": "ideal", - "defaultTitle": "__(\"iDEAL\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "__(\"Select your bank\", \"mollie-payments-for-woocommerce\")", - "paymentFields": true, - "instructions": true, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": true, - "SEPA": true - }, - "in3": { - "id": "in3", - "defaultTitle": "__(\"Pay in 3 instalments, 0% interest\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "__(\"Pay in 3 instalments, 0% interest\",\"mollie-payments-for-woocommerce\")", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "orderMandatory": true - }, - "kbc": { - "id": "kbc", - "defaultTitle": "__(\"KBC/CBC Payment Button\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "__(\"Select your bank\", \"mollie-payments-for-woocommerce\")", - "paymentFields": true, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": true, - "SEPA": true - }, - "klarnapaylater": { - "id": "klarnapaylater", - "defaultTitle": "__(\"Pay later.\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"To accept payments via Klarna, all default WooCommerce checkout fields should be enabled and required.\", \"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "orderMandatory": true - }, - "klarnapaynow": { - "id": "klarnapaynow", - "defaultTitle": "__(\"Pay now.\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"To accept payments via Klarna, all default WooCommerce checkout fields should be enabled and required.\", \"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "orderMandatory": true - }, - "klarnasliceit": { - "id": "klarnasliceit", - "defaultTitle": "__(\"Slice it.\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"To accept payments via Klarna, all default WooCommerce checkout fields should be enabled and required.\", \"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "orderMandatory": true - }, - "mybank": { - "id": "mybank", - "defaultTitle": "__(\"MyBank\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"To accept payments via MyBank\", \"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": true - }, - "paypal": { - "id": "paypal", - "defaultTitle": "__(\"PayPal\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false - }, - "paysafecard": { - "id": "paysafecard", - "defaultTitle": "__(\"paysafecard\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false - }, - "przelewy24": { - "id": "przelewy24", - "defaultTitle": "__(\"Przelewy24\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "__(\"To accept payments via Przelewy24, a customer email is required for every payment.\", \"mollie-payments-for-woocommerce\")", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false - }, - "sofort": { - "id": "sofort", - "defaultTitle": "__(\"SOFORT Banking\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": true, - "supports": [ - "products", - "refunds" - ], - "filtersOnBuild": false, - "confirmationDelayed": true, - "SEPA": true - }, - "voucher": { - "id": "voucher", - "defaultTitle": "__(\"Vouchers\", \"mollie-payments-for-woocommerce\")", - "settingsDescription": "", - "defaultDescription": "", - "paymentFields": false, - "instructions": false, - "supports": [ - "products" - ], - "filtersOnBuild": false, - "confirmationDelayed": false, - "SEPA": false, - "orderMandatory": true - } -} diff --git a/tests/qa/.env.example b/tests/qa/.env.example new file mode 100644 index 000000000..7fb421ca1 --- /dev/null +++ b/tests/qa/.env.example @@ -0,0 +1,24 @@ +# MUtkin test singlesite, PHP 8.1 +# playwright-utils config +WP_BASE_URL='https://' +WP_USERNAME= +WP_PASSWORD= +WP_BASIC_AUTH_USER= +WP_BASIC_AUTH_PASS= +STORAGE_STATE_PATH='./storage-states' +STORAGE_STATE_PATH_ADMIN='./storage-states/admin.json' + +# WooCommerce API config +WC_API_KEY= +WC_API_SECRET= + +# Mollie +MOLLIE_LIVE_API_KEY= +MOLLIE_TEST_API_KEY= + +# Testrail +TESTRAIL_URL= +TESTRAIL_USERNAME= +TESTRAIL_PASSWORD= +TESTRAIL_PLAN_ID= +TESTRAIL_RUN_ID= \ No newline at end of file diff --git a/tests/qa/.gitignore b/tests/qa/.gitignore new file mode 100644 index 000000000..8fc08843a --- /dev/null +++ b/tests/qa/.gitignore @@ -0,0 +1,13 @@ +.idea +.vscode +node_modules +playwright-utils +playwright-report +playwright/.cache +storage-states +test-results +package-lock.json +playwright-wordpress-credentials.json + +.env* +!.env.example \ No newline at end of file diff --git a/tests/qa/.npmrc b/tests/qa/.npmrc new file mode 100644 index 000000000..426867c0c --- /dev/null +++ b/tests/qa/.npmrc @@ -0,0 +1 @@ +@inpsyde:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/tests/qa/README.md b/tests/qa/README.md new file mode 100644 index 000000000..212e690f2 --- /dev/null +++ b/tests/qa/README.md @@ -0,0 +1,218 @@ +# Mollie Tests Repo + +Mollie Playwright tests. Depends on [`@inpsyde/playwright-utils`](https://github.com/inpsyde/playwright-utils) package. + +__\* - Currently the `@inpsyde/playwright-utils` needs to be installed locally (see section _Installation for local development_ below) and switched to branch `work/misha`.__ + +## Repo structure + +- `resources` - files with test-data, images, project related installation packages, types, etc. + +- `tests` - test specifications. For payment plugins contains following folders: + + - `01-plugin-foundation` - general tests for plugin installation, uninstallation, activation, deactivation, display of plugin in __WooCommerce -> Settings -> Payments__. + + - `02-merchant-setup` - tests for connection of current plugin instance to the payment system provider API via merchant (seller) credentials. + + - `03-plugin-settings` - tests for various plugin settings, may include assertions of settings effect on frontend. + + - `04-frontend-ui` - tests for plugin UI on frontend: display of payment buttons, display of payment methods depending on customer's country, etc. + + - `05-transaction` - tests of payment process. Typically include: adding products to cart as precondition, payment (transaction) process, assertions on order received page, dashboard order edit page, payment via payment system provider API. + + - `06-refund` - tests for refund transactions. Typically include: finished transaction as precondition, refund via payment system provider API on dashboard order edit page, assertion of refund statuses. + + - `07-vaulting` - tests for transactions with enabled vaulting (saved payment methods for registered customers). Ability to remember payment methods and use them for transactions. + + - `08-subscriptions` - tests for transactions for subscription products. Requires WooCommerce Subscriptions plugin. Usually available to registered customers and also includes vaulting and renewal of subscription (with automatic payment). WooCommerce Subscriptions plugin (can be [downloaded here](https://woocommerce.com/my-account/downloads/), login credentials in 1Password). + + - `09-compatibility` - tests for compatibility with other themes, plugins, etc. + + \* - folders are numerated on purpose, to force correct sequence of tests - from basic to advanced. Although each test should be independent and work separately, it is better to start testing from `plugin-foundation` and move to more complex tests. + + \*\* - folders and numeration can be different, based on project requirements. + +- `utils` - project related utility files, built on top of `@inpsyde/playwright-utils`. + + - `admin` - functionality for operating dashboard pages. + + - `frontend` - functionality for operating frontend pages, hosted checkout pages (payment system provider's pages). + + - `test.ts` - declarations of project related test fixtures. + + - other project related functionality, like helpers, APIs, urls. + +- `.env`, `playwright.config.ts`, `package.json` - see below. + +## Installation of `@inpsyde/playwright-utils` + +### Installation as a node package + +1. Remove `"workspaces": [ "playwright-utils" ]` from `package.json`. + +2. In the test project (`./tests/qa`) run following command: + +```bash +npm run setup:tests +``` + +### Installation for local development + +1. Add `"workspaces": [ "playwright-utils" ]` to `package.json`. + +2. Delete `@inpsyde/playwright-utils` from `/node_modules`. + +3. In the test project (`./tests/qa`) run following command: + + ```bash + git clone https://github.com/inpsyde/playwright-utils.git + ``` + + [`@inpsyde/playwright-utils`](https://github.com/inpsyde/playwright-utils) repository should be cloned as `playwright-utils` right inside the root directory of monorepo. + +4. Restart VSCode editor. This will create `playwright-utils` instance in the source control tab of VSCode editor. + +5. Run following command: + + ```bash + npm run setup:utils + ``` + +6. `@inpsyde/playwright-utils` should reappear in node_modules. Following message (coming from `tsc-watch`) should be displayed in the terminal: + + ```bash + 10:00:00 - Found 0 errors. Watching for file changes. + ``` + +7. If you plan to make changes in `playwright-utils` keep current terminal window opened and create another instance of terminal. + +## Project configuration + +Project from the monorepo requires a working WordPress website with WooCommmerce, `.env` file and configured Playwright. + +1. [SSE setup](https://inpsyde.atlassian.net/wiki/spaces/AT/pages/3175907370/Self+Service+WordPress+Environment) - will be deprecated in Q1 of 2025. + +2. Tested user with Administrator role should be created + +2. In the Dashboard navigate to __Settings -> Permalinks__ and select `Post name` in __Permalink structure__ for correct format of REST path. + +3. Install __Storefront__ theme. + +4. Install __WooCommerce__ plugin. + +5. In __WooCommerce -> Settings -> Advanced -> REST API__ create _Consumer Key_ and _Secret_ with Read/Write permissions and store them in `.env`. + +6. To avoid conflicts make sure any other payment plugins are deleted. + +7. Configure `.env` file following [these steps](https://github.com/inpsyde/playwright-utils?tab=readme-ov-file#env-variables). See also `.env.example`. + +8. Configure `playwright.config.ts` of the project following [these steps](https://github.com/inpsyde/playwright-utils?tab=readme-ov-file#playwright-configuration). + +9. Reporting. Add `testrail-reporter` in the reporter section of `playwright.config.ts`: + + ```ts + reporter: [ + // other reporters ... + [ '@inpsyde/playwright-utils/build/integration/testrail/testrail-reporter.js' ], + ], + ``` + + Configure connection to TestRail API in `.env` (see `.env.example`): + + ```bash + # Testrail + TESTRAIL_URL=https://website.testrail.io + TESTRAIL_USERNAME=user@company.com + TESTRAIL_PASSWORD=************* + TESTRAIL_PLAN_ID= + TESTRAIL_RUN_ID= + ``` + +## Run tests + +To execute all tests sequentially, in the terminal navigate to the `./tests/qa` directory and run following command: + +```bash +npx playwright test --project=all +``` + +### Additional options to run tests from command line + +- Add scripts to `package.json` of the project (eligible for Windows, not tested on other OS): + + ```json + "scripts": { + "all": "npx playwright test --project=all --workers=1", + "sequential": "npx playwright test --project=sequential --workers=1", + "parallel-transaction-eur-block": "npx playwright test --project=transaction-eur-block --workers=3" + }, + ``` + + Run script with the following command: + + ```bash + npm run parallel-transaction-eur-block + ``` + + \* - there's a number of tests which can be executed in parallel to speed up test execution (see `projects` section in `playwright.config.ts`). + +- Run several tests by test ID + + - MacOS, Linux: + + ```bash + npx playwright test --grep "C123|C124|C125" + ``` + + - Windows (Powershell): + + ```bash + npx playwright test --grep --% "C123^|C124^|C125" + ``` + + It may be required additionally to specify the project (if tests relate to more then one project): + + ```bash + npx playwright test --project "project-name" --grep --% "C123^|C124^|C125" + ``` + + +## Autotest Execution workflow + +1. Create test plan with run in TestRail, named after the tested plugin version, for example "Test Plan for Release 1.2.3". + + \* - for autotest run there's no need to manually add tests cases to the run - the executed test will be added automatically before automated execution. + +2. Link release ticket (via `tests: JIR-234`). + +3. Set Test Execution ticket status `In progress`. + +4. Add/update test plan with run IDs in `.env` file of the project (`TESTRAIL_PLAN_ID, TESTRAIL_RUN_ID`). + +5. Download tested plugin `.zip` package (usually attached to release ticket) and add it to `/project//resources/files`. You may need to remove version number from the file name. + +6. Optional: delete previous version of tested plugin from the website if you don't execute __plugin foundation__ tests. + +7. Start autotest execution from command line for the defined scope of tests (e.g. all, Critical, etc.). You should see `Test plan ID: 001, Test run ID: 002` in the terminal. + +8. When finished test results should be exported to the specified test run ticket in Testrail. + +9. Analyze failed tests (if any). Restart execution for failed tests, possibly in debug mode (see section _Additional options to run tests from command line_): + + ```bash + npx playwright test --grep --% "C123^|C124^|C125" --debug + ``` + + \* - command for restarting failed/skipped tests is posted to the terminal after the execution. + +10. Report bugs (if any) and attach them to the test-runs of failed tests. + +11. If needed fix failing tests in a new branch, create a PR and assign it for review. + +## Coding standards + +Before commiting changes run following command: + +```bash +npm run lint:js:fix +``` diff --git a/tests/qa/global-setup.ts b/tests/qa/global-setup.ts new file mode 100644 index 000000000..6b53b756f --- /dev/null +++ b/tests/qa/global-setup.ts @@ -0,0 +1,29 @@ +/** + * External dependencies + */ +import { FullConfig } from '@playwright/test'; +import { restLogin, guestStorageState } from '@inpsyde/playwright-utils/build'; + +async function globalSetup( config: FullConfig ) { + const projectUse = config.projects[ 0 ].use; + + await restLogin( { + baseURL: projectUse.baseURL, + storageStatePath: String( projectUse.storageState ), + httpCredentials: projectUse.httpCredentials, + user: { + // @ts-ignore + username: process.env.WP_USERNAME, + // @ts-ignore + password: process.env.WP_PASSWORD, + }, + } ); + + await guestStorageState( { + baseURL: projectUse.baseURL, + httpCredentials: projectUse.httpCredentials, + storageStatePath: `${ process.env.STORAGE_STATE_PATH }/guest.json`, + } ); +} + +export default globalSetup; diff --git a/tests/qa/package.json b/tests/qa/package.json new file mode 100644 index 000000000..0a847a67c --- /dev/null +++ b/tests/qa/package.json @@ -0,0 +1,61 @@ +{ + "name": "mollie-playwright-tests", + "version": "1.0.0", + "description": "Playwright e2e tests for Mollie", + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/inpsyde/playwright-tests.git" + }, + "author": { + "name": "Inpsyde GmbH", + "email": "hello@inpsyde.com", + "url": "https://inpsyde.com/" + }, + "license": "GPL-3.0-or-later", + "bugs": { + "url": "https://github.com/inpsyde/playwright-tests/issues" + }, + "homepage": "https://github.com/inpsyde/playwright-tests#readme", + "dependencies": { + "@inpsyde/playwright-utils": "^2.0.0-beta.2", + "dotenv": "^16.3.1", + "dotenv-cli": "^7.3.0", + "playwright": "^1.40.1", + "yarn": "^1.22.21" + }, + "devDependencies": { + "@percy/cli": "^1.28.0", + "@percy/playwright": "^1.0.4", + "@playwright/test": "^1.38.1", + "@types/node": "^20.8.4", + "@wordpress/scripts": "^25.0.0" + }, + "scripts": { + "setup:tests": "npm install && npx playwright install", + "setup:utils": "npm run setup:tests && cd ./playwright-utils && yarn devLocal", + "lint:md": "wp-scripts lint-md-docs ./**/*.md README.md", + "lint:js": "wp-scripts lint-js ./**/*.{ts,tsx,mjs} projects/**/.*/*.{ts,tsx,mjs}", + "lint:js:fix": "wp-scripts lint-js --fix ./**/*.{ts,tsx,mjs} ./**/**/*.{ts,tsx,mjs} ./**/.*/*.{ts,tsx,mjs} ./**/**/.*/*.{ts,tsx,mjs}", + "all": "npx playwright test --project=all --workers=1", + "sequential": "npx playwright test --project=sequential --workers=1", + "parallel-transaction-eur-classic": "npx playwright test --project=transaction-eur-classic --workers=5", + "parallel-transaction-eur-block": "npx playwright test --project=transaction-eur-block --workers=3", + "transaction-non-eur": "npx playwright test --project=transaction-non-eur workers=1", + "parallel-transactions": "npm run parallel-transaction-eur-block & npm run parallel-transaction-eur-classic", + "all-with-parallel": "npm run sequential & npm run parallel-transactions" + }, + "eslintConfig": { + "extends": [ + "plugin:@wordpress/eslint-plugin/recommended" + ], + "rules": { + "@wordpress/dependency-group": "error", + "@wordpress/no-unsafe-wp-apis": "off", + "no-console": "off" + } + }, + "workspaces": [ + "playwright-utils" + ] +} diff --git a/tests/qa/playwright.config.ts b/tests/qa/playwright.config.ts new file mode 100644 index 000000000..3124a835d --- /dev/null +++ b/tests/qa/playwright.config.ts @@ -0,0 +1,130 @@ +/** + * External dependencies + */ +import { defineConfig, devices } from '@playwright/test'; +require( 'dotenv' ).config(); + +export default defineConfig( { + testDir: 'tests', + expect: { + timeout: 10 * 1000, + }, + timeout: 1 * 60 * 1000, + /* Run tests in files in parallel */ + fullyParallel: true, + /* Fail the build on CI if you accidentally left test.only in the source code. */ + forbidOnly: !! process.env.CI, + /* Retry on CI only */ + retries: process.env.CI ? 2 : 0, + /* Opt out of parallel tests on CI. */ + workers: process.env.CI ? 1 : 1, + /* Reporter to use. See https://playwright.dev/docs/test-reporters */ + reporter: process.env.CI + ? [ + [ 'list' ], + // [ 'html', { outputFolder: 'playwright-report' } ], + [ + '@inpsyde/playwright-utils/build/integration/testrail/testrail-reporter.js', + ], + ] + : [ + [ 'list' ], + // [ 'html', { outputFolder: 'playwright-report' } ], + [ + '@inpsyde/playwright-utils/build/integration/testrail/testrail-reporter.js', + ], + ], + /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ + + globalSetup: require.resolve( './global-setup' ), + + use: { + baseURL: process.env.WP_BASE_URL, + + storageState: process.env.STORAGE_STATE_PATH_ADMIN, + + httpCredentials: { + // @ts-ignore + username: process.env.WP_BASIC_AUTH_USER, + // @ts-ignore + password: process.env.WP_BASIC_AUTH_PASS, + }, + + /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ + trace: 'on-first-retry', + + // Capture screenshot after each test failure. + screenshot: 'only-on-failure', //'off', // + + // Record video only when retrying a test for the first time. + video: 'retain-on-failure', //'on', // + + ...devices[ 'Desktop Chrome' ], + + viewport: { width: 1280, height: 850 }, + }, + + /* Configure projects for major browsers */ + projects: [ + { + name: 'setup-woocommerce', + testMatch: /woocommerce\.setup\.ts/, + fullyParallel: false, + }, + { + name: 'setup-mollie', + testMatch: /mollie-default\.setup\.ts/, + dependencies: [ 'setup-woocommerce' ], + fullyParallel: false, + }, + { + name: 'setup-pages-classic', + testMatch: /pages-classic\.setup\.ts/, + dependencies: [ 'setup-woocommerce' ], + fullyParallel: false, + }, + { + name: 'setup-pages-block', + testMatch: /pages-block\.setup\.ts/, + dependencies: [ 'setup-woocommerce' ], + fullyParallel: false, + }, + { + name: 'all', + dependencies: [ 'setup-woocommerce' ], + fullyParallel: false, + }, + { + name: 'sequential', + dependencies: [ 'setup-woocommerce' ], + fullyParallel: false, + testIgnore: [ + 'eur-checkout-classic.spec.ts', + 'eur-checkout.spec.ts', + 'eur-pay-for-order.spec.ts', + ], + }, + { + name: 'transaction-non-eur', + dependencies: [ 'setup-mollie' ], + testMatch: [ + 'non-eur-checkout-classic.spec.ts', + 'non-eur-checkout.spec.ts', + 'non-eur-pay-for-order.spec.ts', + ], + fullyParallel: false, + }, + { + name: 'transaction-eur-classic', + dependencies: [ 'setup-mollie', 'setup-pages-classic' ], + testMatch: [ 'eur-checkout-classic.spec.ts' ], + fullyParallel: true, + }, + { + name: 'transaction-eur-block', + dependencies: [ 'setup-mollie', 'setup-pages-block' ], + testMatch: [ 'eur-checkout.spec.ts', 'eur-pay-for-order.spec.ts' ], + fullyParallel: true, + }, + ], +} ); diff --git a/tests/qa/resources/cards.ts b/tests/qa/resources/cards.ts new file mode 100644 index 000000000..c3afa27d3 --- /dev/null +++ b/tests/qa/resources/cards.ts @@ -0,0 +1,14 @@ +export const cardTypes = [ 'Visa' ]; + +const visa: WooCommerce.CreditCard = { + card_holder: 'Carl Holdersson', + card_number: '4543474002249996', + expiration_date: '12/30', + card_cvv: '123', +}; + +export const cards: { + [ key: string ]: WooCommerce.CreditCard; +} = { + visa, +}; diff --git a/tests/qa/resources/disable-nonce-plugin.ts b/tests/qa/resources/disable-nonce-plugin.ts new file mode 100644 index 000000000..97f4bde3e --- /dev/null +++ b/tests/qa/resources/disable-nonce-plugin.ts @@ -0,0 +1,7 @@ +export default { + name: 'Disable nonce check', + slug: 'disable-nonce-check', + zipFile: 'disable-nonce.zip', + zipFilePath: './resources/files/disable-nonce.zip', + version: '', +}; diff --git a/tests/qa/resources/files/disable-nonce.zip b/tests/qa/resources/files/disable-nonce.zip new file mode 100644 index 000000000..52297a2d5 Binary files /dev/null and b/tests/qa/resources/files/disable-nonce.zip differ diff --git a/tests/qa/resources/files/disable-wc-setup-wizard.zip b/tests/qa/resources/files/disable-wc-setup-wizard.zip new file mode 100644 index 000000000..9d316ff25 Binary files /dev/null and b/tests/qa/resources/files/disable-wc-setup-wizard.zip differ diff --git a/tests/qa/resources/files/mollie-payments-for-woocommerce.zip b/tests/qa/resources/files/mollie-payments-for-woocommerce.zip new file mode 100644 index 000000000..d07bb3d61 Binary files /dev/null and b/tests/qa/resources/files/mollie-payments-for-woocommerce.zip differ diff --git a/tests/e2e/Shared/test-logo.png b/tests/qa/resources/files/mollie-test-logo.png similarity index 100% rename from tests/e2e/Shared/test-logo.png rename to tests/qa/resources/files/mollie-test-logo.png diff --git a/tests/qa/resources/files/woocommerce-subscriptions.zip b/tests/qa/resources/files/woocommerce-subscriptions.zip new file mode 100644 index 000000000..a7392424d Binary files /dev/null and b/tests/qa/resources/files/woocommerce-subscriptions.zip differ diff --git a/tests/qa/resources/gateways.ts b/tests/qa/resources/gateways.ts new file mode 100644 index 000000000..3edcb1891 --- /dev/null +++ b/tests/qa/resources/gateways.ts @@ -0,0 +1,477 @@ +/** + * Internal dependencies + */ +import { MollieGateway, MollieSettings } from './types'; + +export const defaultGatewaySettings: MollieSettings.Gateway = { + enabled: true, + use_api_title: 'no', + display_logo: 'yes', + enable_custom_logo: 'no', + description: '', + 'allowed_countries[]': [], + + payment_surcharge: 'no_fee', + fixed_fee: '', + maximum_limit: '', + percentage: '', + surcharge_limit: '', + + activate_expiry_days_setting: 'no', + order_dueDate: '10', + mollie_components_enabled: 'no', +}; + +const alma: MollieGateway = { + country: 'france', // Belgium also supported + minAmount: '50.00', + maxAmount: '2000.00', + slug: 'alma', + name: 'Pay in 3 or 4 installments free of charge', + settings: { + ...defaultGatewaySettings, + title: 'Pay in 3 or 4 installments free of charge', + }, +}; + +const applepay: MollieGateway = { + country: 'germany', // Global availability + minAmount: '0.01', + slug: 'applepay', + name: 'Apple Pay', + settings: { + ...defaultGatewaySettings, + title: 'Apple Pay', + mollie_apple_pay_button_enabled_cart: 'no', + mollie_apple_pay_button_enabled_product: 'no', + mollie_apple_pay_button_enabled_express_checkout: 'no', + }, +}; + +const bacs: MollieGateway = { + country: 'uk', + minAmount: '1.00', + slug: 'bacs', + name: 'BACS Direct Debit', + currency: 'GBP', + settings: { + ...defaultGatewaySettings, + title: 'BACS Direct Debit', + }, +}; + +const bancomatpay: MollieGateway = { + country: 'italy', + minAmount: '0.01', + slug: 'bancomatpay', + name: 'Bancomat Pay', + settings: { + ...defaultGatewaySettings, + title: 'Bancomat Pay', + }, +}; + +const bancontact: MollieGateway = { + country: 'belgium', + minAmount: '1.00', + maxAmount: '50000.00', + slug: 'bancontact', + name: 'Bancontact', + settings: { + ...defaultGatewaySettings, + title: 'Bancontact', + initial_order_status: 'on-hold', + }, +}; + +const banktransfer: MollieGateway = { + country: 'germany', // Europe + minAmount: '1.00', + slug: 'banktransfer', + name: 'Bank transfer', + settings: { + ...defaultGatewaySettings, + title: 'Bank transfer', + initial_order_status: 'on-hold', + order_dueDate: '12', + skip_mollie_payment_screen: 'no', + }, +}; + +const belfius: MollieGateway = { + country: 'belgium', + minAmount: '0.01', + slug: 'belfius', + name: 'Belfius Pay Button', + settings: { + ...defaultGatewaySettings, + title: 'Belfius Pay Button', + initial_order_status: 'on-hold', + }, +}; + +const billie: MollieGateway = { + country: 'germany', // Netherlands also supported + minAmount: '100.00', + maxAmount: '50000.00', + slug: 'billie', + name: 'Pay by Invoice for Businesses - Billie', + settings: { + ...defaultGatewaySettings, + title: 'Pay by Invoice for Businesses - Billie', + }, +}; + +const blik: MollieGateway = { + country: 'poland', + minAmount: '1.00', + maxAmount: '10000.00', + slug: 'blik', + name: 'Blik', + currency: 'PLN', + settings: { + ...defaultGatewaySettings, + title: 'Blik', + }, +}; + +const creditcard: MollieGateway = { + country: 'germany', // Global availability + minAmount: '0.01', + slug: 'creditcard', + name: 'Card', + settings: { + ...defaultGatewaySettings, + title: 'Card', + mollie_components_enabled: 'no', + mollie_creditcard_icons_enabler: 'no', + mollie_creditcard_icons_amex: 'no', + mollie_creditcard_icons_cartasi: 'no', + mollie_creditcard_icons_cartebancaire: 'no', + mollie_creditcard_icons_maestro: 'no', + mollie_creditcard_icons_mastercard: 'no', + mollie_creditcard_icons_visa: 'no', + mollie_creditcard_icons_vpay: 'no', + }, +}; + +const directdebit: MollieGateway = { + country: 'germany', // Europe + minAmount: '1.00', + slug: 'directdebit', + name: 'SEPA Direct Debit', + settings: { + ...defaultGatewaySettings, + title: 'SEPA Direct Debit', + initial_order_status: 'on-hold', + }, +}; + +const eps: MollieGateway = { + country: 'austria', + minAmount: '0.01', + slug: 'eps', + name: 'eps', + settings: { + ...defaultGatewaySettings, + title: 'eps', + initial_order_status: 'on-hold', + }, +}; + +const giftcard: MollieGateway = { + country: 'germany', + minAmount: '0.01', + slug: 'giftcard', + name: 'Gift cards', + settings: { + ...defaultGatewaySettings, + title: 'Gift cards', + description: 'Select your gift card', + issuers_dropdown_shown: 'no', + issuers_empty_option: 'Select your gift card', + }, +}; + +const ideal: MollieGateway = { + country: 'netherlands', + minAmount: '1.00', + maxAmount: '50000.00', + slug: 'ideal', + name: 'iDEAL', + settings: { + ...defaultGatewaySettings, + title: 'iDEAL', + initial_order_status: 'on-hold', + }, +}; + +const in3: MollieGateway = { + country: 'netherlands', + minAmount: '100.00', + maxAmount: '5000.00', + slug: 'in3', + name: 'iDEAL Pay in 3 instalments, 0% interest', + settings: { + ...defaultGatewaySettings, + title: 'iDEAL Pay in 3 instalments, 0% interest', + description: 'iDEAL Pay in 3 instalments, 0% interest', + }, +}; + +const kbc: MollieGateway = { + country: 'belgium', + minAmount: '1.00', + slug: 'kbc', + name: 'KBC/CBC Payment Button', + settings: { + ...defaultGatewaySettings, + title: 'KBC/CBC Payment Button', + description: 'Select your bank', + issuers_dropdown_shown: 'yes', + issuers_empty_option: 'Select your bank', + initial_order_status: 'on-hold', + }, +}; + +const klarna: MollieGateway = { + country: 'germany', // AT, BE, DK, FI, FR, DE, IT, IE, NL, NO, PT, ES, SE, IE, CH, UK + minAmount: '1.00', + slug: 'klarna', + name: 'Pay with Klarna', + settings: { + ...defaultGatewaySettings, + title: 'Pay with Klarna', + }, +}; + +const mybank: MollieGateway = { + country: 'italy', + minAmount: '1.00', + slug: 'mybank', + name: 'MyBank', + settings: { + ...defaultGatewaySettings, + title: 'MyBank', + }, +}; + +const paybybank: MollieGateway = { + country: 'uk', + minAmount: '1.00', + slug: 'paybybank', + name: 'Pay by Bank', + currency: 'GBP', + settings: { + ...defaultGatewaySettings, + title: 'Pay by Bank', + }, +}; + +const payconiq: MollieGateway = { + country: 'belgium', + minAmount: '0.01', + slug: 'payconiq', + name: 'Payconiq', + settings: { + ...defaultGatewaySettings, + title: 'Payconiq', + }, +}; + +const paypal: MollieGateway = { + country: 'germany', // Global availability + minAmount: '0.01', + slug: 'paypal', + name: 'PayPal', + settings: { + ...defaultGatewaySettings, + title: 'PayPal', + mollie_paypal_button_enabled_cart: 'no', + mollie_paypal_button_enabled_product: 'no', + paypal_color: 'en-buy-pill-blue', + mollie_paypal_button_minimum_amount: '0', + }, +}; + +const paysafecard: MollieGateway = { + country: 'germany', + minAmount: '1.00', + maxAmount: '1000.00', + slug: 'paysafecard', + name: 'paysafecard', + settings: { + ...defaultGatewaySettings, + title: 'paysafecard', + }, +}; + +const pointofsale: MollieGateway = { + country: 'germany', + minAmount: '1.00', + slug: 'pointofsale', + name: 'Point of sale', + settings: { + ...defaultGatewaySettings, + title: 'Point of sale', + }, +}; + +const przelewy24: MollieGateway = { + country: 'poland', + minAmount: '1.00', + slug: 'przelewy24', + name: 'Przelewy24', + settings: { + ...defaultGatewaySettings, + title: 'Przelewy24', + }, +}; + +const riverty: MollieGateway = { + country: 'germany', + minAmount: '50.00', + maxAmount: '2000.00', + slug: 'riverty', + name: 'Buy now, pay later with Riverty', + settings: { + ...defaultGatewaySettings, + title: 'Buy now, pay later with Riverty', + }, +}; + +const satispay: MollieGateway = { + country: 'italy', + minAmount: '1.00', + slug: 'satispay', + name: 'Satispay', + settings: { + ...defaultGatewaySettings, + title: 'Satispay', + }, +}; + +const trustly: MollieGateway = { + country: 'germany', // Europe + minAmount: '1.00', + slug: 'trustly', + name: 'Trustly', + settings: { + ...defaultGatewaySettings, + title: 'Trustly', + initial_order_status: 'on-hold', + }, +}; + +const twint: MollieGateway = { + country: 'switzerland', + minAmount: '0.01', + slug: 'twint', + name: 'TWINT', + currency: 'CHF', + settings: { + ...defaultGatewaySettings, + title: 'TWINT', + }, +}; + +const voucher: MollieGateway = { + country: 'germany', + minAmount: '1.00', + slug: 'voucher', + name: 'Vouchers', + settings: { + ...defaultGatewaySettings, + title: 'Vouchers', + mealvoucher_category_default: 'no_category', + }, +}; + +// Deprecated gateways +const giropay: MollieGateway = { + country: 'germany', + minAmount: '1.00', + slug: 'giropay', + name: 'Giropay', + settings: { + ...defaultGatewaySettings, + title: 'Giropay', + initial_order_status: 'on-hold', + }, +}; + +const klarnapaylater: MollieGateway = { + country: 'germany', // Austria, Germany, Netherlands + minAmount: '50.00', + maxAmount: '2000.00', + slug: 'klarnapaylater', + name: 'Pay later.', + settings: { + ...defaultGatewaySettings, + title: 'Pay later.', + }, +}; + +const klarnapaynow: MollieGateway = { + country: 'germany', // Austria, Germany, Netherlands + minAmount: '50.00', + maxAmount: '2000.00', + slug: 'klarnapaynow', + name: 'Pay now.', + settings: { + ...defaultGatewaySettings, + title: 'Pay now.', + }, +}; + +const klarnasliceit: MollieGateway = { + country: 'germany', // Austria, Germany, Netherlands + minAmount: '50.00', + maxAmount: '2000.00', + slug: 'klarnasliceit', + name: 'Slice it.', + settings: { + ...defaultGatewaySettings, + title: 'Slice it.', + }, +}; + +export const gateways: { + [ key: string ]: MollieGateway; +} = { + alma, // >50.00 + // applepay, + // bacs, // currency: GBP + bancomatpay, + bancontact, + banktransfer, + belfius, + billie, // >100.00 + blik, // currency: PLN + creditcard, + directdebit, + eps, + giftcard, + ideal, + in3, // >100.00 + kbc, + klarna, + mybank, + // paybybank, // currency: GBP + payconiq, + paypal, + paysafecard, + // pointofsale, + przelewy24, + riverty, // >50.00 + satispay, + trustly, + twint, // currency: CHF + voucher, + + // Deprecated gateways + // giropay, + // klarnapaylater, // >50.00 + // klarnapaynow, // >50.00 + // klarnasliceit, // >50.00 +}; diff --git a/tests/qa/resources/index.ts b/tests/qa/resources/index.ts new file mode 100644 index 000000000..6587a341f --- /dev/null +++ b/tests/qa/resources/index.ts @@ -0,0 +1,22 @@ +export { + shopSettings, + shippingZones, + flatRate, + freeShipping, + guests, + customers, + taxSettings, + coupons, + orders, +} from '@inpsyde/playwright-utils/build/e2e/plugins/woocommerce'; + +export * from './products'; +export * from './gateways'; +export * from './cards'; +export * from './mollie-config'; +export * from './woocommerce-config'; +export * from './types'; + +export { default as molliePlugin } from './mollie-plugin'; +export { default as disableNoncePlugin } from './disable-nonce-plugin'; +export { default as subscriptionsPlugin } from './woocommerce-subscriptions-plugin'; diff --git a/tests/qa/resources/mollie-config.ts b/tests/qa/resources/mollie-config.ts new file mode 100644 index 000000000..62128e53e --- /dev/null +++ b/tests/qa/resources/mollie-config.ts @@ -0,0 +1,19 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from './types'; + +export const mollieConfigGeneral: { + [ key: string ]: MollieSettings.ApiKeys; +} = { + empty: { + testModeEnabled: 'yes', + liveApiKey: '', + testApiKey: '', + }, + default: { + testModeEnabled: 'yes', + liveApiKey: process.env.MOLLIE_LIVE_API_KEY, + testApiKey: process.env.MOLLIE_TEST_API_KEY, + }, +}; diff --git a/tests/qa/resources/mollie-plugin.ts b/tests/qa/resources/mollie-plugin.ts new file mode 100644 index 000000000..0e3c71d77 --- /dev/null +++ b/tests/qa/resources/mollie-plugin.ts @@ -0,0 +1,7 @@ +export default { + name: 'Mollie Payments for WooCommerce', + slug: 'mollie-payments-for-woocommerce', + zipFile: 'mollie-for-woocommerce.zip', + zipFilePath: './resources/files/mollie-payments-for-woocommerce.zip', + version: '7.8.1', +}; diff --git a/tests/qa/resources/products.ts b/tests/qa/resources/products.ts new file mode 100644 index 000000000..21d5546aa --- /dev/null +++ b/tests/qa/resources/products.ts @@ -0,0 +1,113 @@ +const mollieSimple100: WooCommerce.CreateProduct = { + name: 'Mollie Simple Test Product 100', + slug: 'mollie-product-simple-100', + type: 'simple', + regular_price: '100.00', + description: + 'Our clothes are juicy, sweet, and ideal for a healthy snack or enhancing your favorite recipes.', + short_description: 'Fresh, crisp clothes perfect for snacks and desserts.', + images: [ + { + src: 'https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/beanie-2.jpg', + }, + ], + virtual: false, + downloadable: false, + meta_data: [ + { key: '_mollie_voucher_category', value: 'no_category'} + ] +}; + +const mollieSimleVoucherMeal100: WooCommerce.CreateProduct = { + ...mollieSimple100, + name: 'Mollie Simple Voucher Meal Test Product 100', + slug: 'mollie-product-simple-voucher-meal-100', + meta_data: [ + { key: '_mollie_voucher_category', value: 'meal'} + ] +}; + +const mollieSimleVoucherEco100: WooCommerce.CreateProduct = { + ...mollieSimple100, + name: 'Mollie Simple Voucher Eco Test Product 100', + slug: 'mollie-product-simple-voucher-eco-100', + meta_data: [ + { key: '_mollie_voucher_category', value: 'eco'} + ] +}; + +const mollieSimleVoucherGift100: WooCommerce.CreateProduct = { + ...mollieSimple100, + name: 'Mollie Simple Voucher Gift Test Product 100', + slug: 'mollie-product-simple-voucher-gift-100', + meta_data: [ + { key: '_mollie_voucher_category', value: 'gift'} + ] +}; + +const mollieVirtual100: WooCommerce.CreateProduct = { + ...mollieSimple100, + name: 'Mollie Virtual Test Product 100', + slug: 'mollie-product-virtual-100', + virtual: true, + downloadable: true, +}; + +const mollieVariable100: WooCommerce.CreateProduct = { + name: 'Mollie Variable Test Product 100', + slug: 'mollie-product-variable-100', + type: 'variable', + regular_price: '100.00', + description: + 'Green and red clothes. Green and red clothes. Green and red clothes.', + short_description: 'Green and blue clothes.', + attributes: [ + { + name: 'Color', + variation: true, + options: [ 'Blue', 'Green' ], + }, + ], + default_attributes: [ + { + name: 'Color', + option: 'Blue', + }, + ], + variations: [ + { + attributes: [ + { + id: '0', + option: 'Blue', + }, + { + id: '0', + option: 'Green', + }, + ], + regular_price: '100.00', + stock_status: 'instock', + manage_stock: false, + }, + ], + images: [ + { + src: 'https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-blue-1.jpg', + }, + { + src: 'https://woocommercecore.mystagingwebsite.com/wp-content/uploads/2017/12/hoodie-green-1.jpg', + }, + ], +}; + +export const products: { + [ key: string ]: WooCommerce.CreateProduct; +} = { + mollieSimple100, + mollieSimleVoucherMeal100, + mollieSimleVoucherEco100, + mollieSimleVoucherGift100, + mollieVirtual100, + mollieVariable100, +}; diff --git a/tests/qa/resources/types.ts b/tests/qa/resources/types.ts new file mode 100644 index 000000000..d84c5693b --- /dev/null +++ b/tests/qa/resources/types.ts @@ -0,0 +1,243 @@ +export namespace MollieSettings { + export type ApiKeys = { + testModeEnabled?: 'yes' | 'no'; + liveApiKey?: string; + testApiKey?: string; + }; + + export type OrderStatusCancelledPayment = 'pending' | 'cancelled'; + + export type PaymentLocale = + | 'detect_by_browser' + | 'en_US' + | 'nl_NL' + | 'nl_BE' + | 'fr_FR' + | 'fr_BE' + | 'de_DE' + | 'de_AT' + | 'de_CH' + | 'es_ES' + | 'ca_ES' + | 'pt_PT' + | 'it_IT' + | 'nb_NO' + | 'sv_SE' + | 'fi_FI' + | 'da_DK' + | 'is_IS' + | 'hu_HU' + | 'pl_PL' + | 'lv_LV' + | 'lt_LT'; + + export type ApiMethod = 'order' | 'payment'; + + export type ApiPaymentDescription = + | '{orderNumber}' + | '{storeName}' + | '{customer.firstname}' + | '{customer.lastname}' + | '{customer.company}'; + + export type PaymentCapture = 'immediate_capture' | 'later_capture'; + + export type Advanced = { + debugLogEnabled?: boolean; + orderStatusCancelledPayments?: OrderStatusCancelledPayment; + paymentLocale?: PaymentLocale; + customerDetails?: boolean; + apiMethod?: ApiMethod; + apiPaymentDescription?: ApiPaymentDescription; + gatewayFeeLabel?: string; + removeOptionsAndTransients?: boolean; + placePaymentOnhold?: PaymentCapture; + }; + + export type PaymentSurcharge = + | 'no_fee' + | 'fixed_fee' + | 'percentage' + | 'fixed_fee_percentage'; + + export type InitialOrderStatus = 'on-hold' | 'pending'; + + export type PaypalButtonTextLanguageAndColor = + | 'en-buy-pill-blue' + | 'en-buy-rounded-blue' + | 'en-buy-pill-golden' + | 'en-buy-rounded-golden' + | 'en-buy-pill-gray' + | 'en-buy-rounded-gray' + | 'en-buy-pill-white' + | 'en-buy-rounded-white' + | 'en-checkout-pill-black' + | 'en-checkout-rounded-black' + | 'en-checkout-pill-blue' + | 'en-checkout-rounded-blue' + | 'en-checkout-pill-golden' + | 'en-checkout-rounded-golden' + | 'en-checkout-pill-gray' + | 'en-checkout-rounded-gray' + | 'en-checkout-pill-white' + | 'en-checkout-rounded-white' + | 'nl-buy-pill-black' + | 'nl-buy-rounded-black' + | 'nl-buy-pill-blue' + | 'nl-buy-rounded-blue' + | 'nl-buy-pill-golden' + | 'nl-buy-rounded-golden' + | 'nl-buy-pill-gray' + | 'nl-buy-rounded-gray' + | 'nl-buy-pill-white' + | 'nl-buy-rounded-white' + | 'nl-checkout-pill-black' + | 'nl-checkout-rounded-black' + | 'nl-checkout-pill-blue' + | 'nl-checkout-rounded-blue' + | 'nl-checkout-pill-golden' + | 'nl-checkout-rounded-golden' + | 'nl-checkout-pill-gray' + | 'nl-checkout-rounded-gray' + | 'nl-checkout-pill-white' + | 'nl-checkout-rounded-white' + | 'de-buy-pill-black' + | 'de-buy-rounded-black' + | 'de-buy-pill-blue' + | 'de-buy-rounded-blue' + | 'de-buy-pill-golden' + | 'de-buy-rounded-golden' + | 'de-buy-pill-gray' + | 'de-buy-rounded-gray' + | 'de-buy-pill-white' + | 'de-buy-rounded-white' + | 'de-checkout-pill-black' + | 'de-checkout-rounded-black' + | 'de-checkout-pill-blue' + | 'de-checkout-rounded-blue' + | 'de-checkout-pill-golden' + | 'de-checkout-rounded-golden' + | 'de-checkout-pill-gray' + | 'de-checkout-rounded-gray' + | 'de-checkout-pill-white' + | 'de-checkout-rounded-white' + | 'fr-buy-rounded-gold' + | 'fr-checkout-rounded-gold' + | 'fr-checkout-rounded-silver' + | 'pl-buy-rounded-gold' + | 'pl-checkout-rounded-gold' + | 'pl-checkout-rounded-silver'; + + export type VoucherProductCategory = + | 'no_category' + | 'meal' + | 'eco' + | 'gift'; + + export type Gateway = { + enabled?: boolean; + use_api_title?: 'yes' | 'no'; + title?: string; + display_logo?: 'yes' | 'no'; + enable_custom_logo?: 'yes' | 'no'; + custom_logo_path?: string; + upload_logo?: string; + description?: string; + 'allowed_countries[]'?: string[]; + + payment_surcharge?: PaymentSurcharge; + fixed_fee?: string; + maximum_limit?: string; + percentage?: string; + surcharge_limit?: string; + + activate_expiry_days_setting?: 'yes' | 'no'; + order_dueDate?: string; + issuers_dropdown_shown?: 'yes' | 'no'; + initial_order_status?: InitialOrderStatus; + mollie_components_enabled?: 'yes' | 'no'; + issuers_empty_option?: string; + + skip_mollie_payment_screen?: 'yes' | 'no'; // banktransfer + + mollie_apple_pay_button_enabled_cart?: 'yes' | 'no'; // applepay + mollie_apple_pay_button_enabled_product?: 'yes' | 'no'; // applepay + mollie_apple_pay_button_enabled_express_checkout?: 'yes' | 'no'; // applepay + + mollie_paypal_button_enabled_cart?: 'yes' | 'no'; // paypal + mollie_paypal_button_enabled_product?: 'yes' | 'no'; // paypal + paypal_color?: PaypalButtonTextLanguageAndColor; // paypal + mollie_paypal_button_minimum_amount?: string; // paypal + + mealvoucher_category_default?: VoucherProductCategory; // voucher + + mollie_creditcard_icons_enabler?: 'yes' | 'no'; // creditcard + mollie_creditcard_icons_amex?: 'yes' | 'no'; // creditcard + mollie_creditcard_icons_cartasi?: 'yes' | 'no'; // creditcard + mollie_creditcard_icons_cartebancaire?: 'yes' | 'no'; // creditcard + mollie_creditcard_icons_maestro?: 'yes' | 'no'; // creditcard + mollie_creditcard_icons_mastercard?: 'yes' | 'no'; // creditcard + mollie_creditcard_icons_visa?: 'yes' | 'no'; // creditcard + mollie_creditcard_icons_vpay?: 'yes' | 'no'; // creditcard + }; +} + +export type MollieGateway = { + slug: string; + name: string; + country: string; + currency?: string; + minAmount?: string; + maxAmount?: string; + settings?: MollieSettings.Gateway; +}; + +export type MolliePaymentStatus = + | 'open' + | 'pending' + | 'paid' + | 'authorized' + | 'failed' + | 'canceled' + | 'expired'; + +export type BankIssuer = + | 'ABN AMRO' + | 'ING' + | 'Rabobank' + | 'ASN Bank' + | 'bunq' + | 'Knab' + | 'N26' + | 'NN' + | 'Regiobank' + | 'Revolut' + | 'SNS Bank' + | 'Triodos' + | 'Van Lanschot Kempen' + | 'Yoursafe' + | 'CBC' + | 'KBC'; + +export type MolliePayment = { + gateway: MollieGateway; + status: MolliePaymentStatus; + bankIssuer?: BankIssuer; + card?: WooCommerce.CreditCard; + isVaulted?: boolean; + saveToAccount?: boolean; + amount?: number; +}; + +export namespace MollieTestData { + export type PaymentStatus = { + testId: string; + gatewaySlug: string; + paymentStatus: MolliePaymentStatus; + orderStatus: WooCommerce.OrderStatus; + card?: WooCommerce.CreditCard; + mollieComponentsEnabled?: 'yes' | 'no'; + bankIssuer?: string; + billingCompany?: string; + }; +} diff --git a/tests/qa/resources/woocommerce-config.ts b/tests/qa/resources/woocommerce-config.ts new file mode 100644 index 000000000..a60c35d19 --- /dev/null +++ b/tests/qa/resources/woocommerce-config.ts @@ -0,0 +1,52 @@ +/** + * Internal dependencies + */ +import { shopSettings, customers } from '.'; + +const country = 'germany'; + +export const shopConfigDefault = { + classicPages: false, // false = block cart and checkout (default), true = classic cart & checkout pages + wpDebugging: false, // WP Debugging plugin is deactivated + subscription: false, // WC Subscription plugin is deactivated + settings: shopSettings[ country ], // WC general settings + customer: customers[ country ], // registered customer +}; + +export const shopConfigClassic = { + ...shopConfigDefault, + classicPages: true, +}; + +export const shopConfigGermany = { + ...shopConfigDefault, + customer: customers.germany, +}; + +export const shopConfigUsa = { + ...shopConfigDefault, + wpDebugging: true, + settings: shopSettings.usa, + customer: customers.usa, +}; + +export const shopConfigMexico = { + ...shopConfigDefault, + settings: shopSettings.mexico, + customer: customers.mexico, +}; + +const shopConfigSubscription = { + // requireFinalConfirmation: false, + subscription: true, +}; + +export const shopConfigSubscriptionGermany = { + ...shopConfigGermany, + ...shopConfigSubscription, +}; + +export const shopConfigSubscriptionUsa = { + ...shopConfigUsa, + ...shopConfigSubscription, +}; diff --git a/tests/qa/resources/woocommerce-subscriptions-plugin.ts b/tests/qa/resources/woocommerce-subscriptions-plugin.ts new file mode 100644 index 000000000..a1435bb5c --- /dev/null +++ b/tests/qa/resources/woocommerce-subscriptions-plugin.ts @@ -0,0 +1,7 @@ +export default { + name: 'WooCommerce Subscriptions', + slug: 'woocommerce-subscriptions', + zipFile: 'woocommerce-subscriptions.zip', + zipFilePath: './resources/files/woocommerce-subscriptions.zip', + version: '', +}; diff --git a/tests/qa/tests/.setup/mollie-default.setup.ts b/tests/qa/tests/.setup/mollie-default.setup.ts new file mode 100644 index 000000000..104dd59e2 --- /dev/null +++ b/tests/qa/tests/.setup/mollie-default.setup.ts @@ -0,0 +1,9 @@ +/** + * Internal dependencies + */ +import { test as setup } from '../../utils'; + +setup( 'Setup and reconnect Mollie', async ( { utils } ) => { + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); diff --git a/tests/qa/tests/.setup/pages-block.setup.ts b/tests/qa/tests/.setup/pages-block.setup.ts new file mode 100644 index 000000000..85816ee09 --- /dev/null +++ b/tests/qa/tests/.setup/pages-block.setup.ts @@ -0,0 +1,8 @@ +/** + * Internal dependencies + */ +import { test as setup } from '../../utils'; + +setup( 'Setup Block checkout pages', async ( { utils } ) => { + await utils.configureStore( { classicPages: false } ); +} ); diff --git a/tests/qa/tests/.setup/pages-classic.setup.ts b/tests/qa/tests/.setup/pages-classic.setup.ts new file mode 100644 index 000000000..270ec24a1 --- /dev/null +++ b/tests/qa/tests/.setup/pages-classic.setup.ts @@ -0,0 +1,8 @@ +/** + * Internal dependencies + */ +import { test as setup } from '../../utils'; + +setup( 'Setup Classic checkout pages', async ( { utils } ) => { + await utils.configureStore( { classicPages: true } ); +} ); diff --git a/tests/qa/tests/.setup/woocommerce.setup.ts b/tests/qa/tests/.setup/woocommerce.setup.ts new file mode 100644 index 000000000..138268520 --- /dev/null +++ b/tests/qa/tests/.setup/woocommerce.setup.ts @@ -0,0 +1,142 @@ +/** + * Internal dependencies + */ +import { test as setup } from '../../utils'; +import { + shopSettings, + shippingZones, + taxSettings, + products, + coupons, + customers, + disableNoncePlugin, + subscriptionsPlugin, +} from '../../resources'; + +// setup( 'Setup WooCommerce plugin, API, go Live', async ( { requestUtils } ) => {} ); + +setup( 'Setup theme', + async ( { requestUtils } ) => { + const slug = 'storefront'; + if( ! await requestUtils.isThemeInstalled( slug ) ) { + await requestUtils.installTheme( slug ); + } + await requestUtils.activateTheme( slug ); + } +); + +setup( 'Setup Disable Nonce Plugin', + async ( { requestUtils, plugins } ) => { + if ( + ! ( await requestUtils.isPluginInstalled( + disableNoncePlugin.slug + ) ) + ) { + await plugins.installPluginFromFile( + disableNoncePlugin.zipFilePath + ); + } + await requestUtils.activatePlugin( disableNoncePlugin.slug ); + } +); + +setup( 'Setup WooCommerce Subscriptions Plugin (deactivated)', + async ( { requestUtils, plugins } ) => { + if ( + ! ( await requestUtils.isPluginInstalled( + subscriptionsPlugin.slug + ) ) + ) { + await plugins.installPluginFromFile( + subscriptionsPlugin.zipFilePath + ); + } + await requestUtils.deactivatePlugin( subscriptionsPlugin.slug ); + } +); + +setup( 'Setup Disable WooCommerce Setup Plugin', + async ( { requestUtils, plugins } ) => { + const helperPluginSlug = 'disable-wc-setup-wizard'; + if ( ! ( await requestUtils.isPluginInstalled( helperPluginSlug ) ) ) { + await plugins.installPluginFromFile( + `./resources/files/${ helperPluginSlug }.zip` + ); + } + await requestUtils.activatePlugin( helperPluginSlug ); + } +); + +setup( 'Setup Block and Classic pages', + async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.publishBlockCartPage(); + await wooCommerceUtils.publishBlockCheckoutPage(); + await wooCommerceUtils.publishClassicCartPage(); + await wooCommerceUtils.publishClassicCheckoutPage(); + } +); + +setup( 'Setup WooCommerce general settings', async ( { wooCommerceApi } ) => { + const country = 'germany'; + await wooCommerceApi.updateGeneralSettings( + shopSettings[ country ].general + ); +} ); + +setup( 'Setup WooCommerce shipping', + async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.configureShippingZone( shippingZones.worldwide ); + } +); + +setup( 'Setup WooCommerce taxes (included)', + async ( { wooCommerceUtils } ) => { + await wooCommerceUtils.setTaxes( taxSettings.including ); + } +); + +setup( 'Setup Registered Customer', + async ( { wooCommerceUtils } ) => { + const country = 'germany'; + await wooCommerceUtils.createCustomer( customers[ country ] ); + } +); + +setup( 'Setup Delete Previous Orders', + async ( { wooCommerceApi } ) => { + await wooCommerceApi.deleteAllOrders(); + } +); + +setup( 'Setup coupons', async ( { wooCommerceUtils } ) => { + // create test coupons + const couponItems = {}; + const couponEntries = Object.entries( coupons ); + await Promise.all( + couponEntries.map( async ( [ key, coupon ] ) => { + const createdCoupon = await wooCommerceUtils.createCoupon( coupon ); + couponItems[ coupon.code ] = { id: createdCoupon.id }; + } ) + ); + // store created coupons as CART_ITEMS env var + process.env.COUPONS = JSON.stringify( couponItems ); +} ); + +setup( 'Setup products', async ( { wooCommerceUtils } ) => { + // create test products + const cartItems = {}; + const productEntries = Object.entries( products ); + await Promise.all( + productEntries.map( async ( [ key, product ] ) => { + // check if not subscription product - requires Supscriptions plugin + if ( ! product.slug.includes( 'subscription' ) ) { + const createdProduct = await wooCommerceUtils.createProduct( + product + ); + cartItems[ product.slug ] = { id: createdProduct.id }; + } + } ) + ); + // store created products as CART_ITEMS env var + process.env.PRODUCTS = JSON.stringify( cartItems ); +} ); diff --git a/tests/qa/tests/01-plugin-foundation/plugin-foundation.spec.ts b/tests/qa/tests/01-plugin-foundation/plugin-foundation.spec.ts new file mode 100644 index 000000000..64a4fb2ea --- /dev/null +++ b/tests/qa/tests/01-plugin-foundation/plugin-foundation.spec.ts @@ -0,0 +1,44 @@ +/** + * External dependencies + */ +import { + testPluginInstallationFromFile, + testPluginReinstallationFromFile, + testPluginInstallationFromMarketplace, + testPluginDeactivation, + testPluginRemoval, +} from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { test, expect } from '../../utils'; +import { molliePlugin, gateways } from '../../resources'; + +testPluginInstallationFromFile( 'C419986', molliePlugin ); + +testPluginInstallationFromMarketplace( 'C3317', molliePlugin ); + +testPluginReinstallationFromFile( 'C3322', molliePlugin ); + +testPluginDeactivation( 'C3319', molliePlugin ); + +testPluginRemoval( 'C3318', molliePlugin ); + +test.describe( 'Plugin foundation', () => { + test.beforeAll( async ( { utils } ) => { + await utils.installActivateMollie(); + } ); + + test( 'C419984 | Plugin foundation - Mollie gateways are present in WooCommerce payment methods', async ( { + wooCommerceSettings, + } ) => { + await wooCommerceSettings.visit( 'payments' ); + for ( const key in gateways ) { + const gateway = gateways[ key ]; + const mollieGatewayname = `Mollie - ${ gateway.name }`; + await expect + .soft( wooCommerceSettings.gatewayLink( mollieGatewayname ) ) + .toBeVisible(); + } + } ); +} ); diff --git a/tests/qa/tests/02-merchant-setup/merchant-setup.spec.ts b/tests/qa/tests/02-merchant-setup/merchant-setup.spec.ts new file mode 100644 index 000000000..1d61e41b1 --- /dev/null +++ b/tests/qa/tests/02-merchant-setup/merchant-setup.spec.ts @@ -0,0 +1,32 @@ +/** + * Internal dependencies + */ +import { expect, test } from '../../utils'; + +test.beforeAll( async ( { utils } ) => { + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +test( 'C3511 | Validate an error message is returned when the test key is not valid/empty', async ( { + mollieSettingsApiKeys, + mollieSettingsAdvanced, +} ) => { + await mollieSettingsAdvanced.visit(); + await mollieSettingsAdvanced.cleanDb(); + await mollieSettingsApiKeys.visit(); + await expect( + mollieSettingsApiKeys.failedToConnectToMollieApiText() + ).toBeVisible(); +} ); + +test( 'C3510 | Validate that test/live keys are valid', async ( { + mollieSettingsApiKeys, +} ) => { + await mollieSettingsApiKeys.visit(); + await mollieSettingsApiKeys.setApiKeys(); + await mollieSettingsApiKeys.saveChanges(); + await expect( + mollieSettingsApiKeys.successfullyConnectedWithTestApiText() + ).toBeVisible(); +} ); diff --git a/tests/qa/tests/03-plugin-settings/mollie-settings-advanced.spec.ts b/tests/qa/tests/03-plugin-settings/mollie-settings-advanced.spec.ts new file mode 100644 index 000000000..a9aee2d36 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/mollie-settings-advanced.spec.ts @@ -0,0 +1,64 @@ +/** + * Internal dependencies + */ +import { test, expect } from '../../utils'; + +test.beforeAll( async ( { utils } ) => { + await utils.configureStore( { classicPages: true } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +test( 'C420152 | Validate that Mollie Advanced section is displayed per UI design', async ( { + mollieSettingsAdvanced, +} ) => { + await mollieSettingsAdvanced.visit(); + await expect( mollieSettingsAdvanced.heading() ).toBeVisible(); + await expect( mollieSettingsAdvanced.debugLogCheckbox() ).toBeVisible(); + await expect( + mollieSettingsAdvanced.orderStatusCancelledPaymentSelect() + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.paymentScreenLanguageSelect() + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.storeCustomerDetailsAtMollieCheckbox() + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.selectAPIMethodSelect() + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.apiPaymentDescriptionInput() + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.apiPaymentDescriptionButton( '{orderNumber}' ) + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.apiPaymentDescriptionButton( '{storeName}' ) + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.apiPaymentDescriptionButton( + '{customer.firstname}' + ) + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.apiPaymentDescriptionButton( + '{customer.lastname}' + ) + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.apiPaymentDescriptionButton( + '{customer.company}' + ) + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.surchargeGatewayFeeLabelInput() + ).toBeVisible(); + await expect( + mollieSettingsAdvanced.removeMollieDataFromDatabaseOnUninstall() + ).toBeVisible(); + await expect( mollieSettingsAdvanced.clearNowLink() ).toBeVisible(); + await expect( + mollieSettingsAdvanced.placingPaymentsOnHoldSelect() + ).toBeVisible(); +} ); diff --git a/tests/qa/tests/03-plugin-settings/mollie-settings-api-keys.spec.ts b/tests/qa/tests/03-plugin-settings/mollie-settings-api-keys.spec.ts new file mode 100644 index 000000000..f89a26b21 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/mollie-settings-api-keys.spec.ts @@ -0,0 +1,63 @@ +/** + * Internal dependencies + */ +import { expect, test } from '../../utils'; + +test.beforeAll( async ( { utils } ) => { + await utils.installActivateMollie(); +} ); + +test( 'C420150 | Validate that Mollie API Keys section is displayed per UI design', async ( { + mollieSettingsApiKeys, +} ) => { + await mollieSettingsApiKeys.visit(); + await expect( mollieSettingsApiKeys.heading() ).toBeVisible(); + await expect( + mollieSettingsApiKeys.molliePaymentModeSelect() + ).toBeVisible(); + await expect( mollieSettingsApiKeys.liveApiKeyInput() ).toBeVisible(); + await expect( + mollieSettingsApiKeys.molliePaymentModeSelect() + ).toBeVisible(); + await expect( mollieSettingsApiKeys.testApiKeyInput() ).toBeVisible(); +} ); + +test( 'C3333 | Validate that the ecommerce admin have access to Documentation/Support through the Setting page', async ( { + mollieSettingsApiKeys, + request, + page, +} ) => { + await mollieSettingsApiKeys.visit(); + const contactMollieSupportButton = + mollieSettingsApiKeys.contactMollieSupportButton(); + const contactSupportHref = await contactMollieSupportButton.getAttribute( + 'href' + ); + await expect( contactSupportHref ).toEqual( + 'https://www.mollie.com/contact/merchants' + ); + await expect( await request.get( contactSupportHref ) ).toBeOK(); + + const molliePluginDocumentationButton = + mollieSettingsApiKeys.molliePluginDocumentationButton(); + const pluginDocumentationHref = + await molliePluginDocumentationButton.getAttribute( 'href' ); + await expect( pluginDocumentationHref ).toEqual( + 'https://help.mollie.com/hc/en-us/sections/12858723658130-Mollie-for-WooCommerce' + ); + await page.goto( pluginDocumentationHref ); + await expect( page ).toHaveURL( /molliehelp\.zendesk\.com\/auth/ ); +} ); + +test.fixme( + 'C3330 | Validate that the ecommerce admin can activate debug mode', + async ( { mollieSettingsApiKeys } ) => { + await mollieSettingsApiKeys.visit(); + await mollieSettingsApiKeys.molliePaymentModeSelect().uncheck(); + await expect( + mollieSettingsApiKeys.testApiKeyInput() + ).not.toBeVisible(); + await mollieSettingsApiKeys.molliePaymentModeSelect().check(); + await expect( mollieSettingsApiKeys.testApiKeyInput() ).toBeVisible(); + } +); diff --git a/tests/qa/tests/03-plugin-settings/mollie-settings-gateway.spec.ts b/tests/qa/tests/03-plugin-settings/mollie-settings-gateway.spec.ts new file mode 100644 index 000000000..8eddce9f0 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/mollie-settings-gateway.spec.ts @@ -0,0 +1,104 @@ +/** + * Internal dependencies + */ +import { annotateGateway, test, expect } from '../../utils'; +import { gateways, guests, products } from '../../resources'; + +test.beforeAll( async ( { utils } ) => { + await utils.configureStore( { classicPages: true } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +// for( let key in gateways ) { +const key = 'eps'; +const gateway = gateways[ key ]; + +test.describe( `Payment method settings "${ gateway.name }"`, () => { + test.beforeEach( async ( { mollieSettingsGateway } ) => { + await mollieSettingsGateway.visit(); + await mollieSettingsGateway.setup( gateway.settings ); + } ); + + test( + `C3325 | Validate that the ecommerce admin can change the "${ gateway.name }" payment name`, + annotateGateway( gateway.slug ), + async ( { utils, mollieSettingsGateway, classicCheckout } ) => { + await mollieSettingsGateway.setup( { + title: `${ gateway.name } edited`, + } ); + await mollieSettingsGateway.saveChanges(); + + await utils.fillVisitorsCart( [ products.mollieSimple100 ] ); + await classicCheckout.visit(); + await classicCheckout.fillCheckoutForm( guests[ gateway.country ] ); + await expect( + await classicCheckout.paymentOption( + `${ gateway.name } edited` + ) + ).toBeVisible(); + } + ); + + test( + `C3326 | Validate that the ecommerce admin can change the "${ gateway.name }" payment logo`, + annotateGateway( gateway.slug ), + async ( { utils, mollieSettingsGateway, classicCheckout } ) => { + await mollieSettingsGateway.setup( { + enable_custom_logo: "yes", + custom_logo_path: './resources/files/mollie-test-logo.png', + } ); + await mollieSettingsGateway.saveChanges(); + + await utils.fillVisitorsCart( [ products.mollieSimple100 ] ); + await classicCheckout.visit(); + await classicCheckout.fillCheckoutForm( guests[ gateway.country ] ); + const paymentOptionLogoSrc = await classicCheckout + .paymentOptionLogo( `${ gateway.name }` ) + .getAttribute( 'src' ); + await expect( paymentOptionLogoSrc ).toContain( + `mollie-test-logo` + ); + } + ); + + test( + `C3327 | Validate that the ecommerce admin can change the "${ gateway.name }" payment description`, + annotateGateway( gateway.slug ), + async ( { utils, mollieSettingsGateway, classicCheckout } ) => { + await mollieSettingsGateway.setup( { + description: `${ gateway.name } edited description`, + } ); + await mollieSettingsGateway.saveChanges(); + + await utils.fillVisitorsCart( [ products.mollieSimple100 ] ); + await classicCheckout.visit(); + await classicCheckout.fillCheckoutForm( guests[ gateway.country ] ); + await classicCheckout.paymentOption( gateway.name ).click(); + await expect( + await classicCheckout.page.getByText( + `${ gateway.name } edited description` + ) + ).toBeVisible(); + } + ); + + test( + `C420329 | Validate selling only to specific countries for "${ gateway.name }"`, + annotateGateway( gateway.slug ), + async ( { utils, mollieSettingsGateway, classicCheckout } ) => { + await mollieSettingsGateway.setup( { + 'allowed_countries[]': [ 'Spain' ], + } ); + await mollieSettingsGateway.saveChanges(); + + await utils.fillVisitorsCart( [ products.mollieSimple100 ] ); + await classicCheckout.visit(); + await classicCheckout.fillCheckoutForm( guests[ gateway.country ] ); + await expect( + classicCheckout.paymentOption( gateway.name ) + ).not.toBeVisible(); + } + ); +} ); +// } diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage-over-limit.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage-over-limit.ts new file mode 100644 index 000000000..2ece5d076 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage-over-limit.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargeFixedAndPercentageOverLimit: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Fixed and percentage over limit', + title: 'Validate fixed and percentage fee surcharge for total over limit for', + expectedAmount: 111.0, + expectedFeeText: '+ € 10 + 10% fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'fixed_fee_percentage', + fixed_fee: '10', + maximum_limit: '10', + percentage: '10', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420318', gateway: 'applepay' }, + { testId: 'C89355', gateway: 'creditcard' }, + { testId: 'C130905', gateway: 'giftcard' }, + { testId: 'C129822', gateway: 'voucher' }, + { testId: 'C129511', gateway: 'bancontact' }, + { testId: 'C138020', gateway: 'belfius' }, + { testId: 'C354673', gateway: 'billie' }, + { testId: 'C133667', gateway: 'eps' }, + { testId: 'C130865', gateway: 'ideal' }, + { testId: 'C133677', gateway: 'kbc' }, + { testId: 'C420328', gateway: 'mybank' }, + { testId: 'C130895', gateway: 'paypal' }, + { testId: 'C420140', gateway: 'paysafecard' }, + { testId: 'C129812', gateway: 'przelewy24' }, + { testId: 'C136538', gateway: 'banktransfer' }, + { testId: 'C106917', gateway: 'in3' }, + // { testId: 'C130885', gateway: 'klarnapaylater' }, + // { testId: 'C136528', gateway: 'klarnapaynow' }, + // { testId: 'C106918', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage-under-limit.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage-under-limit.ts new file mode 100644 index 000000000..08021939d --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage-under-limit.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargeFixedAndPercentageUnderLimit: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Fixed and percentage under limit', + title: 'Validate fixed and percentage fee surcharge for total under limit for', + expectedAmount: 134.21, + expectedFeeText: '+ € 10 + 10% fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'fixed_fee_percentage', + fixed_fee: '10', + maximum_limit: '150', + percentage: '10', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420315', gateway: 'applepay' }, + // { testId: 'C000', gateway: 'creditcard' }, + { testId: 'C130902', gateway: 'giftcard' }, + { testId: 'C129819', gateway: 'voucher' }, + { testId: 'C129508', gateway: 'bancontact' }, + { testId: 'C138017', gateway: 'belfius' }, + { testId: 'C354670', gateway: 'billie' }, + { testId: 'C133664', gateway: 'eps' }, + { testId: 'C130862', gateway: 'ideal' }, + { testId: 'C133674', gateway: 'kbc' }, + { testId: 'C420325', gateway: 'mybank' }, + { testId: 'C130892', gateway: 'paypal' }, + { testId: 'C420137', gateway: 'paysafecard' }, + { testId: 'C129809', gateway: 'przelewy24' }, + { testId: 'C136535', gateway: 'banktransfer' }, + { testId: 'C106914', gateway: 'in3' }, + // { testId: 'C130882', gateway: 'klarnapaylater' }, + // { testId: 'C136525', gateway: 'klarnapaynow' }, + // { testId: 'C1278122', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage.ts new file mode 100644 index 000000000..6dd8cfaf4 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-and-percentage.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargeFixedAndPercentage: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Fixed and percentage', + title: 'Validate fixed and percentage fee surcharge for', + expectedAmount: 134.21, + expectedFeeText: '+ € 10 + 10% fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'fixed_fee_percentage', + fixed_fee: '10', + maximum_limit: '0', + percentage: '10', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420312', gateway: 'applepay' }, + { testId: 'C89352', gateway: 'creditcard' }, + { testId: 'C130899', gateway: 'giftcard' }, + { testId: 'C129816', gateway: 'voucher' }, + { testId: 'C129505', gateway: 'bancontact' }, + { testId: 'C138014', gateway: 'belfius' }, + { testId: 'C354667', gateway: 'billie' }, + { testId: 'C133661', gateway: 'eps' }, + { testId: 'C130859', gateway: 'ideal' }, + { testId: 'C133671', gateway: 'kbc' }, + { testId: 'C420322', gateway: 'mybank' }, + { testId: 'C130889', gateway: 'paypal' }, + { testId: 'C420134', gateway: 'paysafecard' }, + { testId: 'C129806', gateway: 'przelewy24' }, + { testId: 'C136532', gateway: 'banktransfer' }, + { testId: 'C106911', gateway: 'in3' }, + // { testId: 'C130876', gateway: 'klarnapaylater' }, + // { testId: 'C136522', gateway: 'klarnapaynow' }, + // { testId: 'C127819', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-over-limit.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-over-limit.ts new file mode 100644 index 000000000..875cd9565 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-over-limit.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargeFixedOverLimit: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Fixed over limit', + title: 'Validate fixed fee surcharge fo total over limit for', + expectedAmount: 111.0, + expectedFeeText: '+ € 10 fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'fixed_fee', + fixed_fee: '10', + maximum_limit: '10', + percentage: '0', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C354671', gateway: 'applepay' }, + { testId: 'C89353', gateway: 'creditcard' }, + { testId: 'C130903', gateway: 'giftcard' }, + { testId: 'C129820', gateway: 'voucher' }, + { testId: 'C129509', gateway: 'bancontact' }, + { testId: 'C138018', gateway: 'belfius' }, + { testId: 'C354671', gateway: 'billie' }, + { testId: 'C133665', gateway: 'eps' }, + { testId: 'C130863', gateway: 'ideal' }, + { testId: 'C133675', gateway: 'kbc' }, + { testId: 'C420326', gateway: 'mybank' }, + { testId: 'C130893', gateway: 'paypal' }, + { testId: 'C420138', gateway: 'paysafecard' }, + { testId: 'C129810', gateway: 'przelewy24' }, + { testId: 'C136536', gateway: 'banktransfer' }, + { testId: 'C106915', gateway: 'in3' }, + // { testId: 'C130883', gateway: 'klarnapaylater' }, + // { testId: 'C136526', gateway: 'klarnapaynow' }, + // { testId: 'C128597', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-under-limit.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-under-limit.ts new file mode 100644 index 000000000..4ce9f7e69 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed-under-limit.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargeFixedUnderLimit: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Fixed under Limit', + title: 'Validate fixed fee surcharge fo total under limit for', + expectedAmount: 122.0, + expectedFeeText: '+ € 10 fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'fixed_fee', + fixed_fee: '10', + maximum_limit: '150', + percentage: '0', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420313', gateway: 'applepay' }, + { testId: 'C89354', gateway: 'creditcard' }, + { testId: 'C130900', gateway: 'giftcard' }, + { testId: 'C129817', gateway: 'voucher' }, + { testId: 'C129506', gateway: 'bancontact' }, + { testId: 'C138015', gateway: 'belfius' }, + { testId: 'C354668', gateway: 'billie' }, + { testId: 'C133662', gateway: 'eps' }, + { testId: 'C130860', gateway: 'ideal' }, + { testId: 'C133672', gateway: 'kbc' }, + { testId: 'C420323', gateway: 'mybank' }, + { testId: 'C130890', gateway: 'paypal' }, + { testId: 'C420135', gateway: 'paysafecard' }, + { testId: 'C129807', gateway: 'przelewy24' }, + { testId: 'C136533', gateway: 'banktransfer' }, + { testId: 'C106912', gateway: 'in3' }, + // { testId: 'C130880', gateway: 'klarnapaylater' }, + // { testId: 'C136523', gateway: 'klarnapaynow' }, + // { testId: 'C1278120', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed.ts new file mode 100644 index 000000000..11db28247 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-fixed.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargeFixed: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Fixed', + title: 'Validate fixed fee surcharge for', + expectedAmount: 122.0, + expectedFeeText: '+ € 10 fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'fixed_fee', + fixed_fee: '10', + maximum_limit: '0', + percentage: '0', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420310', gateway: 'applepay' }, + { testId: 'C94865', gateway: 'creditcard' }, + { testId: 'C130897', gateway: 'giftcard' }, + { testId: 'C129814', gateway: 'voucher' }, + { testId: 'C129503', gateway: 'bancontact' }, + { testId: 'C138012', gateway: 'belfius' }, + { testId: 'C354665', gateway: 'billie' }, + { testId: 'C133659', gateway: 'eps' }, + { testId: 'C130857', gateway: 'ideal' }, + { testId: 'C133669', gateway: 'kbc' }, + { testId: 'C420320', gateway: 'mybank' }, + { testId: 'C130887', gateway: 'paypal' }, + { testId: 'C420132', gateway: 'paysafecard' }, + { testId: 'C129804', gateway: 'przelewy24' }, + { testId: 'C136530', gateway: 'banktransfer' }, + { testId: 'C106909', gateway: 'in3' }, + // { testId: 'C130873', gateway: 'klarnapaylater' }, + // { testId: 'C136520', gateway: 'klarnapaynow' }, + // { testId: 'C127817', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage-over-limit.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage-over-limit.ts new file mode 100644 index 000000000..923b4d84a --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage-over-limit.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargePercentageOverLimit: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Percentage over limit', + title: 'Validate percentage fee surcharge for total over limit for', + expectedAmount: 111.0, + expectedFeeText: '+ 10% fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'percentage', + fixed_fee: '0', + maximum_limit: '10', + percentage: '10', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420317', gateway: 'applepay' }, + { testId: 'C89356', gateway: 'creditcard' }, + { testId: 'C130904', gateway: 'giftcard' }, + { testId: 'C129821', gateway: 'voucher' }, + { testId: 'C129510', gateway: 'bancontact' }, + { testId: 'C138019', gateway: 'belfius' }, + { testId: 'C354672', gateway: 'billie' }, + { testId: 'C133666', gateway: 'eps' }, + { testId: 'C130864', gateway: 'ideal' }, + { testId: 'C133676', gateway: 'kbc' }, + { testId: 'C420327', gateway: 'mybank' }, + { testId: 'C130894', gateway: 'paypal' }, + { testId: 'C420139', gateway: 'paysafecard' }, + { testId: 'C129811', gateway: 'przelewy24' }, + { testId: 'C136537', gateway: 'banktransfer' }, + { testId: 'C106916', gateway: 'in3' }, + // { testId: 'C130884', gateway: 'klarnapaylater' }, + // { testId: 'C136527', gateway: 'klarnapaynow' }, + // { testId: 'C129200', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage-under-limit.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage-under-limit.ts new file mode 100644 index 000000000..bd2f180bd --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage-under-limit.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargePercentageUnderLimit: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Percentage under limit', + title: 'Validate percentage fee surcharge for total under limit for', + expectedAmount: 123.21, + expectedFeeText: '+ 10% fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'percentage', + fixed_fee: '0', + maximum_limit: '150', + percentage: '10', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420314', gateway: 'applepay' }, + // { testId: 'C000', gateway: 'creditcard' }, + { testId: 'C130901', gateway: 'giftcard' }, + { testId: 'C129818', gateway: 'voucher' }, + { testId: 'C129507', gateway: 'bancontact' }, + { testId: 'C138016', gateway: 'belfius' }, + { testId: 'C354669', gateway: 'billie' }, + { testId: 'C133663', gateway: 'eps' }, + { testId: 'C130861', gateway: 'ideal' }, + { testId: 'C133673', gateway: 'kbc' }, + { testId: 'C420324', gateway: 'mybank' }, + { testId: 'C130891', gateway: 'paypal' }, + { testId: 'C420136', gateway: 'paysafecard' }, + { testId: 'C129808', gateway: 'przelewy24' }, + { testId: 'C136534', gateway: 'banktransfer' }, + { testId: 'C106913', gateway: 'in3' }, + // { testId: 'C130881', gateway: 'klarnapaylater' }, + // { testId: 'C136524', gateway: 'klarnapaynow' }, + // { testId: 'C1278121', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage.ts new file mode 100644 index 000000000..71fa09270 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-fee-percentage.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargePercentage: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - Percentage', + title: 'Validate percentage fee surcharge for', + expectedAmount: 123.21, + expectedFeeText: '+ 10% fee might apply (excl. VAT)', + settings: { + payment_surcharge: 'percentage', + fixed_fee: '0', + maximum_limit: '0', + percentage: '10', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420311', gateway: 'applepay' }, + { testId: 'C89351', gateway: 'creditcard' }, + { testId: 'C130898', gateway: 'giftcard' }, + { testId: 'C129815', gateway: 'voucher' }, + { testId: 'C129504', gateway: 'bancontact' }, + { testId: 'C138013', gateway: 'belfius' }, + { testId: 'C354666', gateway: 'billie' }, + { testId: 'C133660', gateway: 'eps' }, + { testId: 'C130858', gateway: 'ideal' }, + { testId: 'C133670', gateway: 'kbc' }, + { testId: 'C420321', gateway: 'mybank' }, + { testId: 'C130888', gateway: 'paypal' }, + { testId: 'C420133', gateway: 'paysafecard' }, + { testId: 'C129805', gateway: 'przelewy24' }, + { testId: 'C136531', gateway: 'banktransfer' }, + { testId: 'C106910', gateway: 'in3' }, + // { testId: 'C130875', gateway: 'klarnapaylater' }, + // { testId: 'C136521', gateway: 'klarnapaynow' }, + // { testId: 'C127818', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-no-fee.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-no-fee.ts new file mode 100644 index 000000000..514071228 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/data-surcharge-no-fee.ts @@ -0,0 +1,46 @@ +/** + * Internal dependencies + */ +import { MollieSettings } from '../../../../resources'; + +export const surchargeNoFee: { + describe: string; + title: string; + expectedAmount: number; + expectedFeeText: string; + settings: MollieSettings.Gateway; + tests: { testId: string; gateway: string }[]; +} = { + describe: 'Surcharge fee - No fee', + title: 'Validate no fee surcharge for', + expectedAmount: 111.0, + expectedFeeText: '', + settings: { + payment_surcharge: 'no_fee', + fixed_fee: '0', + maximum_limit: '0', + percentage: '0', + surcharge_limit: '0', + }, + tests: [ + // { testId: 'C420309', gateway: 'applepay' }, + // { testId: 'C000', gateway: 'creditcard' }, + { testId: 'C130896', gateway: 'giftcard' }, + { testId: 'C129813', gateway: 'voucher' }, + { testId: 'C129502', gateway: 'bancontact' }, + { testId: 'C138011', gateway: 'belfius' }, + { testId: 'C354664', gateway: 'billie' }, + { testId: 'C133658', gateway: 'eps' }, + { testId: 'C130856', gateway: 'ideal' }, + { testId: 'C133668', gateway: 'kbc' }, + { testId: 'C420319', gateway: 'mybank' }, + { testId: 'C130886', gateway: 'paypal' }, + { testId: 'C420131', gateway: 'paysafecard' }, + { testId: 'C129803', gateway: 'przelewy24' }, + { testId: 'C136529', gateway: 'banktransfer' }, + { testId: 'C106908', gateway: 'in3' }, + // { testId: 'C130871', gateway: 'klarnapaylater' }, + // { testId: 'C136519', gateway: 'klarnapaynow' }, + // { testId: 'C127227', gateway: 'klarnasliceit' }, + ], +}; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/.test-data/index.ts b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/index.ts new file mode 100644 index 000000000..80d06ddbc --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/.test-data/index.ts @@ -0,0 +1,13 @@ +export * from './data-surcharge-no-fee'; + +export * from './data-surcharge-fee-fixed'; +export * from './data-surcharge-fee-fixed-under-limit'; +export * from './data-surcharge-fee-fixed-over-limit'; + +export * from './data-surcharge-fee-percentage'; +export * from './data-surcharge-fee-percentage-under-limit'; +export * from './data-surcharge-fee-percentage-over-limit'; + +export * from './data-surcharge-fee-fixed-and-percentage'; +export * from './data-surcharge-fee-fixed-and-percentage-under-limit'; +export * from './data-surcharge-fee-fixed-and-percentage-over-limit'; diff --git a/tests/qa/tests/03-plugin-settings/surcharge/surcharge.spec.ts b/tests/qa/tests/03-plugin-settings/surcharge/surcharge.spec.ts new file mode 100644 index 000000000..750766d07 --- /dev/null +++ b/tests/qa/tests/03-plugin-settings/surcharge/surcharge.spec.ts @@ -0,0 +1,80 @@ +/** + * Internal dependencies + */ +import { test, expect } from '../../../utils'; +import { + surchargeNoFee, + surchargeFixed, + surchargeFixedUnderLimit, + surchargeFixedOverLimit, + surchargePercentage, + surchargePercentageUnderLimit, + surchargePercentageOverLimit, + surchargeFixedAndPercentage, + surchargeFixedAndPercentageUnderLimit, + surchargeFixedAndPercentageOverLimit, +} from './.test-data'; +import { gateways, products, guests, flatRate } from '../../../resources'; + +const allTests = [ + surchargeNoFee, + surchargeFixed, + surchargeFixedUnderLimit, + surchargeFixedOverLimit, + surchargePercentage, + surchargePercentageUnderLimit, + surchargePercentageOverLimit, + surchargeFixedAndPercentage, + surchargeFixedAndPercentageUnderLimit, + surchargeFixedAndPercentageOverLimit, +]; + +test.beforeAll( async ( { utils }, testInfo ) => { + if ( testInfo.project.name !== 'all' ) { + return; + } + await utils.configureStore( { classicPages: true } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +for ( const surcharge of allTests ) { + test.describe( surcharge.describe, () => { + for ( const tested of surcharge.tests ) { + const gateway = gateways[ tested.gateway ]; + const country = gateway.country; + + test( `${ tested.testId } | ${ surcharge.title } "${ gateway.name }"`, async ( { + mollieApi, + utils, + classicCheckout, + } ) => { + await mollieApi.updateMollieGateway( + gateway.slug, + surcharge.settings + ); + + await utils.fillVisitorsCart( [ products.mollieSimple100 ] ); + await classicCheckout.visit(); + await classicCheckout.fillCheckoutForm( guests[ country ] ); + await classicCheckout.selectShippingMethod( + flatRate.settings.title + ); + await classicCheckout.paymentOption( gateway.name ).click(); + await classicCheckout.page.waitForTimeout( 2000 ); // timeout for progress spinner (can't catch the element) + const feeNotice = classicCheckout.paymentOptionFee( + gateway.name + ); + if ( surcharge.expectedFeeText ) { + await expect( feeNotice ).toContainText( + surcharge.expectedFeeText + ); + } else { + await expect( feeNotice ).not.toBeVisible(); + } + const totalAmount = await classicCheckout.captureTotalAmount(); + await expect( totalAmount ).toEqual( surcharge.expectedAmount ); + } ); + } + } ); +} diff --git a/tests/qa/tests/04-frontend-ui/frontend-ui.spec.ts b/tests/qa/tests/04-frontend-ui/frontend-ui.spec.ts new file mode 100644 index 000000000..bc5d8b90b --- /dev/null +++ b/tests/qa/tests/04-frontend-ui/frontend-ui.spec.ts @@ -0,0 +1,56 @@ +/** + * Internal dependencies + */ +import { test, expect } from '../../utils'; +import { + gateways, + guests, + MollieGateway, + products, + shopSettings, +} from '../../resources'; + +test.beforeAll( async ( { utils } ) => { + await utils.configureStore( { classicPages: true } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +test( 'C420154 | Validate correct gateways shown with Order API on Classic checkout', async ( { + utils, + classicCheckout, + wooCommerceApi, +} ) => { + test.setTimeout( 600000 ); + const excludedPaymentMethods = [ 'applepay', 'directdebit' ]; + let gateway: MollieGateway; + let guest: WooCommerce.CreateCustomer; + let countryCode: string; + + await utils.fillVisitorsCart( [ products.mollieSimple100 ] ); + await classicCheckout.visit(); + + for ( const key in gateways ) { + gateway = gateways[ key ]; + guest = guests[ gateway.country ]; + countryCode = guest.billing.country; + + if ( excludedPaymentMethods.includes( gateway.slug ) ) continue; + + await wooCommerceApi.updateGeneralSettings( { + woocommerce_currency: gateway.currency || 'EUR', + } ); + await classicCheckout.page.reload(); + await classicCheckout.billingCountryCombobox().click(); + await classicCheckout.billingCountryOptionByCode( countryCode ).click(); + await classicCheckout.page.waitForTimeout( 1000 ); + + await expect + .soft( await classicCheckout.paymentOption( gateway.name ) ) + .toBeVisible(); + } +} ); + +test.afterAll( async ( { wooCommerceApi } ) => { + await wooCommerceApi.updateGeneralSettings( shopSettings.germany.general ); +} ); diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/data-conversion.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/data-conversion.ts new file mode 100644 index 000000000..149d35b9c --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/data-conversion.ts @@ -0,0 +1,37 @@ +/** + * Internal dependencies + */ +import { + MollieTestData, + gateways, + guests, + orders, + products, +} from '../../../../resources'; + +export const createShopOrder = ( + testData: MollieTestData.PaymentStatus +): WooCommerce.ShopOrder => { + const gateway = gateways[ testData.gatewaySlug ]; + const order: WooCommerce.ShopOrder = { + ...orders.default, + products: [ products.mollieSimple100 ], + payment: { + gateway: { + ...gateway, + settings: { + ...gateway.settings, + mollie_components_enabled: testData.mollieComponentsEnabled, // for card tests with mollie components + }, + }, + billingCompany: testData.billingCompany, // for billie tests + card: testData.card, // for card tests + bankIssuer: testData.bankIssuer, // for kbc tests + status: testData.paymentStatus, + }, + orderStatus: testData.orderStatus, + customer: guests[ gateway.country ], + currency: gateway.currency, + }; + return order; +}; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-checkout-classic.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-checkout-classic.ts new file mode 100644 index 000000000..1c1e5522c --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-checkout-classic.ts @@ -0,0 +1,604 @@ +/** + * Internal dependencies + */ +import { cards, MollieTestData } from '../../../../resources'; + +export const classicCheckoutEur: MollieTestData.PaymentStatus[] = [ + // { + // testId: '', + // gatewaySlug: 'applepay', + // paymentStatus: 'paid', + // orderStatus: 'processing', + // }, + { + testId: 'C3731', + gatewaySlug: 'in3', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3732', + gatewaySlug: 'in3', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3733', + gatewaySlug: 'in3', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3734', + gatewaySlug: 'in3', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3387', + gatewaySlug: 'bancontact', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3388', + gatewaySlug: 'bancontact', + paymentStatus: 'open', + orderStatus: 'pending', + }, + { + testId: 'C3389', + gatewaySlug: 'bancontact', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3390', + gatewaySlug: 'bancontact', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3391', + gatewaySlug: 'bancontact', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3424', + gatewaySlug: 'przelewy24', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3425', + gatewaySlug: 'przelewy24', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3426', + gatewaySlug: 'przelewy24', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3427', + gatewaySlug: 'przelewy24', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + // { + // testId: '', + // gatewaySlug: 'voucher', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + { + testId: 'C3382', + gatewaySlug: 'ideal', + paymentStatus: 'paid', + bankIssuer: 'ING', + orderStatus: 'processing', + }, + { + testId: 'C3383', + gatewaySlug: 'ideal', + paymentStatus: 'open', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C3384', + gatewaySlug: 'ideal', + paymentStatus: 'failed', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C3385', + gatewaySlug: 'ideal', + paymentStatus: 'expired', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C3386', + gatewaySlug: 'ideal', + paymentStatus: 'canceled', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C3392', + gatewaySlug: 'paypal', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3393', + gatewaySlug: 'paypal', + paymentStatus: 'pending', + orderStatus: 'pending', + }, + { + testId: 'C3394', + gatewaySlug: 'paypal', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3395', + gatewaySlug: 'paypal', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3396', + gatewaySlug: 'paypal', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + // { + // testId: '', + // gatewaySlug: 'giftcard', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + { + testId: 'C3412', + gatewaySlug: 'eps', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3413', + gatewaySlug: 'eps', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3414', + gatewaySlug: 'eps', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3415', + gatewaySlug: 'eps', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3419', + gatewaySlug: 'kbc', + paymentStatus: 'paid', + bankIssuer: 'KBC', + orderStatus: 'processing', + }, + { + testId: 'C3416', + gatewaySlug: 'kbc', + paymentStatus: 'failed', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C3417', + gatewaySlug: 'kbc', + paymentStatus: 'canceled', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C3418', + gatewaySlug: 'kbc', + paymentStatus: 'expired', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C3371', + gatewaySlug: 'creditcard', + paymentStatus: 'paid', + card: cards.visa, + orderStatus: 'processing', + }, + { + testId: 'C3372', + gatewaySlug: 'creditcard', + paymentStatus: 'open', + card: cards.visa, + orderStatus: 'pending', + }, + { + testId: 'C3373', + gatewaySlug: 'creditcard', + paymentStatus: 'failed', + card: cards.visa, + orderStatus: 'pending', + }, { + testId: 'C3374', + gatewaySlug: 'creditcard', + paymentStatus: 'expired', + card: cards.visa, + orderStatus: 'pending', + }, + { + testId: 'C3433', + gatewaySlug: 'banktransfer', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3432', + gatewaySlug: 'banktransfer', + paymentStatus: 'open', + orderStatus: 'on-hold', + }, + { + testId: 'C3434', + gatewaySlug: 'banktransfer', + paymentStatus: 'expired', + orderStatus: 'on-hold', + }, + { + testId: 'C420294', + gatewaySlug: 'mybank', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420295', + gatewaySlug: 'mybank', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420296', + gatewaySlug: 'mybank', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420297', + gatewaySlug: 'mybank', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3428', + gatewaySlug: 'belfius', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3429', + gatewaySlug: 'belfius', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3430', + gatewaySlug: 'belfius', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3431', + gatewaySlug: 'belfius', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C354674', + gatewaySlug: 'billie', + paymentStatus: 'authorized', + orderStatus: 'processing', + billingCompany: 'Syde', + }, + { + testId: 'C354675', + gatewaySlug: 'billie', + paymentStatus: 'failed', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C354676', + gatewaySlug: 'billie', + paymentStatus: 'canceled', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C354677', + gatewaySlug: 'billie', + paymentStatus: 'expired', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C420141', + gatewaySlug: 'paysafecard', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420142', + gatewaySlug: 'paysafecard', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420143', + gatewaySlug: 'paysafecard', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007255', + gatewaySlug: 'klarna', + paymentStatus: 'authorized', + orderStatus: 'processing', + }, + { + testId: 'C3007256', + gatewaySlug: 'klarna', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007257', + gatewaySlug: 'klarna', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007258', + gatewaySlug: 'klarna', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007267', + gatewaySlug: 'bancomatpay', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007268', + gatewaySlug: 'bancomatpay', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007269', + gatewaySlug: 'bancomatpay', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007270', + gatewaySlug: 'bancomatpay', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3241639', + gatewaySlug: 'alma', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3241640', + gatewaySlug: 'alma', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3241641', + gatewaySlug: 'alma', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3241642', + gatewaySlug: 'alma', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3437842', + gatewaySlug: 'trustly', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3437843', + gatewaySlug: 'trustly', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3437844', + gatewaySlug: 'trustly', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3437845', + gatewaySlug: 'trustly', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3622413', + gatewaySlug: 'riverty', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3622414', + gatewaySlug: 'riverty', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3622415', + gatewaySlug: 'riverty', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3622416', + gatewaySlug: 'riverty', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3622425', + gatewaySlug: 'payconiq', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3622426', + gatewaySlug: 'payconiq', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3622427', + gatewaySlug: 'payconiq', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3622428', + gatewaySlug: 'payconiq', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3757251', + gatewaySlug: 'satispay', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3757252', + gatewaySlug: 'satispay', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3757253', + gatewaySlug: 'satispay', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3757254', + gatewaySlug: 'satispay', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + + /** + * Deprecated gateways + */ + + // { + // testId: 'C3401', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C3402', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3403', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3404', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3397', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C3398', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3399', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3400', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3408', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C3409', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3410', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C3411', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, +]; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-checkout.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-checkout.ts new file mode 100644 index 000000000..7c9162f33 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-checkout.ts @@ -0,0 +1,612 @@ +/** + * Internal dependencies + */ +import { cards, MollieTestData } from '../../../../resources'; + +export const checkoutEur: MollieTestData.PaymentStatus[] = [ + // { + // testId: '', + // gatewaySlug: 'applepay', + // paymentStatus: 'paid', + // orderStatus: 'processing', + // }, + { + testId: 'C420219', + gatewaySlug: 'in3', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420220', + gatewaySlug: 'in3', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420221', + gatewaySlug: 'in3', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420222', + gatewaySlug: 'in3', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420230', + gatewaySlug: 'bancontact', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420231', + gatewaySlug: 'bancontact', + paymentStatus: 'open', + orderStatus: 'pending', + }, + { + testId: 'C420232', + gatewaySlug: 'bancontact', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420233', + gatewaySlug: 'bancontact', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420234', + gatewaySlug: 'bancontact', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420235', + gatewaySlug: 'przelewy24', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420236', + gatewaySlug: 'przelewy24', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420237', + gatewaySlug: 'przelewy24', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420238', + gatewaySlug: 'przelewy24', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + // { + // testId: '', + // gatewaySlug: 'voucher', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + { + testId: 'C420244', + gatewaySlug: 'ideal', + paymentStatus: 'paid', + bankIssuer: 'ING', + orderStatus: 'processing', + }, + { + testId: 'C420245', + gatewaySlug: 'ideal', + paymentStatus: 'open', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420246', + gatewaySlug: 'ideal', + paymentStatus: 'failed', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420248', + gatewaySlug: 'ideal', + paymentStatus: 'canceled', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420247', + gatewaySlug: 'ideal', + paymentStatus: 'expired', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420253', + gatewaySlug: 'paypal', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420254', + gatewaySlug: 'paypal', + paymentStatus: 'pending', + orderStatus: 'pending', + }, + { + testId: 'C420255', + gatewaySlug: 'paypal', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420256', + gatewaySlug: 'paypal', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420257', + gatewaySlug: 'paypal', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + // { + // testId: '', + // gatewaySlug: 'giftcard', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + { + testId: 'C420260', + gatewaySlug: 'eps', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420261', + gatewaySlug: 'eps', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420262', + gatewaySlug: 'eps', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420263', + gatewaySlug: 'eps', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420267', + gatewaySlug: 'kbc', + paymentStatus: 'paid', + bankIssuer: 'KBC', + orderStatus: 'processing', + }, + { + testId: 'C420264', + gatewaySlug: 'kbc', + paymentStatus: 'failed', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C420265', + gatewaySlug: 'kbc', + paymentStatus: 'canceled', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C420266', + gatewaySlug: 'kbc', + paymentStatus: 'expired', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C420268', + gatewaySlug: 'creditcard', + paymentStatus: 'paid', + card: cards.visa, + orderStatus: 'processing', + }, + { + testId: 'C420269', + gatewaySlug: 'creditcard', + paymentStatus: 'open', + card: cards.visa, + orderStatus: 'pending', + }, + { + testId: 'C420270', + gatewaySlug: 'creditcard', + paymentStatus: 'failed', + card: cards.visa, + orderStatus: 'pending', + }, + // { + // testId: 'C420272', + // gatewaySlug: 'creditcard', + // paymentStatus: 'canceled', + // card: cards.visa, + // orderStatus: 'pending', + // }, + { + testId: 'C420271', + gatewaySlug: 'creditcard', + paymentStatus: 'expired', + card: cards.visa, + orderStatus: 'pending', + }, + { + testId: 'C420284', + gatewaySlug: 'banktransfer', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420283', + gatewaySlug: 'banktransfer', + paymentStatus: 'open', + orderStatus: 'on-hold', + }, + { + testId: 'C420285', + gatewaySlug: 'banktransfer', + paymentStatus: 'expired', + orderStatus: 'on-hold', + }, + { + testId: 'C420286', + gatewaySlug: 'mybank', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420287', + gatewaySlug: 'mybank', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420288', + gatewaySlug: 'mybank', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420289', + gatewaySlug: 'mybank', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420298', + gatewaySlug: 'belfius', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420299', + gatewaySlug: 'belfius', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420300', + gatewaySlug: 'belfius', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420301', + gatewaySlug: 'belfius', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420302', + gatewaySlug: 'billie', + paymentStatus: 'authorized', + orderStatus: 'processing', + billingCompany: 'Syde', + }, + { + testId: 'C420303', + gatewaySlug: 'billie', + paymentStatus: 'failed', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C420304', + gatewaySlug: 'billie', + paymentStatus: 'canceled', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C420305', + gatewaySlug: 'billie', + paymentStatus: 'expired', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C420306', + gatewaySlug: 'paysafecard', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420307', + gatewaySlug: 'paysafecard', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420308', + gatewaySlug: 'paysafecard', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007259', + gatewaySlug: 'klarna', + paymentStatus: 'authorized', + orderStatus: 'processing', + }, + { + testId: 'C3007260', + gatewaySlug: 'klarna', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007261', + gatewaySlug: 'klarna', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007262', + gatewaySlug: 'klarna', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007263', + gatewaySlug: 'bancomatpay', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007264', + gatewaySlug: 'bancomatpay', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007265', + gatewaySlug: 'bancomatpay', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007266', + gatewaySlug: 'bancomatpay', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3241643', + gatewaySlug: 'alma', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3241644', + gatewaySlug: 'alma', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3241645', + gatewaySlug: 'alma', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3241646', + gatewaySlug: 'alma', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3437846', + gatewaySlug: 'trustly', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3437847', + gatewaySlug: 'trustly', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3437848', + gatewaySlug: 'trustly', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3437849', + gatewaySlug: 'trustly', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3622417', + gatewaySlug: 'riverty', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3622418', + gatewaySlug: 'riverty', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3622419', + gatewaySlug: 'riverty', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3622420', + gatewaySlug: 'riverty', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3622429', + gatewaySlug: 'payconiq', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3622430', + gatewaySlug: 'payconiq', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3622431', + gatewaySlug: 'payconiq', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3622432', + gatewaySlug: 'payconiq', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3757247', + gatewaySlug: 'satispay', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3757248', + gatewaySlug: 'satispay', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3757249', + gatewaySlug: 'satispay', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3757250', + gatewaySlug: 'satispay', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + + /** + * Deprecated gateways + */ + + // { + // testId: 'C420249', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C420250', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420251', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420252', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420279', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C420280', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420281', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420282', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420223', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C420224', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420225', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420226', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, +]; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-credit-card-mollie-components.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-credit-card-mollie-components.ts new file mode 100644 index 000000000..41dc67f47 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-credit-card-mollie-components.ts @@ -0,0 +1,107 @@ +/** + * Internal dependencies + */ +import { cards, MollieTestData } from '../../../../resources'; + +export const creditCardMollieComponentsClassicCheckout: MollieTestData.PaymentStatus[] = [ + { + testId: 'C3376', + gatewaySlug: 'creditcard', + paymentStatus: 'paid', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'processing', + }, + { + testId: 'C3377', + gatewaySlug: 'creditcard', + paymentStatus: 'open', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, + { + testId: 'C3378', + gatewaySlug: 'creditcard', + paymentStatus: 'failed', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, { + testId: 'C3379', + gatewaySlug: 'creditcard', + paymentStatus: 'expired', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, +]; + +export const creditCardMollieComponentsCheckout: MollieTestData.PaymentStatus[] = [ + { + testId: 'C420273', + gatewaySlug: 'creditcard', + paymentStatus: 'paid', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'processing', + }, + { + testId: 'C420274', + gatewaySlug: 'creditcard', + paymentStatus: 'open', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, + { + testId: 'C420275', + gatewaySlug: 'creditcard', + paymentStatus: 'failed', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, { + testId: 'C420276', + gatewaySlug: 'creditcard', + paymentStatus: 'expired', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, +]; + +export const creditCardMollieComponentsPayForOrder: MollieTestData.PaymentStatus[] = [ + { + testId: 'C420388', + gatewaySlug: 'creditcard', + paymentStatus: 'paid', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'processing', + }, + { + testId: 'C420389', + gatewaySlug: 'creditcard', + paymentStatus: 'open', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, + { + testId: 'C420390', + gatewaySlug: 'creditcard', + paymentStatus: 'failed', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, { + testId: 'C420391', + gatewaySlug: 'creditcard', + paymentStatus: 'expired', + card: cards.visa, + mollieComponentsEnabled: 'yes', + orderStatus: 'pending', + }, +]; + diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-pay-for-order.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-pay-for-order.ts new file mode 100644 index 000000000..1fecf2e6f --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/eur-data-pay-for-order.ts @@ -0,0 +1,612 @@ +/** + * Internal dependencies + */ +import { cards, MollieTestData } from '../../../../resources'; + +export const payForOrderEur: MollieTestData.PaymentStatus[] = [ + // { + // testId: '', + // gatewaySlug: 'applepay', + // paymentStatus: 'paid', + // orderStatus: 'processing', + // }, + { + testId: 'C420334', + gatewaySlug: 'in3', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420335', + gatewaySlug: 'in3', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420336', + gatewaySlug: 'in3', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420337', + gatewaySlug: 'in3', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420345', + gatewaySlug: 'bancontact', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420346', + gatewaySlug: 'bancontact', + paymentStatus: 'open', + orderStatus: 'pending', + }, + { + testId: 'C420347', + gatewaySlug: 'bancontact', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420348', + gatewaySlug: 'bancontact', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420349', + gatewaySlug: 'bancontact', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420350', + gatewaySlug: 'przelewy24', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420351', + gatewaySlug: 'przelewy24', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420352', + gatewaySlug: 'przelewy24', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420353', + gatewaySlug: 'przelewy24', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + // { + // testId: '', + // gatewaySlug: 'voucher', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + { + testId: 'C420359', + gatewaySlug: 'ideal', + paymentStatus: 'paid', + bankIssuer: 'ING', + orderStatus: 'processing', + }, + { + testId: 'C420360', + gatewaySlug: 'ideal', + paymentStatus: 'open', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420361', + gatewaySlug: 'ideal', + paymentStatus: 'failed', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420363', + gatewaySlug: 'ideal', + paymentStatus: 'canceled', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420362', + gatewaySlug: 'ideal', + paymentStatus: 'expired', + bankIssuer: 'ING', + orderStatus: 'pending', + }, + { + testId: 'C420368', + gatewaySlug: 'paypal', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420369', + gatewaySlug: 'paypal', + paymentStatus: 'pending', + orderStatus: 'pending', + }, + { + testId: 'C420370', + gatewaySlug: 'paypal', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420371', + gatewaySlug: 'paypal', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420372', + gatewaySlug: 'paypal', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + // { + // testId: '', + // gatewaySlug: 'giftcard', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + { + testId: 'C420375', + gatewaySlug: 'eps', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420376', + gatewaySlug: 'eps', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420377', + gatewaySlug: 'eps', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420378', + gatewaySlug: 'eps', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420379', + gatewaySlug: 'kbc', + paymentStatus: 'paid', + bankIssuer: 'KBC', + orderStatus: 'processing', + }, + { + testId: 'C420380', + gatewaySlug: 'kbc', + paymentStatus: 'failed', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C420381', + gatewaySlug: 'kbc', + paymentStatus: 'canceled', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C420382', + gatewaySlug: 'kbc', + paymentStatus: 'expired', + bankIssuer: 'KBC', + orderStatus: 'pending', + }, + { + testId: 'C420383', + gatewaySlug: 'creditcard', + paymentStatus: 'paid', + card: cards.visa, + orderStatus: 'processing', + }, + { + testId: 'C420384', + gatewaySlug: 'creditcard', + paymentStatus: 'open', + card: cards.visa, + orderStatus: 'pending', + }, + { + testId: 'C420385', + gatewaySlug: 'creditcard', + paymentStatus: 'failed', + card: cards.visa, + orderStatus: 'pending', + }, + // { + // testId: 'C420387', + // gatewaySlug: 'creditcard', + // paymentStatus: 'canceled', + // card: cards.visa, + // orderStatus: 'pending', + // }, + { + testId: 'C420386', + gatewaySlug: 'creditcard', + paymentStatus: 'expired', + card: cards.visa, + orderStatus: 'pending', + }, + { + testId: 'C420399', + gatewaySlug: 'banktransfer', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420398', + gatewaySlug: 'banktransfer', + paymentStatus: 'open', + orderStatus: 'on-hold', + }, + { + testId: 'C420400', + gatewaySlug: 'banktransfer', + paymentStatus: 'expired', + orderStatus: 'on-hold', + }, + { + testId: 'C420401', + gatewaySlug: 'mybank', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420402', + gatewaySlug: 'mybank', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420403', + gatewaySlug: 'mybank', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420404', + gatewaySlug: 'mybank', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420409', + gatewaySlug: 'belfius', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420410', + gatewaySlug: 'belfius', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C420411', + gatewaySlug: 'belfius', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420412', + gatewaySlug: 'belfius', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C420413', + gatewaySlug: 'billie', + paymentStatus: 'authorized', + orderStatus: 'processing', + billingCompany: 'Syde', + }, + { + testId: 'C420414', + gatewaySlug: 'billie', + paymentStatus: 'failed', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C420415', + gatewaySlug: 'billie', + paymentStatus: 'canceled', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C420416', + gatewaySlug: 'billie', + paymentStatus: 'expired', + orderStatus: 'pending', + billingCompany: 'Syde', + }, + { + testId: 'C420417', + gatewaySlug: 'paysafecard', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C420418', + gatewaySlug: 'paysafecard', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C420419', + gatewaySlug: 'paysafecard', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007283', + gatewaySlug: 'klarna', + paymentStatus: 'authorized', + orderStatus: 'processing', + }, + { + testId: 'C3007284', + gatewaySlug: 'klarna', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007285', + gatewaySlug: 'klarna', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007286', + gatewaySlug: 'klarna', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007291', + gatewaySlug: 'bancomatpay', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007292', + gatewaySlug: 'bancomatpay', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007293', + gatewaySlug: 'bancomatpay', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007294', + gatewaySlug: 'bancomatpay', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3241647', + gatewaySlug: 'alma', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3241648', + gatewaySlug: 'alma', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3241649', + gatewaySlug: 'alma', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3241650', + gatewaySlug: 'alma', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3437850', + gatewaySlug: 'trustly', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3437851', + gatewaySlug: 'trustly', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3437852', + gatewaySlug: 'trustly', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3437853', + gatewaySlug: 'trustly', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3622421', + gatewaySlug: 'riverty', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3622422', + gatewaySlug: 'riverty', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3622423', + gatewaySlug: 'riverty', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3622424', + gatewaySlug: 'riverty', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3622433', + gatewaySlug: 'payconiq', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3622434', + gatewaySlug: 'payconiq', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3622435', + gatewaySlug: 'payconiq', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3622436', + gatewaySlug: 'payconiq', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3757243', + gatewaySlug: 'satispay', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3757244', + gatewaySlug: 'satispay', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3757245', + gatewaySlug: 'satispay', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3757246', + gatewaySlug: 'satispay', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + + /** + * Deprecated gateways + */ + + // { + // testId: 'C420364', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C420365', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420366', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420367', + // gatewaySlug: 'klarnapaylater', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420394', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C420395', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420396', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420397', + // gatewaySlug: 'klarnapaynow', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420338', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'authorized', + // orderStatus: 'processing', + // }, + // { + // testId: 'C420339', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'failed', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420340', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'canceled', + // orderStatus: 'pending', + // }, + // { + // testId: 'C420341', + // gatewaySlug: 'klarnasliceit', + // paymentStatus: 'expired', + // orderStatus: 'pending', + // }, +]; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/index.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/index.ts new file mode 100644 index 000000000..519b2c370 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/index.ts @@ -0,0 +1,8 @@ +export * from './data-conversion'; +export * from './eur-data-checkout-classic'; +export * from './eur-data-checkout'; +export * from './eur-data-pay-for-order'; +export * from './eur-data-credit-card-mollie-components'; +export * from './non-eur-data-checkout-classic'; +export * from './non-eur-data-checkout'; +export * from './non-eur-data-pay-for-order'; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-checkout-classic.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-checkout-classic.ts new file mode 100644 index 000000000..12e781769 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-checkout-classic.ts @@ -0,0 +1,56 @@ +/** + * Internal dependencies + */ +import { MollieTestData } from '../../../../resources'; + +export const classicCheckoutNonEur: MollieTestData.PaymentStatus[] = + [ + { + testId: 'C300724', + gatewaySlug: 'twint', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007248', + gatewaySlug: 'twint', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007249', + gatewaySlug: 'twint', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007250', + gatewaySlug: 'twint', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007251', + gatewaySlug: 'blik', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007252', + gatewaySlug: 'blik', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007253', + gatewaySlug: 'blik', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007254', + gatewaySlug: 'blik', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + ]; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-checkout.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-checkout.ts new file mode 100644 index 000000000..7762195ab --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-checkout.ts @@ -0,0 +1,55 @@ +/** + * Internal dependencies + */ +import { MollieTestData } from '../../../../resources'; + +export const checkoutNonEur: MollieTestData.PaymentStatus[] = [ + { + testId: 'C3007271', + gatewaySlug: 'twint', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007272', + gatewaySlug: 'twint', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007273', + gatewaySlug: 'twint', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007274', + gatewaySlug: 'twint', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007275', + gatewaySlug: 'blik', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007276', + gatewaySlug: 'blik', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007277', + gatewaySlug: 'blik', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007278', + gatewaySlug: 'blik', + paymentStatus: 'expired', + orderStatus: 'pending', + }, +]; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-pay-for-order.ts b/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-pay-for-order.ts new file mode 100644 index 000000000..f0ddcdd06 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-data/non-eur-data-pay-for-order.ts @@ -0,0 +1,55 @@ +/** + * Internal dependencies + */ +import { MollieTestData } from '../../../../resources'; + +export const payForOrderNonEur: MollieTestData.PaymentStatus[] = [ + { + testId: 'C3007279', + gatewaySlug: 'twint', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007280', + gatewaySlug: 'twint', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007281', + gatewaySlug: 'twint', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007282', + gatewaySlug: 'twint', + paymentStatus: 'expired', + orderStatus: 'pending', + }, + { + testId: 'C3007287', + gatewaySlug: 'blik', + paymentStatus: 'paid', + orderStatus: 'processing', + }, + { + testId: 'C3007288', + gatewaySlug: 'blik', + paymentStatus: 'failed', + orderStatus: 'pending', + }, + { + testId: 'C3007289', + gatewaySlug: 'blik', + paymentStatus: 'canceled', + orderStatus: 'pending', + }, + { + testId: 'C3007290', + gatewaySlug: 'blik', + paymentStatus: 'expired', + orderStatus: 'pending', + }, +]; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-scenarios/checkout-classic.scenario.ts b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/checkout-classic.scenario.ts new file mode 100644 index 000000000..14f86465b --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/checkout-classic.scenario.ts @@ -0,0 +1,35 @@ +/** + * External dependencies + */ +import { countTotals } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { test } from '../../../../utils'; + +export const testPaymentStatusOnClassicCheckout = ( testId: string, order ) => { + const gatewaySettings = order.payment.gateway.settings; + let gatewayName = order.payment.gateway.name; + if( gatewaySettings.mollie_components_enabled === 'yes' ) { + gatewayName += ' - Mollie components'; + } + + test( `${ testId } | Classic checkout - ${ gatewayName } - Payment status "${ order.payment.status }" creates order with status "${ order.orderStatus }"`, async ( { + wooCommerceApi, + transaction, + wooCommerceOrderEdit, + } ) => { + const currency = order.payment.gateway.currency; + if ( currency !== undefined && currency !== 'EUR' ) { + await wooCommerceApi.updateGeneralSettings( { + woocommerce_currency: currency, + } ); + } + order.payment.amount = ( await countTotals( order ) ).order; + const orderId = await transaction.onClassicCheckout( order ); + await wooCommerceOrderEdit.assertOrderDetails( + Number( orderId ), + order + ); + } ); +}; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-scenarios/checkout.scenario.ts b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/checkout.scenario.ts new file mode 100644 index 000000000..ee1fc927b --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/checkout.scenario.ts @@ -0,0 +1,35 @@ +/** + * External dependencies + */ +import { countTotals } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { test } from '../../../../utils'; + +export const testPaymentStatusOnCheckout = ( testId: string, order ) => { + const gatewaySettings = order.payment.gateway.settings; + let gatewayName = order.payment.gateway.name; + if( gatewaySettings.mollie_components_enabled === 'yes' ) { + gatewayName += ' - Mollie components'; + } + + test( `${ testId } | Checkout - ${ gatewayName } - Payment status "${ order.payment.status }" creates order with status "${ order.orderStatus }"`, async ( { + wooCommerceApi, + transaction, + wooCommerceOrderEdit, + } ) => { + const currency = order.payment.gateway.currency; + if ( currency !== undefined && currency !== 'EUR' ) { + await wooCommerceApi.updateGeneralSettings( { + woocommerce_currency: currency, + } ); + } + order.payment.amount = ( await countTotals( order ) ).order; + const orderId = await transaction.onCheckout( order ); + await wooCommerceOrderEdit.assertOrderDetails( + Number( orderId ), + order + ); + } ); +}; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-scenarios/index.ts b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/index.ts new file mode 100644 index 000000000..a2c8706a0 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/index.ts @@ -0,0 +1,3 @@ +export * from './checkout-classic.scenario'; +export * from './checkout.scenario'; +export * from './pay-for-order.scenario'; diff --git a/tests/qa/tests/05-transaction/payment-status/.test-scenarios/pay-for-order.scenario.ts b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/pay-for-order.scenario.ts new file mode 100644 index 000000000..57f76dacc --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/.test-scenarios/pay-for-order.scenario.ts @@ -0,0 +1,35 @@ +/** + * External dependencies + */ +import { countTotals } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { test } from '../../../../utils'; + +export const testPaymentStatusOnPayForOrder = ( testId: string, order ) => { + const gatewaySettings = order.payment.gateway.settings; + let gatewayName = order.payment.gateway.name; + if( gatewaySettings.mollie_components_enabled === 'yes' ) { + gatewayName += ' - Mollie components'; + } + + test( `${ testId } | Pay for order - ${ gatewayName } - Payment status "${ order.payment.status }" creates order with status "${ order.orderStatus }"`, async ( { + wooCommerceApi, + transaction, + wooCommerceOrderEdit, + } ) => { + const currency = order.payment.gateway.currency; + if ( currency !== undefined && currency !== 'EUR' ) { + await wooCommerceApi.updateGeneralSettings( { + woocommerce_currency: currency, + } ); + } + order.payment.amount = ( await countTotals( order ) ).order; + const orderId = await transaction.onPayForOrder( order ); + await wooCommerceOrderEdit.assertOrderDetails( + Number( orderId ), + order + ); + } ); +}; diff --git a/tests/qa/tests/05-transaction/payment-status/eur-checkout-classic.spec.ts b/tests/qa/tests/05-transaction/payment-status/eur-checkout-classic.spec.ts new file mode 100644 index 000000000..83466dc2f --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/eur-checkout-classic.spec.ts @@ -0,0 +1,27 @@ +/** + * Internal dependencies + */ +import { test } from '../../../utils'; +import { testPaymentStatusOnClassicCheckout } from './.test-scenarios'; +import { createShopOrder, classicCheckoutEur } from './.test-data'; +import { shopSettings } from '../../../resources'; + +test.beforeAll( async ( { utils }, testInfo ) => { + if ( testInfo.project.name !== 'all' ) { + return; + } + + await utils.configureStore( { + settings: { + general: shopSettings.germany.general, + }, + classicPages: true, + } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +for ( const testData of classicCheckoutEur ) { + const order = createShopOrder( testData ); + testPaymentStatusOnClassicCheckout( testData.testId, order ); +} diff --git a/tests/qa/tests/05-transaction/payment-status/eur-checkout.spec.ts b/tests/qa/tests/05-transaction/payment-status/eur-checkout.spec.ts new file mode 100644 index 000000000..5f22f5eb6 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/eur-checkout.spec.ts @@ -0,0 +1,27 @@ +/** + * Internal dependencies + */ +import { test } from '../../../utils'; +import { testPaymentStatusOnCheckout } from './.test-scenarios'; +import { createShopOrder, checkoutEur } from './.test-data'; +import { shopSettings } from '../../../resources'; + +test.beforeAll( async ( { utils }, testInfo ) => { + if ( testInfo.project.name !== 'all' ) { + return; + } + + await utils.configureStore( { + settings: { + general: shopSettings.germany.general, + }, + classicPages: false, + } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +for ( const testData of checkoutEur ) { + const order = createShopOrder( testData ); + testPaymentStatusOnCheckout( testData.testId, order ); +} diff --git a/tests/qa/tests/05-transaction/payment-status/eur-credit-card-mollie-components.spec.ts b/tests/qa/tests/05-transaction/payment-status/eur-credit-card-mollie-components.spec.ts new file mode 100644 index 000000000..902648ab7 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/eur-credit-card-mollie-components.spec.ts @@ -0,0 +1,64 @@ +/** + * Internal dependencies + */ +import { test } from '../../../utils'; +import { + testPaymentStatusOnClassicCheckout, + testPaymentStatusOnCheckout, + testPaymentStatusOnPayForOrder, +} from './.test-scenarios'; +import { + createShopOrder, + creditCardMollieComponentsClassicCheckout, + creditCardMollieComponentsCheckout, + creditCardMollieComponentsPayForOrder, +} from './.test-data'; +import { shopSettings } from '../../../resources'; + +test.beforeAll( async ( { utils, mollieApi } ) => { + await utils.configureStore( { + settings: { + general: shopSettings.germany.general, + }, + } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); + await mollieApi.updateMollieGateway( 'creditcard', { + mollie_components_enabled: 'yes', + } ); +} ); + +// Classic checkout page +test.describe( () => { + test.beforeAll( async ( { utils } ) => { + await utils.configureStore( { classicPages: true } ); + } ); + + for ( const testData of creditCardMollieComponentsClassicCheckout ) { + const order = createShopOrder( testData ); + testPaymentStatusOnClassicCheckout( testData.testId, order ); + } +} ); + +// Block checkout page +test.describe( () => { + test.beforeAll( async ( { utils } ) => { + await utils.configureStore( { classicPages: false } ); + } ); + + for ( const testData of creditCardMollieComponentsCheckout ) { + const order = createShopOrder( testData ); + testPaymentStatusOnCheckout( testData.testId, order ); + } + + for ( const testData of creditCardMollieComponentsPayForOrder ) { + const order = createShopOrder( testData ); + testPaymentStatusOnPayForOrder( testData.testId, order ); + } +} ); + +test.afterAll( async ( { mollieApi } ) => { + await mollieApi.updateMollieGateway( 'creditcard', { + mollie_components_enabled: 'no', + } ); +} ); diff --git a/tests/qa/tests/05-transaction/payment-status/eur-pay-for-order.spec.ts b/tests/qa/tests/05-transaction/payment-status/eur-pay-for-order.spec.ts new file mode 100644 index 000000000..6a5e6a069 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/eur-pay-for-order.spec.ts @@ -0,0 +1,26 @@ +/** + * Internal dependencies + */ +import { test } from '../../../utils'; +import { testPaymentStatusOnPayForOrder } from './.test-scenarios'; +import { createShopOrder, payForOrderEur } from './.test-data'; +import { shopSettings } from '../../../resources'; + +test.beforeAll( async ( { utils }, testInfo ) => { + if ( testInfo.project.name !== 'all' ) { + return; + } + await utils.configureStore( { + settings: { + general: shopSettings.germany.general, + }, + classicPages: false, + } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +for ( const testData of payForOrderEur ) { + const order = createShopOrder( testData ); + testPaymentStatusOnPayForOrder( testData.testId, order ); +} diff --git a/tests/qa/tests/05-transaction/payment-status/non-eur-checkout-classic.spec.ts b/tests/qa/tests/05-transaction/payment-status/non-eur-checkout-classic.spec.ts new file mode 100644 index 000000000..3224a8a95 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/non-eur-checkout-classic.spec.ts @@ -0,0 +1,29 @@ +/** + * Internal dependencies + */ +import { test } from '../../../utils'; +import { testPaymentStatusOnClassicCheckout } from './.test-scenarios'; +import { + createShopOrder, + classicCheckoutNonEur, +} from './.test-data'; +import { shopSettings } from '../../../resources'; + +test.beforeAll( async ( { utils }, testInfo ) => { + if ( testInfo.project.name !== 'all' ) { + return; + } + await utils.configureStore( { + settings: { + general: shopSettings.germany.general, + }, + classicPages: true, + } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +for ( const testData of classicCheckoutNonEur ) { + const order = createShopOrder( testData ); + testPaymentStatusOnClassicCheckout( testData.testId, order ); +} diff --git a/tests/qa/tests/05-transaction/payment-status/non-eur-checkout.spec.ts b/tests/qa/tests/05-transaction/payment-status/non-eur-checkout.spec.ts new file mode 100644 index 000000000..fe5f3762f --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/non-eur-checkout.spec.ts @@ -0,0 +1,26 @@ +/** + * Internal dependencies + */ +import { test } from '../../../utils'; +import { testPaymentStatusOnCheckout } from './.test-scenarios'; +import { createShopOrder, checkoutNonEur } from './.test-data'; +import { shopSettings } from '../../../resources'; + +test.beforeAll( async ( { utils }, testInfo ) => { + if ( testInfo.project.name !== 'all' ) { + return; + } + await utils.configureStore( { + settings: { + general: shopSettings.germany.general, + }, + classicPages: false, + } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +for ( const testData of checkoutNonEur ) { + const order = createShopOrder( testData ); + testPaymentStatusOnCheckout( testData.testId, order ); +} diff --git a/tests/qa/tests/05-transaction/payment-status/non-eur-pay-for-order.spec.ts b/tests/qa/tests/05-transaction/payment-status/non-eur-pay-for-order.spec.ts new file mode 100644 index 000000000..0c6ba41a4 --- /dev/null +++ b/tests/qa/tests/05-transaction/payment-status/non-eur-pay-for-order.spec.ts @@ -0,0 +1,26 @@ +/** + * Internal dependencies + */ +import { test } from '../../../utils'; +import { testPaymentStatusOnPayForOrder } from './.test-scenarios'; +import { createShopOrder, payForOrderNonEur } from './.test-data'; +import { shopSettings } from '../../../resources'; + +test.beforeAll( async ( { utils }, testInfo ) => { + if ( testInfo.project.name !== 'all' ) { + return; + } + await utils.configureStore( { + settings: { + general: shopSettings.germany.general, + }, + classicPages: false, + } ); + await utils.installActivateMollie(); + await utils.cleanReconnectMollie(); +} ); + +for ( const testData of payForOrderNonEur ) { + const order = createShopOrder( testData ); + testPaymentStatusOnPayForOrder( testData.testId, order ); +} diff --git a/tests/qa/tsconfig.json b/tests/qa/tsconfig.json new file mode 100644 index 000000000..2169c8867 --- /dev/null +++ b/tests/qa/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "ES2019", + "types": ["node"], + "esModuleInterop": true, + "skipLibCheck": true, + "strict": false, + "baseUrl": ".", + "resolveJsonModule": true + } + } \ No newline at end of file diff --git a/tests/qa/utils/admin/index.ts b/tests/qa/utils/admin/index.ts new file mode 100644 index 000000000..a3f2f5580 --- /dev/null +++ b/tests/qa/utils/admin/index.ts @@ -0,0 +1,6 @@ +export * from './mollie-settings-page'; +export * from './mollie-settings-api-keys'; +export * from './mollie-settings-payment-methods'; +export * from './mollie-settings-advanced'; +export * from './mollie-settings-gateway'; +export * from './woocommerce-order-edit'; diff --git a/tests/qa/utils/admin/mollie-settings-advanced.ts b/tests/qa/utils/admin/mollie-settings-advanced.ts new file mode 100644 index 000000000..f5c2906ea --- /dev/null +++ b/tests/qa/utils/admin/mollie-settings-advanced.ts @@ -0,0 +1,116 @@ +/** + * Internal dependencies + */ +import { MollieSettingsPage } from './mollie-settings-page'; +import { MollieSettings } from '../../resources'; +import { urls } from '../urls'; + +export class MollieSettingsAdvanced extends MollieSettingsPage { + url = urls.mollie.admin.settings.advanced; + tabText = 'Advanced settings'; + headingText = 'Mollie advanced settings'; + + // Locators + debugLogCheckbox = () => + this.page.locator( '#mollie-payments-for-woocommerce_debug' ); + orderStatusCancelledPaymentSelect = () => + this.page.locator( + '#mollie-payments-for-woocommerce_order_status_cancelled_payments' + ); + paymentScreenLanguageSelect = () => + this.page.locator( '#mollie-payments-for-woocommerce_payment_locale' ); + storeCustomerDetailsAtMollieCheckbox = () => + this.page.locator( + '#mollie-payments-for-woocommerce_customer_details' + ); + selectAPIMethodSelect = () => + this.page.locator( '#mollie-payments-for-woocommerce_api_switch' ); + apiPaymentDescriptionInput = () => + this.page.locator( + '#mollie-payments-for-woocommerce_api_payment_description' + ); + apiPaymentDescriptionButton = ( + name: MollieSettings.ApiPaymentDescription + ) => this.page.locator( `button[data-tag="${ name }"]` ); + surchargeGatewayFeeLabelInput = () => + this.page.locator( '#mollie-payments-for-woocommerce_gatewayFeeLabel' ); + removeMollieDataFromDatabaseOnUninstall = () => + this.page.locator( + '#mollie-payments-for-woocommerce_removeOptionsAndTransients' + ); + clearNowLink = () => + this.page.locator( + 'label[for="mollie-payments-for-woocommerce_removeOptionsAndTransients"] a' + ); + placingPaymentsOnHoldSelect = () => + this.page.locator( + '#mollie-payments-for-woocommerce_place_payment_onhold' + ); + + // Actions + + /** + * Setup Mollie Advanced settings + * + * @param data + */ + setup = async ( data: MollieSettings.Advanced ) => { + if ( data.debugLogEnabled !== undefined ) { + await this.debugLogCheckbox().setChecked( data.debugLogEnabled ); + } + + if ( data.orderStatusCancelledPayments !== undefined ) { + await this.orderStatusCancelledPaymentSelect().selectOption( + data.orderStatusCancelledPayments + ); + } + + if ( data.paymentLocale !== undefined ) { + await this.paymentScreenLanguageSelect().selectOption( + data.paymentLocale + ); + } + + if ( data.customerDetails !== undefined ) { + await this.storeCustomerDetailsAtMollieCheckbox().setChecked( + data.customerDetails + ); + } + + if ( data.apiMethod !== undefined ) { + await this.selectAPIMethodSelect().selectOption( data.apiMethod ); + } + + if ( data.apiPaymentDescription !== undefined ) { + await this.apiPaymentDescriptionInput().clear(); + await this.apiPaymentDescriptionButton( + data.apiPaymentDescription + ).click(); + } + + if ( data.gatewayFeeLabel !== undefined ) { + await this.surchargeGatewayFeeLabelInput().fill( + data.gatewayFeeLabel + ); + } + + if ( data.removeOptionsAndTransients !== undefined ) { + await this.removeMollieDataFromDatabaseOnUninstall().setChecked( + data.removeOptionsAndTransients + ); + } + + if ( data.placePaymentOnhold !== undefined ) { + await this.placingPaymentsOnHoldSelect().selectOption( + data.placePaymentOnhold + ); + } + }; + + cleanDb = async () => { + await this.clearNowLink().click(); + await this.page.waitForLoadState(); + }; + + // Assertions +} diff --git a/tests/qa/utils/admin/mollie-settings-api-keys.ts b/tests/qa/utils/admin/mollie-settings-api-keys.ts new file mode 100644 index 000000000..2bdecdfb8 --- /dev/null +++ b/tests/qa/utils/admin/mollie-settings-api-keys.ts @@ -0,0 +1,59 @@ +/** + * Internal dependencies + */ +import { mollieConfigGeneral, MollieSettings } from '../../resources'; +import { urls } from '../urls'; +import { MollieSettingsPage } from './mollie-settings-page'; + +export class MollieSettingsApiKeys extends MollieSettingsPage { + url = urls.mollie.admin.settings.home; + tabText = 'API Keys'; + headingText = 'Mollie API Keys'; + + // Locators + successfullyConnectedWithTestApiText = () => + this.page.getByText( 'Successfully connected with Test API' ); + failedToConnectToMollieApiText = () => + this.page.getByText( + 'Failed to connect to Mollie API - check your API keys' + ); + molliePaymentModeSelect = () => + this.page.locator( + '#mollie-payments-for-woocommerce_test_mode_enabled' + ); + liveApiKeyInput = () => + this.page.locator( '#mollie-payments-for-woocommerce_live_api_key' ); + testApiKeyInput = () => + this.page.locator( '#mollie-payments-for-woocommerce_test_api_key' ); + + // Actions + + /** + * Setup Mollie General settings + * + * @param data + */ + setup = async ( data: MollieSettings.ApiKeys ) => { + if ( data.testModeEnabled !== undefined ) { + await this.molliePaymentModeSelect().selectOption( + data.testModeEnabled + ); + } + + if ( data.liveApiKey !== undefined ) { + await this.liveApiKeyInput().fill( data.liveApiKey ); + } + + if ( data.testApiKey !== undefined ) { + await this.testApiKeyInput().fill( data.testApiKey ); + } + }; + + setApiKeys = async ( + data: MollieSettings.ApiKeys = mollieConfigGeneral.default + ) => { + await this.setup( data ); + }; + + // Assertions +} diff --git a/tests/qa/utils/admin/mollie-settings-gateway.ts b/tests/qa/utils/admin/mollie-settings-gateway.ts new file mode 100644 index 000000000..6ec0d70a1 --- /dev/null +++ b/tests/qa/utils/admin/mollie-settings-gateway.ts @@ -0,0 +1,399 @@ +/** + * External dependencies + */ +import { WooCommerceAdminPage } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { gateways, MollieGateway, MollieSettings } from '../../resources'; +import { urls } from '../urls'; + +export class MollieSettingsGateway extends WooCommerceAdminPage { + url: string; + gateway: MollieGateway; + + constructor( { page, gatewaySlug } ) { + super( { page } ); + this.url = urls.mollie.admin.settings.gateway + gatewaySlug; + this.gateway = gateways[ gatewaySlug ]; + } + + // Locators + enableGatewayCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_enabled` + ); + useApiDynamicTitleAndGatewayLogoCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_use_api_title` + ); + titleInput = () => + this.page.locator( `#mollie_wc_gateway_${ this.gateway.slug }_title` ); + displayLogoCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_display_logo` + ); + enableCustomLogoCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_enable_custom_logo` + ); + uploadCustomLogoButton = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_upload_logo` + ); + descriptionTextarea = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_description` + ); + + sellToSpecificCountriesCombobox = () => + this.page.getByPlaceholder( 'Choose countries' ); + selectAllButton = () => this.page.locator( 'a.select_all.button' ); + selectNoneButton = () => this.page.locator( 'a.select_none.button' ); + + paymentSurchargeSelect = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_payment_surcharge` + ); + paymentSurchargeFixedAmountInput = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_fixed_fee` + ); + surchargeOnlyUnderLimitInput = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_maximum_limit` + ); + paymentSurchargePercentageAmountInput = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_percentage` + ); + paymentSurchargeLimitInput = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_surcharge_limit` + ); + + activateExpiryTimeSettingCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_activate_expiry_days_setting` + ); + expiryTimeInput = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_order_dueDate` + ); + showIssuersDropdownCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_issuers_dropdown_shown` + ); + initialOrderStatusSelect = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_initial_order_status` + ); + skipMolliePaymentScreenCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_skip_mollie_payment_screen` + ); + enableMollieComponentsCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_components_enabled` + ); + + enableApplePayButtonOnCartCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_apple_pay_button_enabled_cart` + ); + enableApplePayButtonOnProductCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_apple_pay_button_enabled_product` + ); + enableApplePayExpressButtonOnCheckoutCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_apple_pay_button_enabled_express_checkout` + ); + + paypalDisplayOnCartCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_paypal_button_enabled_cart` + ); + paypalDisplayOnProductCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_paypal_button_enabled_product` + ); + paypalButtonTextLanguageAndColorSelect = () => + this.page.locator( `#mollie_wc_gateway_${ this.gateway.slug }_color` ); + paypalMinimumAmountToDisplayButtonInput = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_paypal_button_minimum_amount` + ); + + giftcardsShowDropdownCheckbox = () => this.showIssuersDropdownCheckbox(); + kbcShowBanksDropdownCheckbox = () => this.showIssuersDropdownCheckbox(); + kbcIssuersEmptyOptionInput = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_issuers_empty_option` + ); + + voucherDefaultProductsCategorySelect = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mealvoucher_category_default` + ); + + enableIconsSelectorCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_enabler` + ); + showAmericanExpressIconCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_amex` + ); + showCartaSiIconCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_cartasi` + ); + showCarteBancaireIconCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_cartebancaire` + ); + showMaestroIconCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_maestro` + ); + showMastercardIconCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_mastercard` + ); + showVisaIconCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_visa` + ); + showVpayIconCheckbox = () => + this.page.locator( + `#mollie_wc_gateway_${ this.gateway.slug }_mollie_creditcard_icons_vpay` + ); + + // Actions + + /** + * Setup Mollie gateway settings + * + * @param data + */ + setup = async ( data: MollieSettings.Gateway = this.gateway.settings ) => { + if ( data.enabled !== undefined ) { + await this.enableGatewayCheckbox().setChecked( data.enabled ); + } + + if ( data.use_api_title !== undefined ) { + await this.useApiDynamicTitleAndGatewayLogoCheckbox().setChecked( + data.use_api_title === 'yes' + ); + } + + if ( data.title ) { + await this.titleInput().fill( data.title ); + } + + if ( data.display_logo !== undefined ) { + await this.displayLogoCheckbox().setChecked( data.display_logo === 'yes' ); + } + + if ( data.enable_custom_logo !== undefined ) { + await this.enableCustomLogoCheckbox().setChecked( + data.enable_custom_logo === 'yes' + ); + } + + if ( data.enable_custom_logo === 'yes' && data.custom_logo_path ) { + await this.uploadCustomLogoButton().setInputFiles( + './resources/files/mollie-test-logo.png' + ); + } + + if ( data.description !== undefined ) { + await this.descriptionTextarea().fill( data.description ); + } + + if ( data[ 'allowed_countries[]' ] && data[ 'allowed_countries[]' ].length > 0 ) { + await this.selectNoneButton().click(); + if ( data[ 'allowed_countries[]' ].length ) { + for ( const country of data[ 'allowed_countries[]' ] ) { + await this.sellToSpecificCountriesCombobox().click(); + await this.dropdownOption( country ).click(); + } + } + } + + if ( data.payment_surcharge ) { + await this.paymentSurchargeSelect().selectOption( + data.payment_surcharge + ); + + if ( data.fixed_fee ) { + await this.paymentSurchargeFixedAmountInput().fill( + data.fixed_fee + ); + } + + if ( data.maximum_limit ) { + await this.surchargeOnlyUnderLimitInput().fill( + data.maximum_limit + ); + } + + if ( data.percentage ) { + await this.paymentSurchargePercentageAmountInput().fill( + data.percentage + ); + } + + if ( data.surcharge_limit ) { + await this.paymentSurchargeLimitInput().fill( + data.surcharge_limit + ); + } + } + + if ( data.activate_expiry_days_setting !== undefined ) { + await this.activateExpiryTimeSettingCheckbox().setChecked( + data.activate_expiry_days_setting === 'yes' + ); + } + + if ( data.order_dueDate ) { + await this.expiryTimeInput().fill( data.order_dueDate ); + } + + if ( data.issuers_dropdown_shown ) { + await this.showIssuersDropdownCheckbox().setChecked( + data.issuers_dropdown_shown === 'yes' + ); + } + + if ( data.initial_order_status ) { + await this.initialOrderStatusSelect().selectOption( + data.initial_order_status + ); + } + + if ( data.skip_mollie_payment_screen !== undefined ) { + await this.skipMolliePaymentScreenCheckbox().setChecked( + data.skip_mollie_payment_screen === 'yes' + ); + } + + if ( data.mollie_apple_pay_button_enabled_cart !== undefined ) { + await this.enableApplePayButtonOnCartCheckbox().setChecked( + data.mollie_apple_pay_button_enabled_cart === 'yes' + ); + } + + if ( data.mollie_apple_pay_button_enabled_product !== undefined ) { + await this.enableApplePayButtonOnProductCheckbox().setChecked( + data.mollie_apple_pay_button_enabled_product === 'yes' + ); + } + + if ( data.mollie_apple_pay_button_enabled_express_checkout !== undefined ) { + await this.enableApplePayExpressButtonOnCheckoutCheckbox().setChecked( + data.mollie_apple_pay_button_enabled_express_checkout === 'yes' + ); + } + + if ( data.mollie_paypal_button_enabled_cart !== undefined ) { + await this.paypalDisplayOnCartCheckbox().setChecked( + data.mollie_paypal_button_enabled_cart === 'yes' + ); + } + + if ( data.mollie_paypal_button_enabled_product !== undefined ) { + await this.paypalDisplayOnProductCheckbox().setChecked( + data.mollie_paypal_button_enabled_product === 'yes' + ); + } + + if ( data.paypal_color ) { + await this.paypalButtonTextLanguageAndColorSelect().selectOption( + data.paypal_color + ); + } + + if ( data.mollie_paypal_button_minimum_amount ) { + await this.paypalMinimumAmountToDisplayButtonInput().fill( + data.mollie_paypal_button_minimum_amount + ); + } + + if ( data.issuers_dropdown_shown !== undefined ) { + await this.giftcardsShowDropdownCheckbox().setChecked( + data.issuers_dropdown_shown === 'yes' + ); + } + + if ( data.issuers_dropdown_shown !== undefined ) { + await this.kbcShowBanksDropdownCheckbox().setChecked( + data.issuers_dropdown_shown === 'yes' + ); + } + + if ( data.issuers_empty_option ) { + await this.kbcIssuersEmptyOptionInput().fill( + data.issuers_empty_option + ); + } + + if ( data.mealvoucher_category_default ) { + await this.voucherDefaultProductsCategorySelect().selectOption( + data.mealvoucher_category_default + ); + } + + if ( data.mollie_creditcard_icons_enabler !== undefined ) { + await this.enableIconsSelectorCheckbox().setChecked( + data.mollie_creditcard_icons_enabler === 'yes' + ); + } + + if ( data.mollie_creditcard_icons_amex !== undefined ) { + await this.showAmericanExpressIconCheckbox().setChecked( + data.mollie_creditcard_icons_amex === 'yes' + ); + } + + if ( data.mollie_creditcard_icons_cartasi !== undefined ) { + await this.showCartaSiIconCheckbox().setChecked( + data.mollie_creditcard_icons_cartasi === 'yes' + ); + } + + if ( data.mollie_creditcard_icons_cartebancaire !== undefined ) { + await this.showCarteBancaireIconCheckbox().setChecked( + data.mollie_creditcard_icons_cartebancaire === 'yes' + ); + } + + if ( data.mollie_creditcard_icons_maestro !== undefined ) { + await this.showMaestroIconCheckbox().setChecked( + data.mollie_creditcard_icons_maestro === 'yes' + ); + } + + if ( data.mollie_creditcard_icons_mastercard !== undefined ) { + await this.showMastercardIconCheckbox().setChecked( + data.mollie_creditcard_icons_mastercard === 'yes' + ); + } + + if ( data.mollie_creditcard_icons_visa !== undefined ) { + await this.showVisaIconCheckbox().setChecked( + data.mollie_creditcard_icons_visa === 'yes' + ); + } + + if ( data.mollie_creditcard_icons_vpay !== undefined ) { + await this.showVpayIconCheckbox().setChecked( + data.mollie_creditcard_icons_vpay === 'yes' + ); + } + }; + + // Assertions +} diff --git a/tests/qa/utils/admin/mollie-settings-page.ts b/tests/qa/utils/admin/mollie-settings-page.ts new file mode 100644 index 000000000..f6aa6659c --- /dev/null +++ b/tests/qa/utils/admin/mollie-settings-page.ts @@ -0,0 +1,26 @@ +/** + * External dependencies + */ +import { WooCommerceAdminPage } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { urls } from '../urls'; + +export class MollieSettingsPage extends WooCommerceAdminPage { + url = urls.mollie.admin.settings.home; + tabText: string; + headingText: string; + + // Locators + heading = () => + this.page.getByRole( 'heading', { name: String( this.headingText ) } ); + molliePluginDocumentationButton = () => + this.page.getByRole( 'link', { name: 'Mollie Plugin Documentation' } ); + contactMollieSupportButton = () => + this.page.getByRole( 'link', { name: 'Contact Mollie Support' } ); + + // Actions + + // Assertions +} diff --git a/tests/qa/utils/admin/mollie-settings-payment-methods.ts b/tests/qa/utils/admin/mollie-settings-payment-methods.ts new file mode 100644 index 000000000..be931bae7 --- /dev/null +++ b/tests/qa/utils/admin/mollie-settings-payment-methods.ts @@ -0,0 +1,20 @@ +/** + * External dependencies + */ +import { WooCommerceAdminPage } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { urls } from '../urls'; + +export class MollieSettingsPaymentMethods extends WooCommerceAdminPage { + url = urls.mollie.admin.settings.paymentMethods; + tabText: 'Payment methods'; + headingText: string; + + // Locators + + // Actions + + // Assertions +} diff --git a/tests/qa/utils/admin/woocommerce-order-edit.ts b/tests/qa/utils/admin/woocommerce-order-edit.ts new file mode 100644 index 000000000..93bd57198 --- /dev/null +++ b/tests/qa/utils/admin/woocommerce-order-edit.ts @@ -0,0 +1,166 @@ +/** + * External dependencies + */ +import { expect } from '@playwright/test'; +import { + WooCommerceOrderEdit as wooCommerceOrderEditBase, + formatMoney, +} from '@inpsyde/playwright-utils/build'; + +const { WLOP_NAME } = process.env; + +export class WooCommerceOrderEdit extends wooCommerceOrderEditBase { + // Locators + transactionIdText = ( transactionId ) => + this.orderNumberContainer().getByText( `(${ transactionId })` ); + billingDataTransactionIdInput = () => + this.billingDataContainer().getByLabel( 'Transaction ID' ); + + refundViaWorldlineButton = () => + this.page.locator( '.do-api-refund', { hasText: WLOP_NAME } ); + + productsTable = () => this.page.locator( '#order_line_items' ); + productRow = ( name ) => this.productsTable().getByRole( 'row', { name } ); + productRefundQtyInput = ( name ) => + this.productRow( name ).locator( '.refund_order_item_qty' ); + productRefundTotalInput = ( name ) => + this.productRow( name ).locator( '.refund_line_total' ); + productRefundTaxInput = ( name ) => + this.productRow( name ).locator( '.refund_line_tax' ); + + firstRefundTotalInput = () => + this.productsTable().locator( '.refund_line_total' ).first(); + + shippingTable = () => this.page.locator( '#order_shipping_line_items' ); + shippingRow = ( name ) => this.shippingTable().getByRole( 'row', { name } ); + shippingRefundTotalInput = ( name ) => + this.shippingRow( name ).locator( '.refund_line_total' ); + shippingRefundTaxInput = ( name ) => + this.shippingRow( name ).locator( '.refund_line_tax' ); + + totalWorldlineRefunded = () => + this.totalsTableRow( `${ WLOP_NAME } Refunded:` ); + totalWorldlineNetTotal = () => + this.totalsTableRow( `${ WLOP_NAME } Net Total:` ); + + // Actions + /** + * Performs Worldline refund + * + * @param amount + */ + makeRefund = async ( amount?: string ) => { + await this.refundButton().click(); + if ( ! amount ) { + const totalAmount = + ( await this.totalAvailableToRefund().textContent() ) || ''; + amount = parseFloat( + totalAmount.replace( /[^\d.-]+/g, '' ).trim() + ).toFixed( 2 ); + } + await this.firstRefundTotalInput().fill( amount ); + await this.page.on( 'dialog', ( dialog ) => dialog.accept() ); + // await this.page.on('dialog', dialog => dialog.accept()); + await this.refundViaWorldlineButton().click(); + }; + + /** + * Performs Worldline refund for specific product + * + * @param productName + * @param qty + */ + makeRefundForProduct = async ( productName: string, qty: number = 1 ) => { + await this.refundButton().click(); + await this.lineItemRefundQuantityInput( productName ).fill( + String( qty ) + ); + await this.page.on( 'dialog', ( dialog ) => dialog.accept() ); + // await this.page.on('dialog', dialog => dialog.accept()); + await this.refundViaWorldlineButton().click(); + }; + + // Assertions + + /** + * Asserts data provided on the order page + * + * @param orderId + * @param orderData + * @param millieData + */ + assertOrderDetails = async ( + orderId: number, + orderData: WooCommerce.ShopOrder, + millieData? + ) => { + await super.assertOrderDetails( orderId, orderData ); + + if ( ! millieData ) { + return; + } + + // Transaction ID + if ( + millieData.transaction_id !== undefined && + millieData.orderTotal > 0 + ) { + } + }; + + assertRefundRequested = async ( amount: string, currency? ) => { + const orderNote = this.orderNoteWithText( + `${ WLOP_NAME }: Your refund request for ${ await formatMoney( + Number( amount ), + currency + ) } has been submitted and is pending approval.` + ); + await this.retryLocatorVisibility( orderNote ); + await expect( orderNote ).toBeVisible(); + }; + + /** + * Asserts refund has been finished: + * - Order note received + * - Processed refund ID is present + * - Order status is expected + * + * @param wlopRefundId + * @param orderStatus + * @param amount + * @param currency + */ + assertRefundFinished = async ( + wlopRefundId: string, + orderStatus: WooCommerce.OrderStatus, + amount: string, + currency? + ) => { + const orderNote = this.orderNoteWithText( + `${ WLOP_NAME }: ${ await formatMoney( + Number( amount ), + currency + ) } was refunded.` + ); + const refundProcessedText = this.page.getByText( + `Refund processed. ${ WLOP_NAME } transaction ID: ${ wlopRefundId }` + ); + await this.retryLocatorVisibility( orderNote ); + await expect( orderNote ).toBeVisible(); + await expect( refundProcessedText ).toBeVisible(); + await this.assertOrderStatus( orderStatus ); + }; + + retryLocatorVisibility = async ( locator, retries = 20 ) => { + let i = 0; + while ( i < retries ) { + await this.page.reload(); + if ( await locator.isVisible() ) { + return true; + } + await this.page.waitForTimeout( 1000 ); + i++; + } + return false; + }; +} diff --git a/tests/qa/utils/frontend/checkout.ts b/tests/qa/utils/frontend/checkout.ts new file mode 100644 index 000000000..d1e3fdae7 --- /dev/null +++ b/tests/qa/utils/frontend/checkout.ts @@ -0,0 +1,121 @@ +/** + * External dependencies + */ +import { Checkout as CheckoutBase, expect } from '@inpsyde/playwright-utils/build'; + +export class Checkout extends CheckoutBase { + // Locators + cardNumberInput = () => + this.page + .frameLocator( '[title="cardNumber input"]' ) + .locator( '#cardNumber' ); + cardHolderInput = () => + this.page + .frameLocator( '[title="cardHolder input"]' ) + .locator( '#cardHolder' ); + cardExpiryDateInput = () => + this.page + .frameLocator( '[title="expiryDate input"]' ) + .locator( '#expiryDate' ); + cardVerificationCodeInput = () => + this.page + .frameLocator( '[title="verificationCode input"]' ) + .locator( '#verificationCode' ); + giftCardSelect = () => + this.page.locator( + 'select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_giftcard"]' + ); + kbcIssuerSelect = () => + this.page.locator( + 'select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_kbc"]' + ); + billieBillingCompanyInput = () => + this.paymentOptionsContainer().locator( '#billing-company' ); + in3PhoneInput = () => + this.paymentOptionsContainer().locator( '#billing-phone' ); + in3BirthDateInput = () => + this.paymentOptionsContainer().locator( '#billing-birthdate' ); + + // Actions + + /** + * Makes order on Checkout: + * - fills checkout form + * - selects shipping method + * - selects gateway + * - clicks Place Order button + * + * @param data + */ + makeOrder = async ( data: WooCommerce.ShopOrder ) => { + await this.visit(); + await this.applyCoupons( data.coupons ); + await this.fillCheckoutForm( data.customer ); + await this.selectShippingMethod( data.shipping.settings.title ); + await this.paymentOption( data.payment.gateway.name ).click(); + + if ( + data.payment.gateway.slug === 'kbc' && + data.payment.gateway.settings.issuers_dropdown_shown === 'yes' + ) { + await this.kbcIssuerSelect().selectOption( + data.payment.bankIssuer + ); + } + + if ( data.payment.gateway.slug === 'in3' ) { + const phoneInput = this.in3PhoneInput(); + if ( await phoneInput.isVisible() ) { + await phoneInput.fill( data.customer.billing.phone ); + } + const birthDateInput = this.in3BirthDateInput(); + if ( await birthDateInput.isVisible() ) { + await birthDateInput.click(); + for ( const char of data.customer.birth_date ) { + await this.page.keyboard.type( char ); + await this.page.waitForTimeout( 100 ); + } + } + } + + if ( + data.payment.gateway.slug === 'billie' && + ( await this.billieBillingCompanyInput().isVisible() ) + ) { + await this.billieBillingCompanyInput().fill( + data.payment.billingCompany + ); + } + + if ( + data.payment.gateway.slug === 'giftcard' && + data.payment.gateway.settings.issuers_dropdown_shown === 'yes' && + ( await this.giftCardSelect().isVisible() ) + ) { + await this.giftCardSelect().selectOption( 'fashioncheque' ); + } + + if ( + data.payment.gateway.slug === 'creditcard' && + data.payment.gateway.settings.mollie_components_enabled === 'yes' + ) { + // card input fields are loaded in iframes with delay + // unfortunately without timeout and clicking below the fields + // expiry date and cvv are not being filled + await this.page.waitForTimeout( 1000 ); + await this.page.getByText( 'Secure payments provided by' ).click(); + await this.cardNumberInput().fill( data.payment.card.card_number ); + await this.cardHolderInput().fill( data.payment.card.card_holder ); + await this.cardExpiryDateInput().fill( + data.payment.card.expiration_date + ); + await this.cardVerificationCodeInput().fill( + data.payment.card.card_cvv + ); + } + + await this.placeOrder(); + }; + + // Assertions +} diff --git a/tests/qa/utils/frontend/classic-checkout.ts b/tests/qa/utils/frontend/classic-checkout.ts new file mode 100644 index 000000000..8e1078dbd --- /dev/null +++ b/tests/qa/utils/frontend/classic-checkout.ts @@ -0,0 +1,124 @@ +/** + * External dependencies + */ +import { ClassicCheckout as ClassicCheckoutBase } from '@inpsyde/playwright-utils/build'; + +export class ClassicCheckout extends ClassicCheckoutBase { + // Locators + cardNumberInput = () => + this.page + .frameLocator( '[title="cardNumber input"]' ) + .locator( '#cardNumber' ); + cardHolderInput = () => + this.page + .frameLocator( '[title="cardHolder input"]' ) + .locator( '#cardHolder' ); + cardExpiryDateInput = () => + this.page + .frameLocator( '[title="expiryDate input"]' ) + .locator( '#expiryDate' ); + cardVerificationCodeInput = () => + this.page + .frameLocator( '[title="verificationCode input"]' ) + .locator( '#verificationCode' ); + giftCardSelect = () => + this.page.locator( + 'select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_giftcard"]' + ); + kbcIssuerSelect = () => + this.page.locator( + 'select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_kbc"]' + ); + billieBillingCompanyInput = () => + this.paymentOptionsContainer().locator( '#billing_company' ); + in3PhoneInput = () => + this.paymentOptionsContainer().locator( '#billing_phone_in3' ); + in3BirthDateInput = () => + this.paymentOptionsContainer().locator( '#billing_birthdate_in3' ); + paymentOptionFee = ( name: string ) => + this.paymentOptionsContainer() + .locator( 'li', { + has: this.page.locator( `label:text-is("${ name }")` ), + } ) + .locator( 'p.mollie-gateway-fee' ); + paymentOptionLogo = ( name: string ) => + this.paymentOptionsContainer() + .locator( 'li', { + has: this.page.locator( `label:text-is("${ name }")` ), + } ) + .locator( 'img.mollie-gateway-icon' ); + + // Actions + + /** + * Makes order on Classic Checkout: + * - fills checkout form + * - selects shipping method + * - selects gateway + * - clicks Place Order button + * + * @param data + */ + makeOrder = async ( data: WooCommerce.ShopOrder ) => { + await this.visit(); + await this.applyCoupons( data.coupons ); + await this.fillCheckoutForm( data.customer ); + await this.selectShippingMethod( data.shipping.settings.title ); + await this.paymentOption( data.payment.gateway.name ).click(); + if ( + data.payment.gateway.slug === 'kbc' && + data.payment.gateway.settings.issuers_dropdown_shown === 'yes' + ) { + await this.kbcIssuerSelect().selectOption( + data.payment.bankIssuer + ); + } + + if ( data.payment.gateway.slug === 'in3' ) { + const phoneInput = this.in3PhoneInput(); + if ( await phoneInput.isVisible() ) { + await phoneInput.fill( data.customer.billing.phone ); + } + const birthDateInput = this.in3BirthDateInput(); + if ( await birthDateInput.isVisible() ) { + await birthDateInput.click(); + for ( const char of data.customer.birth_date ) { + await this.page.keyboard.type( char ); + await this.page.waitForTimeout( 100 ); + } + } + } + + if ( + data.payment.gateway.slug === 'billie' && + ( await this.billieBillingCompanyInput().isVisible() ) + ) { + await this.billieBillingCompanyInput().fill( + data.payment.billingCompany + ); + } + if ( + data.payment.gateway.slug === 'giftcard' && + data.payment.gateway.settings.issuers_dropdown_shown === 'yes' && + ( await this.giftCardSelect().isVisible() ) + ) { + await this.giftCardSelect().selectOption( 'fashioncheque' ); + } + if ( + data.payment.gateway.slug === 'creditcard' && + data.payment.gateway.settings.mollie_components_enabled === 'yes' + ) { + await this.cardNumberInput().fill( data.payment.card.card_number ); + await this.cardHolderInput().fill( data.payment.card.card_holder ); + await this.cardExpiryDateInput().fill( + data.payment.card.expiration_date + ); + await this.cardVerificationCodeInput().fill( + data.payment.card.card_cvv + ); + } + await this.placeOrder(); + }; + + // Assertions +} diff --git a/tests/qa/utils/frontend/index.ts b/tests/qa/utils/frontend/index.ts new file mode 100644 index 000000000..57c106110 --- /dev/null +++ b/tests/qa/utils/frontend/index.ts @@ -0,0 +1,4 @@ +export * from './checkout'; +export * from './classic-checkout'; +export * from './pay-for-order'; +export * from './mollie-hosted-checkout'; diff --git a/tests/qa/utils/frontend/mollie-hosted-checkout.ts b/tests/qa/utils/frontend/mollie-hosted-checkout.ts new file mode 100644 index 000000000..96374b1b1 --- /dev/null +++ b/tests/qa/utils/frontend/mollie-hosted-checkout.ts @@ -0,0 +1,121 @@ +/** + * External dependencies + */ +import { WpPage, expect } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { urls } from '../urls'; +import { + BankIssuer, + MolliePayment, + MolliePaymentStatus, +} from '../../resources'; + +export class MollieHostedCheckout extends WpPage { + url = urls.mollie.hostedCheckout; + mollieUrlRegex = /mollie\.com\/checkout/; + testModeUrlRegex = /checkout\/test-mode/; + issuerSelectionUrlRegex = /select-issuer/; + creditCardUrlRegex = /credit-card\/embedded/; + expiredUrlRegex = /test-mode\/completed/; + + // Locators + totalAmountHeader = () => this.page.locator( 'div.header__amount ' ); + orderNumberHeader = () => this.page.locator( 'div.header__info ' ); + selectIssuerButton = ( bankIssuer: BankIssuer ) => + this.page.locator( 'ul.payment-method-list' ).getByText( bankIssuer ); + paymentStatusRadio = ( paymentStatus: MolliePaymentStatus ) => + this.page.locator( `input[type="radio"][value="${ paymentStatus }"]` ); + cardNumberInput = () => + this.page + .frameLocator( '[title="cardNumber input"]' ) + .locator( '#cardNumber' ); + cardHolderInput = () => + this.page + .frameLocator( '[title="cardHolder input"]' ) + .locator( '#cardHolder' ); + cardExpiryDateInput = () => + this.page + .frameLocator( '[title="expiryDate input"]' ) + .locator( '#expiryDate' ); + cardVerificationCodeInput = () => + this.page + .frameLocator( '[title="verificationCode input"]' ) + .locator( '#verificationCode' ); + payButton = () => this.page.locator( '#submit-button' ); + continueButton = () => this.page.locator( 'button[name="submit"]' ); + + // Actions + + capturePaymentAmount = async () => { + const amountText = await this.totalAmountHeader().textContent(); + const amount = parseFloat( + amountText.replace( /[^0-9,.]/g, '' ).replace( ',', '.' ) + ); + + return parseFloat( amount.toFixed( 2 ) ); + }; + + captureOrderNumber = async () => { + const orderText = await this.orderNumberHeader().textContent(); + const orderNumber = orderText.match( /\d+/ )?.[ 0 ]; + return parseInt( orderNumber ); + }; + + payWithBank = async ( issuer: BankIssuer ) => { + await this.page.waitForURL( this.issuerSelectionUrlRegex ); + await this.selectIssuerButton( issuer ).click(); + await this.page.waitForLoadState(); + }; + + payWithCard = async ( card: WooCommerce.CreditCard ) => { + await this.page.waitForURL( this.mollieUrlRegex ); + await this.cardNumberInput().fill( card.card_number ); + await this.cardHolderInput().fill( card.card_holder ); + await this.cardExpiryDateInput().fill( card.expiration_date ); + await this.cardVerificationCodeInput().fill( card.card_cvv ); + await this.payButton().click(); + await this.page.waitForLoadState(); + }; + + pay = async ( payment: MolliePayment ) => { + await this.page.waitForURL( this.mollieUrlRegex ); + await this.assertPaymentAmount( payment.amount ); + + if ( payment.gateway.slug === 'ideal' ) { + await this.payWithBank( payment.bankIssuer ); + } + + if ( + payment.gateway.slug === 'kbc' && + payment.gateway.settings.issuers_dropdown_shown === 'no' + ) { + await this.payWithBank( payment.bankIssuer ); + } + + if ( + payment.gateway.slug === 'creditcard' && + payment.gateway.settings.mollie_components_enabled === 'no' + ) { + await this.payWithCard( payment.card ); + } + + await this.page.waitForURL( this.testModeUrlRegex ); + const orderNumber = this.captureOrderNumber(); + await this.paymentStatusRadio( payment.status ).click(); + await this.continueButton().click(); + await this.page.waitForLoadState(); + if ( payment.status ) return orderNumber; + }; + + // Assertions + assertUrl = async () => { + await expect( this.page.url() ).toContain( this.url ); + }; + + assertPaymentAmount = async ( expectedTotalAmount: number ) => { + const totalAmount = await this.capturePaymentAmount(); + await expect( totalAmount ).toEqual( expectedTotalAmount ); + }; +} diff --git a/tests/qa/utils/frontend/pay-for-order.ts b/tests/qa/utils/frontend/pay-for-order.ts new file mode 100644 index 000000000..d1c5f8acd --- /dev/null +++ b/tests/qa/utils/frontend/pay-for-order.ts @@ -0,0 +1,113 @@ +/** + * External dependencies + */ +import { PayForOrder as PayForOrderBase } from '@inpsyde/playwright-utils/build'; + +export class PayForOrder extends PayForOrderBase { + // Locators + cardNumberInput = () => + this.page + .frameLocator( '[title="cardNumber input"]' ) + .locator( '#cardNumber' ); + cardHolderInput = () => + this.page + .frameLocator( '[title="cardHolder input"]' ) + .locator( '#cardHolder' ); + cardExpiryDateInput = () => + this.page + .frameLocator( '[title="expiryDate input"]' ) + .locator( '#expiryDate' ); + cardVerificationCodeInput = () => + this.page + .frameLocator( '[title="verificationCode input"]' ) + .locator( '#verificationCode' ); + giftCardSelect = () => + this.page.locator( + 'select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_giftcard"]' + ); + kbcIssuerSelect = () => + this.page.locator( + 'select[name="mollie-payments-for-woocommerce_issuer_mollie_wc_gateway_kbc"]' + ); + billieBillingCompanyInput = () => this.page.locator( '#billing_company' ); + in3PhoneInput = () => this.page.locator( '#billing_phone_in3' ); + in3BirthDateInput = () => this.page.locator( '#billing_birthdate_in3' ); + + // Actions + + /** + * Makes order on Pay for order page: + * - selects gateway + * - clicks Place Order button + * + * @param orderId + * @param orderKey + * @param data + */ + makeOrder = async ( + orderId: number, + orderKey: string, + data: WooCommerce.ShopOrder + ) => { + await this.visit( orderId, orderKey ); + await this.paymentOption( data.payment.gateway.name ).click(); + + if ( + data.payment.gateway.slug === 'kbc' && + data.payment.gateway.settings.issuers_dropdown_shown === 'yes' + ) { + await this.kbcIssuerSelect().selectOption( + data.payment.bankIssuer + ); + } + + if ( data.payment.gateway.slug === 'in3' ) { + const phoneInput = this.in3PhoneInput(); + if ( await phoneInput.isVisible() ) { + await phoneInput.fill( data.customer.billing.phone ); + } + const birthDateInput = this.in3BirthDateInput(); + if ( await birthDateInput.isVisible() ) { + await birthDateInput.click(); + for ( const char of data.customer.birth_date ) { + await this.page.keyboard.type( char ); + await this.page.waitForTimeout( 100 ); + } + } + } + + if ( + data.payment.gateway.slug === 'billie' && + ( await this.billieBillingCompanyInput().isVisible() ) + ) { + await this.billieBillingCompanyInput().fill( + data.payment.billingCompany + ); + } + + if ( + data.payment.gateway.slug === 'giftcard' && + data.payment.gateway.settings.issuers_dropdown_shown === 'yes' + ) { + await this.giftCardSelect().selectOption( 'fashioncheque' ); + } + + if ( + data.payment.gateway.slug === 'creditcard' && + data.payment.gateway.settings.mollie_components_enabled === 'yes' + ) { + await this.cardNumberInput().fill( data.payment.card.card_number ); + await this.cardHolderInput().fill( data.payment.card.card_holder ); + await this.cardExpiryDateInput().fill( + data.payment.card.expiration_date + ); + await this.cardVerificationCodeInput().fill( + data.payment.card.card_cvv + ); + } + + await this.payForOrderButton().click(); + }; + + // Assertions +} diff --git a/tests/qa/utils/helpers.ts b/tests/qa/utils/helpers.ts new file mode 100644 index 000000000..93960974c --- /dev/null +++ b/tests/qa/utils/helpers.ts @@ -0,0 +1,255 @@ +/** + * Sets annotation about tested customer + * If tested customer is registered (has non-empty username), + * then his billing.country will be added to annotation for example: customer-germany + * Only one customer per country is used. + * customer-germany - is a name of storage state file to use in the test. + * + * @default {} - empty annotation for guest + * @param customer + * @return object with test annotation + */ +export function annotateVisitor( customer: WooCommerce.CreateCustomer ) { + const storageStateName = getCustomerStorageStateName( customer ); + return { + annotation: { + type: 'visitor', + description: storageStateName, + }, + }; +} + +export function annotateGateway( gatewaySlug: string ) { + return { + annotation: { + type: 'mollieGateway', + description: gatewaySlug, + }, + }; +} + +/** + * Builds storage state file name for customer + * + * @param customer + * @return 'goest' or 'customer-' + */ +export function getCustomerStorageStateName( + customer: WooCommerce.CreateCustomer +) { + // check is tested customer is guest (has empty username) + if ( ! customer.username ) { + return 'guest'; + } + // for registered customers + const visitorCountry = codeToCountry( customer.billing.country ); + return `customer-${ visitorCountry }`; +} + +/** + * Converts customer.billing.country (code) to country name + * + * @param countryCode + * @return country name in lower case + */ +export function codeToCountry( countryCode: string ) { + const countries = { + AF: 'afghanistan', + AL: 'albania', + DZ: 'algeria', + AD: 'andorra', + AO: 'angola', + AG: 'antigua-and-barbuda', + AR: 'argentina', + AM: 'armenia', + AU: 'australia', + AT: 'austria', + AZ: 'azerbaijan', + BS: 'bahamas', + BH: 'bahrain', + BD: 'bangladesh', + BB: 'barbados', + BY: 'belarus', + BE: 'belgium', + BZ: 'belize', + BJ: 'benin', + BT: 'bhutan', + BO: 'bolivia', + BA: 'bosnia-and-herzegovina', + BW: 'botswana', + BR: 'brazil', + BN: 'brunei', + BG: 'bulgaria', + BF: 'burkina-faso', + BI: 'burundi', + CV: 'cape-verde', + KH: 'cambodia', + CM: 'cameroon', + CA: 'canada', + CF: 'central-african-republic', + TD: 'chad', + CL: 'chile', + CN: 'china', + CO: 'colombia', + KM: 'comoros', + CG: 'congo', + CD: 'democratic-republic-of-the-congo', + CR: 'costa-rica', + CI: 'cote-d-ivoire', + HR: 'croatia', + CU: 'cuba', + CY: 'cyprus', + CZ: 'czech-republic', + DK: 'denmark', + DJ: 'djibouti', + DM: 'dominica', + DO: 'dominican-republic', + EC: 'ecuador', + EG: 'egypt', + SV: 'el-salvador', + GQ: 'equatorial-guinea', + ER: 'eritrea', + EE: 'estonia', + SZ: 'eswatini', + ET: 'ethiopia', + FJ: 'fiji', + FI: 'finland', + FR: 'france', + GA: 'gabon', + GM: 'gambia', + GE: 'georgia', + DE: 'germany', + GH: 'ghana', + GR: 'greece', + GD: 'grenada', + GT: 'guatemala', + GN: 'guinea', + GW: 'guinea-bissau', + GY: 'guyana', + HT: 'haiti', + HN: 'honduras', + HU: 'hungary', + IS: 'iceland', + IN: 'india', + ID: 'indonesia', + IR: 'iran', + IQ: 'iraq', + IE: 'ireland', + IL: 'israel', + IT: 'italy', + JM: 'jamaica', + JP: 'japan', + JO: 'jordan', + KZ: 'kazakhstan', + KE: 'kenya', + KI: 'kiribati', + KP: 'north-korea', + KR: 'south-korea', + KW: 'kuwait', + KG: 'kyrgyzstan', + LA: 'laos', + LV: 'latvia', + LB: 'lebanon', + LS: 'lesotho', + LR: 'liberia', + LY: 'libya', + LI: 'liechtenstein', + LT: 'lithuania', + LU: 'luxembourg', + MG: 'madagascar', + MW: 'malawi', + MY: 'malaysia', + MV: 'maldives', + ML: 'mali', + MT: 'malta', + MH: 'marshall-islands', + MR: 'mauritania', + MU: 'mauritius', + MX: 'mexico', + FM: 'micronesia', + MD: 'moldova', + MC: 'monaco', + MN: 'mongolia', + ME: 'montenegro', + MA: 'morocco', + MZ: 'mozambique', + MM: 'myanmar', + NA: 'namibia', + NR: 'nauru', + NP: 'nepal', + NL: 'netherlands', + NZ: 'new-zealand', + NI: 'nicaragua', + NE: 'niger', + NG: 'nigeria', + MK: 'north-macedonia', + NO: 'norway', + OM: 'oman', + PK: 'pakistan', + PW: 'palau', + PS: 'palestine', + PA: 'panama', + PG: 'papua-new-guinea', + PY: 'paraguay', + PE: 'peru', + PH: 'philippines', + PL: 'poland', + PT: 'portugal', + QA: 'qatar', + RO: 'romania', + RU: 'russia', + RW: 'rwanda', + KN: 'saint-kitts-and-nevis', + LC: 'saint-lucia', + VC: 'saint-vincent-and-the-grenadines', + WS: 'samoa', + SM: 'san-marino', + ST: 'sao-tome-and-principe', + SA: 'saudi-arabia', + SN: 'senegal', + RS: 'serbia', + SC: 'seychelles', + SL: 'sierra-leone', + SG: 'singapore', + SK: 'slovakia', + SI: 'slovenia', + SB: 'solomon-islands', + SO: 'somalia', + ZA: 'south-africa', + SS: 'south-sudan', + ES: 'spain', + LK: 'sri-lanka', + SD: 'sudan', + SR: 'suriname', + SE: 'sweden', + CH: 'switzerland', + SY: 'syria', + TW: 'taiwan', + TJ: 'tajikistan', + TZ: 'tanzania', + TH: 'thailand', + TL: 'timor-leste', + TG: 'togo', + TO: 'tonga', + TT: 'trinidad-and-tobago', + TN: 'tunisia', + TR: 'turkey', + TM: 'turkmenistan', + TV: 'tuvalu', + UG: 'uganda', + UA: 'ukraine', + AE: 'united-arab-emirates', + GB: 'united-kingdom', + US: 'usa', + UY: 'uruguay', + UZ: 'uzbekistan', + VU: 'vanuatu', + VA: 'vatican-city', + VE: 'venezuela', + VN: 'vietnam', + YE: 'yemen', + ZM: 'zambia', + ZW: 'zimbabwe', + }; + return countries[ countryCode ]; +} diff --git a/tests/qa/utils/index.ts b/tests/qa/utils/index.ts new file mode 100644 index 000000000..819c33cac --- /dev/null +++ b/tests/qa/utils/index.ts @@ -0,0 +1,8 @@ +export * from './test'; +export * from './helpers'; +export * from './mollie-api'; +export * from './urls'; +export * from './utils'; +export * from './admin'; +export * from './frontend'; +export * from './transaction'; diff --git a/tests/qa/utils/mollie-api.ts b/tests/qa/utils/mollie-api.ts new file mode 100644 index 000000000..cf5f8418b --- /dev/null +++ b/tests/qa/utils/mollie-api.ts @@ -0,0 +1,22 @@ +/** + * External dependencies + */ +import { WooCommerceApi } from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { MollieSettings } from '../resources'; + +export class MollieApi extends WooCommerceApi { + updateMollieGateway = async ( + gatewaySlug: string, + data: MollieSettings.Gateway + ) => { + const response = await this.wcRequest( + 'put', + `payment_gateways/mollie_wc_gateway_${ gatewaySlug }`, + { settings: data } + ); + return response; + }; +} diff --git a/tests/qa/utils/test.ts b/tests/qa/utils/test.ts new file mode 100644 index 000000000..0a19ecd97 --- /dev/null +++ b/tests/qa/utils/test.ts @@ -0,0 +1,177 @@ +/** + * External dependencies + */ +import fs from 'fs'; +import { APIRequestContext, Page } from '@playwright/test'; +import { + test as base, + CustomerAccount, + CustomerPaymentMethods, + expect, + OrderReceived, + WooCommerceApi, +} from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { + MollieSettingsApiKeys, + MollieSettingsPaymentMethods, + MollieSettingsAdvanced, + WooCommerceOrderEdit, + MollieSettingsGateway, +} from './admin'; +import { + Checkout, + ClassicCheckout, + PayForOrder, + MollieHostedCheckout, +} from './frontend'; +import { MollieApi, Transaction, Utils } from '.'; + +const test = base.extend< { + // Dashboard fixtures + mollieApi: MollieApi; + mollieSettingsApiKeys: MollieSettingsApiKeys; + mollieSettingsPaymentMethods: MollieSettingsPaymentMethods; + mollieSettingsAdvanced: MollieSettingsAdvanced; + mollieSettingsGateway: MollieSettingsGateway; + + // Frontend fixtures + visitorPage: Page; + visitorRequest: APIRequestContext; + visitorWooCommerceApi: WooCommerceApi; + wooCommerceOrderEdit: WooCommerceOrderEdit; + checkout: Checkout; + classicCheckout: ClassicCheckout; + payForOrder: PayForOrder; + orderReceived: OrderReceived; + mollieHostedCheckout: MollieHostedCheckout; + + // Complex fixtures + utils: Utils; + transaction: Transaction; +} >( { + // Dashboard pages operated by Admin + mollieApi: async ( { request }, use ) => { + await use( new MollieApi( { request } ) ); + }, + mollieSettingsApiKeys: async ( { page }, use ) => { + await use( new MollieSettingsApiKeys( { page } ) ); + }, + mollieSettingsPaymentMethods: async ( { page }, use ) => { + await use( new MollieSettingsPaymentMethods( { page } ) ); + }, + mollieSettingsAdvanced: async ( { page }, use ) => { + await use( new MollieSettingsAdvanced( { page } ) ); + }, + mollieSettingsGateway: async ( { page }, use, testInfo ) => { + const gatewaySlug = testInfo.annotations?.find( + ( el ) => el.type === 'mollieGateway' + )?.description; + await use( new MollieSettingsGateway( { page, gatewaySlug } ) ); + }, + wooCommerceOrderEdit: async ( { page }, use ) => { + await use( new WooCommerceOrderEdit( { page } ) ); + }, + + visitorPage: async ( { browser }, use, testInfo ) => { + // check if visitor is specified in test otherwise use guest + const storageStateName = + testInfo.annotations?.find( ( el ) => el.type === 'visitor' ) + ?.description || 'guest'; + const storageStatePath = `${ process.env.STORAGE_STATE_PATH }/${ storageStateName }.json`; + // apply current visitor's storage state to the context + const context = await browser.newContext( { + storageState: fs.existsSync( storageStatePath ) + ? storageStatePath + : undefined, + } ); + const page = await context.newPage(); + await use( page ); + await page.close(); + await context.close(); + }, + visitorRequest: async ( { visitorPage }, use ) => { + const request = visitorPage.request; + await use( request ); + }, + visitorWooCommerceApi: async ( { visitorRequest }, use ) => { + await use( new WooCommerceApi( { request: visitorRequest } ) ); + }, + + // Front pages operated by visitor + checkout: async ( { visitorPage }, use ) => { + await use( new Checkout( { page: visitorPage } ) ); + }, + classicCheckout: async ( { visitorPage }, use ) => { + await use( new ClassicCheckout( { page: visitorPage } ) ); + }, + payForOrder: async ( { visitorPage }, use ) => { + await use( new PayForOrder( { page: visitorPage } ) ); + }, + orderReceived: async ( { visitorPage }, use ) => { + await use( new OrderReceived( { page: visitorPage } ) ); + }, + customerAccount: async ( { visitorPage }, use ) => { + await use( new CustomerAccount( { page: visitorPage } ) ); + }, + customerPaymentMethods: async ( { visitorPage }, use ) => { + await use( new CustomerPaymentMethods( { page: visitorPage } ) ); + }, + mollieHostedCheckout: async ( { visitorPage }, use ) => { + await use( new MollieHostedCheckout( { page: visitorPage } ) ); + }, + + // Complex fixtures + utils: async ( + { + plugins, + wooCommerceUtils, + requestUtils, + wooCommerceApi, + visitorWooCommerceApi, + mollieSettingsApiKeys, + mollieSettingsAdvanced, + }, + use + ) => { + await use( + new Utils( { + plugins, + wooCommerceUtils, + requestUtils, + wooCommerceApi, + visitorWooCommerceApi, + mollieSettingsApiKeys, + mollieSettingsAdvanced, + } ) + ); + }, + transaction: async ( + { + wooCommerceUtils, + orderReceived, + checkout, + classicCheckout, + payForOrder, + mollieHostedCheckout, + utils, + }, + use + ) => { + await use( + new Transaction( { + wooCommerceUtils, + orderReceived, + checkout, + classicCheckout, + payForOrder, + mollieHostedCheckout, + utils, + } ) + ); + }, +} ); + +export { test, expect }; diff --git a/tests/qa/utils/transaction.ts b/tests/qa/utils/transaction.ts new file mode 100644 index 000000000..f136ae2b3 --- /dev/null +++ b/tests/qa/utils/transaction.ts @@ -0,0 +1,96 @@ +/** + * External dependencies + */ +import { + OrderReceived, + WooCommerceUtils, + expect, +} from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { + ClassicCheckout, + PayForOrder, + Checkout, + MollieHostedCheckout, +} from './frontend'; +import { Utils } from './utils'; + +export class Transaction { + wooCommerceUtils: WooCommerceUtils; + orderReceived: OrderReceived; + checkout: Checkout; + classicCheckout: ClassicCheckout; + payForOrder: PayForOrder; + mollieHostedCheckout: MollieHostedCheckout; + utils: Utils; + + constructor( { + wooCommerceUtils, + orderReceived, + checkout, + classicCheckout, + payForOrder, + mollieHostedCheckout, + utils, + } ) { + this.wooCommerceUtils = wooCommerceUtils; + this.orderReceived = orderReceived; + this.checkout = checkout; + this.classicCheckout = classicCheckout; + this.payForOrder = payForOrder; + this.mollieHostedCheckout = mollieHostedCheckout; + this.utils = utils; + } + + onCheckout = async ( data: WooCommerce.ShopOrder ) => { + await this.utils.fillVisitorsCart( data.products ); + await this.checkout.makeOrder( data ); + return this.processMolliePaymentByStatus( data ); + }; + + onClassicCheckout = async ( data: WooCommerce.ShopOrder ) => { + await this.utils.fillVisitorsCart( data.products ); + await this.classicCheckout.makeOrder( data ); + return this.processMolliePaymentByStatus( data ); + }; + + onPayForOrder = async ( data: WooCommerce.ShopOrder ) => { + const order = await this.wooCommerceUtils.createApiOrder( data ); + await this.payForOrder.makeOrder( order.id, order.order_key, data ); + return this.processMolliePaymentByStatus( data ); + }; + + processMolliePaymentByStatus = async ( data: WooCommerce.ShopOrder ) => { + let orderNumber; + const mollieOrderNumber = await this.mollieHostedCheckout.pay( + data.payment + ); + + switch ( data.payment.status ) { + case 'paid': + case 'pending': + case 'authorized': + await this.orderReceived.assertOrderDetails( data ); + orderNumber = await this.orderReceived.getOrderNumber(); + await expect( mollieOrderNumber ).toEqual( orderNumber ); + break; + + case 'failed': + case 'canceled': + await expect( this.payForOrder.heading() ).toBeVisible(); + orderNumber = await this.payForOrder.getOrderNumberFromUrl(); + await expect( mollieOrderNumber ).toEqual( orderNumber ); + break; + + case 'expired': + await expect( this.mollieHostedCheckout.page ).toHaveURL( + this.mollieHostedCheckout.expiredUrlRegex + ); + break; + } + + return mollieOrderNumber; + }; +} diff --git a/tests/qa/utils/urls.ts b/tests/qa/utils/urls.ts new file mode 100644 index 000000000..9fd322561 --- /dev/null +++ b/tests/qa/utils/urls.ts @@ -0,0 +1,32 @@ +/** + * External dependencies + */ +import { + urls as urlsBase, + wooCommerceUrls, +} from '@inpsyde/playwright-utils/build'; + +export const urls = { + ...urlsBase.frontend, + ...wooCommerceUrls.frontend, + admin: urlsBase.admin, + wooCommerce: { + admin: wooCommerceUrls.admin, + }, + mollie: { + admin: { + settings: { + home: './wp-admin/admin.php?page=wc-settings&tab=mollie_settings', + apiKeys: + './wp-admin/admin.php?page=wc-settings&tab=mollie_settings§ion=mollie_api_keys', + paymentMethods: + './wp-admin/admin.php?page=wc-settings&tab=mollie_settings§ion=mollie_payment_methods', + advanced: + './wp-admin/admin.php?page=wc-settings&tab=mollie_settings§ion=mollie_advanced', + gateway: + './wp-admin/admin.php?page=wc-settings&tab=checkout§ion=mollie_wc_gateway_', + }, + }, + hostedCheckout: 'https://www.mollie.com/checkout', + }, +}; diff --git a/tests/qa/utils/utils.ts b/tests/qa/utils/utils.ts new file mode 100644 index 000000000..df826f7f3 --- /dev/null +++ b/tests/qa/utils/utils.ts @@ -0,0 +1,146 @@ +/** + * External dependencies + */ +import { + WooCommerceApi, + RequestUtils, + Plugins, + WooCommerceUtils, + restLogin, +} from '@inpsyde/playwright-utils/build'; +/** + * Internal dependencies + */ +import { + MollieSettingsApiKeys, + MollieSettingsAdvanced, + getCustomerStorageStateName, +} from '.'; +import { + MollieSettings, + molliePlugin, + mollieConfigGeneral, +} from '../resources'; + +export class Utils { + plugins: Plugins; + wooCommerceUtils: WooCommerceUtils; + requestUtils: RequestUtils; + wooCommerceApi: WooCommerceApi; + visitorWooCommerceApi: WooCommerceApi; + mollieSettingsApiKeys: MollieSettingsApiKeys; + mollieSettingsAdvanced: MollieSettingsAdvanced; + + constructor( { + plugins, + wooCommerceUtils, + requestUtils, + wooCommerceApi, + visitorWooCommerceApi, + mollieSettingsApiKeys, + mollieSettingsAdvanced, + } ) { + this.plugins = plugins; + this.wooCommerceUtils = wooCommerceUtils; + this.requestUtils = requestUtils; + this.wooCommerceApi = wooCommerceApi; + this.visitorWooCommerceApi = visitorWooCommerceApi; + this.mollieSettingsApiKeys = mollieSettingsApiKeys; + this.mollieSettingsAdvanced = mollieSettingsAdvanced; + } + + // Tested plugin preconditions + + installActivateMollie = async () => { + if ( + ! ( await this.requestUtils.isPluginInstalled( molliePlugin.slug ) ) + ) { + await this.plugins.installPluginFromFile( + molliePlugin.zipFilePath + ); + } + await this.requestUtils.activatePlugin( molliePlugin.slug ); + }; + + cleanMollieDb = async () => { + await this.mollieSettingsAdvanced.visit(); + await this.mollieSettingsAdvanced.cleanDb(); + }; + + connectMollieApi = async ( + data: MollieSettings.ApiKeys = mollieConfigGeneral.default + ) => { + await this.mollieSettingsApiKeys.visit(); + await this.mollieSettingsApiKeys.setup( data ); + await this.mollieSettingsApiKeys.saveChanges(); + }; + + cleanReconnectMollie = async () => { + await this.connectMollieApi(); + await this.cleanMollieDb(); + await this.connectMollieApi(); + }; + + /** + * Pays for order on checkout page + * + * @param products + */ + fillVisitorsCart = async ( products: WooCommerce.CreateProduct[] ) => { + const cartProducts = await this.wooCommerceUtils.createCartProducts( + products + ); + await this.visitorWooCommerceApi.clearCart(); + await this.visitorWooCommerceApi.addProductsToCart( cartProducts ); + }; + + restoreCustomer = async ( customer: WooCommerce.CreateCustomer ) => { + await this.wooCommerceUtils.deleteCustomer( customer ); + await this.wooCommerceUtils.createCustomer( customer ); + const storageStateName = getCustomerStorageStateName( customer ); + const storageStatePath = `${ process.env.STORAGE_STATE_PATH }/${ storageStateName }.json`; + await restLogin( { + baseURL: process.env.WP_BASE_URL, + httpCredentials: { + username: process.env.WP_BASIC_AUTH_USER, + password: process.env.WP_BASIC_AUTH_PASS, + }, + storageStatePath, + user: { + username: customer.username, + password: customer.password, + }, + } ); + }; + + /** + * Configures store according to the data provided + * + * @param {Object} data see /resources/woocommerce-config.ts + */ + configureStore = async ( data ) => { + if ( data.classicPages === true ) { + await this.wooCommerceUtils.activateClassicCartPage(); + await this.wooCommerceUtils.activateClassicCheckoutPage(); + } + + if ( data.classicPages === false ) { + await this.wooCommerceUtils.activateBlockCartPage(); + await this.wooCommerceUtils.activateBlockCheckoutPage(); + } + + if ( data.settings?.general ) { + await this.wooCommerceApi.updateGeneralSettings( + data.settings.general + ); + } + + if ( data.taxes ) { + await this.wooCommerceUtils.setTaxes( data.taxes ); + } + + if ( data.customer ) { + await this.restoreCustomer( data.customer ); + } + }; +}