diff --git a/.gitignore b/.gitignore index 6082f0b83..19b25e5cd 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,6 @@ playwright-report/ /test-results/ /playwright-report/ /playwright/.cache/ +/test-results/ +/playwright-report/ +/playwright/.cache/ diff --git a/mollie-payments-for-woocommerce.php b/mollie-payments-for-woocommerce.php index e6ba5f926..f8f6b1e48 100644 --- a/mollie-payments-for-woocommerce.php +++ b/mollie-payments-for-woocommerce.php @@ -3,7 +3,7 @@ * Plugin Name: Mollie Payments for WooCommerce * Plugin URI: https://www.mollie.com * Description: Accept payments in WooCommerce with the official Mollie plugin - * Version: 7.3.7 + * Version: 7.3.8-beta * Author: Mollie * Author URI: https://www.mollie.com * Requires at least: 5.0 @@ -12,7 +12,7 @@ * Domain Path: /languages * License: GPLv2 or later * WC requires at least: 3.0 - * WC tested up to: 7.5 + * WC tested up to: 7.7 * Requires PHP: 7.2 */ declare(strict_types=1); diff --git a/package.json b/package.json index d372c2aea..2c840915f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@babel/polyfill": "^7.7.0", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.14.5", - "@playwright/test": "^1.30.0", + "@playwright/test": "^1.33.0", "@symfony/webpack-encore": "^0.28.2", "@woocommerce/dependency-extraction-webpack-plugin": "^1.7.0", "@wordpress/data": "^6.1.5", diff --git a/playwright.config.js b/playwright.config.js index e4e9f397e..09cf9b092 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -1,138 +1,77 @@ +// @ts-check const {defineConfig, devices} = require('@playwright/test'); -const {simple, virtual} = require('./tests/e2e/Shared/products'); -const {ideal, banktransfer, paypal, creditcard} = require('./tests/e2e/Shared/gateways'); + /** * Read environment variables from file. * https://github.com/motdotla/dotenv */ require('dotenv').config(); - +const testRailOptions = { + // Whether to add with all annotations; default is false + embedAnnotationsAsProperties: true, + // Where to put the report. + outputFile: './test-results/junit-report.xml' +}; /** * @see https://playwright.dev/docs/test-configuration */ module.exports = defineConfig({ testDir: './tests/e2e', - /* Maximum time one test can run for. */ - timeout: 120000, - globalTimeout: 0, - expect: { - /** - * Maximum time expect() should wait for the condition to be met. - * For example in `await expect(locator).toHaveText();` - */ - timeout: 60000 - }, /* 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 : undefined, + fullyParallel: false, + timeout: 320000, /* Reporter to use. See https://playwright.dev/docs/test-reporters */ - reporter: 'html', - globalSetup: require.resolve('./tests/e2e/Shared/global-setup'), + reporter: [ + ['list'], + ['junit', testRailOptions] + ], + globalSetup: './tests/e2e/globalSetup.js', /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ use: { - /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ - actionTimeout: 0, - /* Base URL to use in actions like `await page.goto('/')`. */ baseURL: process.env.BASEURL, storageState: './storageState.json', - - /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ - trace: 'on-first-retry', - extraHTTPHeaders: {'ngrok-skip-browser-warning': '123'} + extraHTTPHeaders: {'ngrok-skip-browser-warning': '123'}, + actionTimeout: 120000, }, /* Configure projects for major browsers */ projects: [ { - name: 'activation', - testMatch: ['**/Activation/Activation.spec.js'], + name: 'plugins-page', + testDir: './tests/e2e/Plugins page', use: { ...devices['Desktop Chrome'], testIdAttribute: 'data-slug' - }, + } }, { - name: 'simple-settings', - testMatch: '**/Settings/GeneralSettings.spec.js', + name: 'woo-payments-tab', + testDir: './tests/e2e/WooCommerce Payments tab', use: { - ...devices['Desktop Chrome'], - gateways: {banktransfer}, - products: {simple}, - }, + ...devices['Desktop Chrome'] + } }, { - name: 'full-settings', - testMatch: '**/Settings/PaymentSettings.classic.spec.js', + name: 'transaction-scenarios', + testDir: './tests/e2e/Transaction Scenarios', use: { ...devices['Desktop Chrome'] - }, + } }, { - name: 'simple-classic', - testMatch: ['**/Transaction/Checkout.classic.spec.js'], + name: 'mollie-settings-tab', + testDir: './tests/e2e/Mollie Settings tab', use: { - ...devices['Desktop Chrome'], - gateways: {ideal}, - products: {simple}, - }, + ...devices['Desktop Chrome'] + } }, { - name: 'product-paypal', - testMatch: '**/Product/**', + name: 'error-handling', + testDir: './tests/e2e/Error Handling', use: { - ...devices['Desktop Chrome'], - gateways: paypal, - products: {simple, virtual}, - }, + ...devices['Desktop Chrome'] + } }, - /*{ - name: 'chromium', - use: {...devices['Desktop Chrome']}, - },*/ - - /* { - name: 'firefox', - use: {...devices['Desktop Firefox']}, - }, - - { - name: 'webkit', - use: {...devices['Desktop Safari']}, - },*/ - - /* Test against mobile viewports. */ - // { - // name: 'Mobile Chrome', - // use: { ...devices['Pixel 5'] }, - // }, - // { - // name: 'Mobile Safari', - // use: { ...devices['iPhone 12'] }, - // }, - - /* Test against branded browsers. */ - // { - // name: 'Microsoft Edge', - // use: { channel: 'msedge' }, - // }, - // { - // name: 'Google Chrome', - // use: { channel: 'chrome' }, - // }, ], - - /* Folder for test artifacts such as screenshots, videos, traces, etc. */ - outputDir: './tests/e2e/Reports/', - - /* Run your local dev server before starting the tests */ - // webServer: { - // command: 'npm run start', - // port: 3000, - // }, }); diff --git a/resources/js/mollieBillie.js b/resources/js/mollieBillie.js index 87b24caee..59d4c78be 100644 --- a/resources/js/mollieBillie.js +++ b/resources/js/mollieBillie.js @@ -1,98 +1,26 @@ +import {maybeRequireField, saveOriginalField} from "./wooCheckoutFieldsUtility"; + ( function ({jQuery}) { let gateway = 'mollie_wc_gateway_billie'; - let originalBillingCompanyField = {}; - saveOriginalBillingCompanyField(); - - function usingGateway(gateway) - { - return jQuery('form[name="checkout"] input[name="payment_method"]:checked').val() === gateway; - } - function showBillingCompanyField() - { - let billingField = jQuery('form[name="checkout"] p#billing_company_field'); - if ((billingField).length <= 0) { - jQuery('form[name="checkout"] input[name="billing_last_name"]') - .closest('p') - .after( - '

' - + '' - + '' - + '' - + '' - + '

' - ); - } - } - function requireBillingCompanyField() - { - jQuery('form[name="checkout"] input[name="billing_company"]').attr('required', ''); - jQuery('form[name="checkout"] p#billing_company_field').addClass('validate-required'); - jQuery('form[name="checkout"] p#billing_company_field label span').replaceWith('*'); - } - - function saveOriginalBillingCompanyField() - { - let billingCompanyField = jQuery('form[name="checkout"] input[name="billing_company"]'); - let isVisible = billingCompanyField.is(':visible'); - let isRequired = billingCompanyField.prop('required'); - originalBillingCompanyField = { isVisible, isRequired }; - } - - function removeBillingCompanyField() - { - jQuery('form[name="checkout"] p#billing_company_field').remove(); - } - - function unrequireBillingCompanyField() - { - jQuery('form[name="checkout"] input[name="billing_company"]').removeAttr('required'); - jQuery('form[name="checkout"] p#billing_company_field').removeClass('validate-required'); - jQuery('form[name="checkout"] p#billing_company_field label abbr').replaceWith('(optional)'); - - } - - function restoreOriginalBillingCompanyField() - { - let billingCompanyField = jQuery('form[name="checkout"] input[name="billing_company"]'); - let currentVisibility = billingCompanyField.is(':visible'); - let currentRequired = billingCompanyField.prop('required'); - if (currentVisibility !== originalBillingCompanyField.isVisible) { - if (originalBillingCompanyField.isVisible) { - showBillingCompanyField(); - } else { - removeBillingCompanyField(); - } - } - if (currentRequired !== originalBillingCompanyField.isRequired) { - if (originalBillingCompanyField.isRequired) { - requireBillingCompanyField(); - } else { - unrequireBillingCompanyField(); - } - } - } - - function maybeRequireBillingCompanyField() - { - if (usingGateway(gateway)) { - showBillingCompanyField(); - requireBillingCompanyField(); - } else { - restoreOriginalBillingCompanyField(); - } - } + let inputCompanyName = 'billing_company'; + let originalBillingCompanyField = saveOriginalField(inputCompanyName, {}); + let companyFieldId = 'billing_company_field'; + let companyField = jQuery('form[name="checkout"] p#billing_company_field'); + let positionCompanyField = 'form[name="checkout"] input[name="billing_last_name"]'; + let companyMarkup = '

' + + '' + + '' + + '' + + '' + + '

' jQuery(function () { jQuery('body') - .on('updated_checkout', function () { - maybeRequireBillingCompanyField(); - }); - jQuery('body') - .on('payment_method_selected', function () { - maybeRequireBillingCompanyField(); + .on('updated_checkout payment_method_selected', function () { + companyField = maybeRequireField(companyField, positionCompanyField, companyMarkup, inputCompanyName, companyFieldId, originalBillingCompanyField, gateway); }); }); } diff --git a/resources/js/mollieBlockIndex.js b/resources/js/mollieBlockIndex.js index 993e9e894..8342a1213 100644 --- a/resources/js/mollieBlockIndex.js +++ b/resources/js/mollieBlockIndex.js @@ -10,15 +10,25 @@ import molliePaymentMethod from './blocks/molliePaymentMethod' const { ajaxUrl, filters, gatewayData, availableGateways } = mollieBlockData.gatewayData; const {useEffect} = wp.element; const isAppleSession = typeof window.ApplePaySession === "function" - let shippingCompany = document.getElementById('shipping-company'); - let billingCompany = document.getElementById('billing-company'); - let companyField = shippingCompany ? shippingCompany : billingCompany; - let isCompanyFieldVisible = companyField && companyField.style.display !== 'none'; + + function getCompanyField() + { + let shippingCompany = document.getElementById('shipping-company'); + let billingCompany = document.getElementById('billing-company'); + return shippingCompany ? shippingCompany : billingCompany; + } + + function isFieldVisible(field) + { + return field && field.style.display !== 'none'; + } + + let companyField = getCompanyField(); let companyNameString = companyField && companyField.parentNode.querySelector("label[for='" + companyField.id + "']").innerHTML; gatewayData.forEach(item => { let register = () => registerPaymentMethod(molliePaymentMethod(useEffect, ajaxUrl, filters, gatewayData, availableGateways, item, jQuery, companyNameString)); if (item.name === 'mollie_wc_gateway_billie') { - if (isCompanyFieldVisible) { + if (isFieldVisible(companyField)) { register(); } return; diff --git a/resources/js/mollieIn3.js b/resources/js/mollieIn3.js new file mode 100644 index 000000000..335f7718e --- /dev/null +++ b/resources/js/mollieIn3.js @@ -0,0 +1,45 @@ +import {maybeRequireField, saveOriginalField} from "./wooCheckoutFieldsUtility"; + +( + function ({jQuery}) { + let gateway = 'mollie_wc_gateway_in3'; + let inputPhoneName = 'billing_phone'; + let originalPhone = saveOriginalField(inputPhoneName, {}); + let phoneId = 'billing_phone_field'; + let phoneField = jQuery('form[name="checkout"] p#billing_phone_field'); + let positionPhoneField = 'form[name="checkout"] input[name="billing_city"]'; + let phoneMarkup = '

' + + '' + + '' + + '' + + '' + + '

' + let inputBirthName = 'billing_birthdate'; + let originalBirth = saveOriginalField(inputBirthName, {}); + let birthId = 'billing_birthdate_field'; + let birthField = jQuery('form[name="checkout"] p#billing_birthdate_field'); + let positionBirthField = 'form[name="checkout"] input[name="billing_phone"]'; + let birthMarkup = '

' + + '' + + '' + + '' + + '' + + '

' + jQuery(function () { + jQuery('body') + .on('updated_checkout payment_method_selected', function () { + phoneField = maybeRequireField(phoneField, positionPhoneField, phoneMarkup, inputPhoneName, phoneId, originalPhone, gateway); + birthField = maybeRequireField(birthField, positionBirthField, birthMarkup, inputBirthName, birthId, originalBirth, gateway); + }); + }); + } +)( + window +) + + + diff --git a/resources/js/wooCheckoutFieldsUtility.js b/resources/js/wooCheckoutFieldsUtility.js new file mode 100644 index 000000000..c8b030c19 --- /dev/null +++ b/resources/js/wooCheckoutFieldsUtility.js @@ -0,0 +1,67 @@ +function usingGateway(gateway) +{ + return jQuery('form[name="checkout"] input[name="payment_method"]:checked').val() === gateway; +} +function showField(billingField, positionField, fieldMarkup) +{ + if ((billingField).length <= 0) { + jQuery(positionField) + .closest('p') + .after(fieldMarkup); + } +} +function requireField(inputName, fieldId) +{ + jQuery('form[name="checkout"] input[name=' + inputName + ']').attr('required', ''); + jQuery('form[name="checkout"] p#' + fieldId).addClass('validate-required'); + jQuery('form[name="checkout"] p#' + fieldId + ' label span').replaceWith('*'); +} +function removeField(fieldId) +{ + jQuery('form[name="checkout"] p#' + fieldId).remove(); +} +function unrequireField(inputName, fieldId) +{ + jQuery('form[name="checkout"] input[name=' + inputName + ']').removeAttr('required'); + jQuery('form[name="checkout"] p#' + fieldId).removeClass('validate-required'); + jQuery('form[name="checkout"] p#' + fieldId + ' label abbr').replaceWith('(optional)'); +} +function restoreOriginalField(billingField, positionField, fieldMarkup, inputName, fieldId, originalField) +{ + let field = jQuery('form[name="checkout"] input[name=' + inputName + ']'); + let currentVisibility = field.is(':visible'); + let currentRequired = field.prop('required'); + if (currentVisibility !== originalField.isVisible) { + if (originalField.isVisible) { + showField(billingField, positionField, fieldMarkup); + } else { + removeField(fieldId); + } + } + if (currentRequired !== originalField.isRequired) { + if (originalField.isRequired) { + requireField(inputName, fieldId); + } else { + unrequireField(inputName, fieldId); + } + } +} +export function saveOriginalField(inputName, originalField) +{ + let field = jQuery('form[name="checkout"] input[name=' + inputName + ']').closest('p'); + let isVisible = field.is(':visible'); + let isRequired = field.prop('required') || field.hasClass('validate-required'); + originalField = { isVisible, isRequired }; + return originalField; +} +export function maybeRequireField(billingField, positionField, fieldMarkup, inputName, fieldId, originalField, gateway) +{ + if (usingGateway(gateway)) { + showField(billingField, positionField, fieldMarkup); + requireField(inputName, fieldId); + return jQuery('form[name="checkout"] p#' + fieldId); + } else { + restoreOriginalField(billingField, positionField, fieldMarkup, inputName, fieldId, originalField); + return false; + } +} diff --git a/src/Assets/AssetsModule.php b/src/Assets/AssetsModule.php index 808572c36..cfe0a3b5f 100644 --- a/src/Assets/AssetsModule.php +++ b/src/Assets/AssetsModule.php @@ -283,6 +283,13 @@ protected function registerFrontendScripts(string $pluginUrl, string $pluginPath (string) filemtime($this->getPluginPath($pluginPath, '/public/js/mollieBillie.min.js')), true ); + wp_register_script( + 'mollie-in3-classic-handles', + $this->getPluginUrl($pluginUrl, '/public/js/mollieIn3.min.js'), + ['underscore', 'jquery'], + (string) filemtime($this->getPluginPath($pluginPath, '/public/js/mollieIn3.min.js')), + true + ); } public function registerBlockScripts(string $pluginUrl, string $pluginPath): void @@ -312,6 +319,10 @@ public function enqueueFrontendScripts() if ($isBillieEnabled) { wp_enqueue_script('mollie-billie-classic-handles'); } + $isIn3Enabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_in3_settings', 'enabled'); + if ($isIn3Enabled) { + wp_enqueue_script('mollie-in3-classic-handles'); + } $applePayGatewayEnabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_applepay_settings', 'enabled'); @@ -457,11 +468,7 @@ protected function gatewayDataForWCBlocks(Data $dataService, array $gatewayInsta $content .= $issuers; $issuers = false; } - $title = $gateway->paymentMethod()->getProperty('title'); - $shouldUseDefaultTitle = $title === false && is_string($gateway->paymentMethod()->getProperty( - 'defaultTitle' - )); - $title = $shouldUseDefaultTitle ? $gateway->paymentMethod()->getProperty('defaultTitle') : $title; + $title = $gateway->paymentMethod()->title(); $labelMarkup = "{$title}{$gateway->icon}"; $hasSurcharge = $gateway->paymentMethod()->hasSurcharge(); $gatewayData[] = [ diff --git a/src/Gateway/GatewayModule.php b/src/Gateway/GatewayModule.php index 77d5addd0..4b72a586c 100644 --- a/src/Gateway/GatewayModule.php +++ b/src/Gateway/GatewayModule.php @@ -234,7 +234,16 @@ static function () { if ($isBillieEnabled) { add_filter( 'woocommerce_after_checkout_validation', - [$this, 'organizationBillingFieldMandatory'], + [$this, 'BillieFieldsMandatory'], + 11, + 2 + ); + } + $isIn3Enabled = mollieWooCommerceIsGatewayEnabled('mollie_wc_gateway_in3_settings', 'enabled'); + if ($isIn3Enabled) { + add_filter( + 'woocommerce_after_checkout_validation', + [$this, 'in3FieldsMandatory'], 11, 2 ); @@ -338,10 +347,13 @@ public function maybeDisableBankTransferGateway(?array $gateways): array $isWcApiRequest = (bool)filter_input(INPUT_GET, 'wc-api', FILTER_SANITIZE_SPECIAL_CHARS); $bankTransferSettings = get_option('mollie_wc_gateway_banktransfer_settings', false); - $isSettingActivated = $bankTransferSettings && isset($bankTransferSettings['activate_expiry_days_setting']) && $bankTransferSettings['activate_expiry_days_setting'] === "yes"; - if ($isSettingActivated && isset($bankTransferSettings['order_dueDate'])) { - $isSettingActivated = $bankTransferSettings['order_dueDate'] > 0; - } + //If the setting is active is forced Payment API so we need to filter the gateway when order is in pay-page + // as it might have been created with Orders API + $isActiveExpiryDate = $bankTransferSettings + && isset($bankTransferSettings['activate_expiry_days_setting']) + && $bankTransferSettings['activate_expiry_days_setting'] === "yes" + && isset($bankTransferSettings['order_dueDate']) + && $bankTransferSettings['order_dueDate'] > 0; /* * There is only one case where we want to filter the gateway and it's when the @@ -351,7 +363,7 @@ public function maybeDisableBankTransferGateway(?array $gateways): array */ if ( $isWcApiRequest || - !$isSettingActivated || + !$isActiveExpiryDate || is_checkout() && ! is_wc_endpoint_url('order-pay') || !wp_doing_ajax() && ! is_wc_endpoint_url('order-pay') || is_admin() @@ -631,7 +643,7 @@ protected function instantiatePaymentMethods($container): array $settingsHelper, $paymentFieldsService, $surchargeService, - $paymentMethods + $paymentMethodAvailable ); } @@ -644,42 +656,28 @@ protected function instantiatePaymentMethods($container): array $settingsHelper, $paymentFieldsService, $surchargeService, - $paymentMethods + [] ); } return $paymentMethods; } - public function organizationBillingFieldMandatory($fields, $errors) + public function BillieFieldsMandatory($fields, $errors) { - $billiePaymentMethod = "mollie_wc_gateway_billie"; - if ($fields['payment_method'] === $billiePaymentMethod) { - if (!isset($fields['billing_company'])) { - $companyFieldPosted = filter_input(INPUT_POST, 'billing_company', FILTER_SANITIZE_SPECIAL_CHARS) ?? false; - if ($companyFieldPosted) { - $fields['billing_company'] = $companyFieldPosted; - } else { - $errors->add( - 'validation', - __( - 'Error processing Billie payment, the company name field is required.', - 'mollie-payments-for-woocommerce' - ) - ); - } - } - if ($fields['billing_company'] === '') { - $errors->add( - 'validation', - __( - 'Please enter your company name, this is required for Billie payments', - 'mollie-payments-for-woocommerce' - ) - ); - } - } + $gatewayName = "mollie_wc_gateway_billie"; + $field = 'billing_company'; + $paymentMethodName = 'Billie'; + return $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $field, $errors, $paymentMethodName); + } - return $fields; + public function in3FieldsMandatory($fields, $errors) + { + $gatewayName = "mollie_wc_gateway_in3"; + $phoneField = 'billing_phone'; + $birthdateField = 'billing_birthdate'; + $paymentMethodName = 'in3'; + $fields = $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $phoneField, $errors, $paymentMethodName); + return $this->addPaymentMethodMandatoryFields($fields, $gatewayName, $birthdateField, $errors, $paymentMethodName); } /** @@ -697,16 +695,65 @@ public function buildPaymentMethod( Settings $settingsHelper, PaymentFieldsService $paymentFieldsService, Surcharge $surchargeService, - array $paymentMethods + array $apiMethod ): PaymentMethodI { $paymentMethodClassName = 'Mollie\\WooCommerce\\PaymentMethods\\' . ucfirst($id); $paymentMethod = new $paymentMethodClassName( $iconFactory, $settingsHelper, $paymentFieldsService, - $surchargeService + $surchargeService, + $apiMethod ); return $paymentMethod; } + + /** + * Some payment methods require mandatory fields, this function will add them to the checkout fields array + * @param $fields + * @param string $gatewayName + * @param string $field + * @param $errors + * @param string $paymentMethodName + * @return mixed + */ + public function addPaymentMethodMandatoryFields($fields, string $gatewayName, string $field, $errors, string $paymentMethodName) + { + if ($fields['payment_method'] !== $gatewayName) { + return $fields; + } + if (!isset($fields[$field])) { + $fieldPosted = filter_input(INPUT_POST, $field, FILTER_SANITIZE_SPECIAL_CHARS) ?? false; + if ($fieldPosted) { + $fields[$field] = $fieldPosted; + } else { + $errors->add( + 'validation', + sprintf( + __( + 'Error processing %1$s payment, the %2$s field is required.', + 'mollie-payments-for-woocommerce' + ), + $paymentMethodName, + $field + ) + ); + } + } + if ($fields[$field] === '') { + $errors->add( + 'validation', + sprintf( + __( + 'Please enter your %1$s, this is required for %2$s payments', + 'mollie-payments-for-woocommerce' + ), + $field, + $paymentMethodName + ) + ); + } + return $fields; + } } diff --git a/src/Gateway/MolliePaymentGateway.php b/src/Gateway/MolliePaymentGateway.php index 9af51984d..f71438a88 100644 --- a/src/Gateway/MolliePaymentGateway.php +++ b/src/Gateway/MolliePaymentGateway.php @@ -120,9 +120,7 @@ public function __construct( // Use gateway class name as gateway id $this->gatewayId(); // Set gateway title (visible in admin) - $this->method_title = 'Mollie - ' . $this->paymentMethod->getProperty( - 'defaultTitle' - ); + $this->method_title = 'Mollie - ' . $this->paymentMethod->title(); $this->method_description = $this->paymentMethod->getProperty( 'settingsDescription' ); @@ -131,8 +129,7 @@ public function __construct( // Load the settings. $this->init_form_fields(); $this->init_settings(); - $this->title = $this->paymentMethod->hasProperty('title') - ? $this->paymentMethod->getProperty('title') : $this->paymentMethod->getProperty('defaultTitle'); + $this->title = $this->paymentMethod->title(); $this->initDescription(); $this->initIcon(); diff --git a/src/Gateway/Voucher/MaybeDisableGateway.php b/src/Gateway/Voucher/MaybeDisableGateway.php index 87f85c69b..806d142e3 100644 --- a/src/Gateway/Voucher/MaybeDisableGateway.php +++ b/src/Gateway/Voucher/MaybeDisableGateway.php @@ -33,8 +33,7 @@ public function maybeDisableMealVoucherGateway(?array $gateways): array // To exclude we are in Checkout or Order Pay page. These are the other options where gateways are required. $notInCheckoutOrPayPage = $isWcApiRequest || !doing_action('woocommerce_payment_gateways') - || (!wp_doing_ajax() && !is_wc_endpoint_url('order-pay')) - || is_admin(); + || (!wp_doing_ajax() && !is_wc_endpoint_url('order-pay')); $notHasBlocks = !has_block('woocommerce/checkout'); /* * There are 3 cases where we want to filter the gateway and it's when the checkout @@ -43,7 +42,7 @@ public function maybeDisableMealVoucherGateway(?array $gateways): array * * For any other case we want to be sure voucher gateway is included. */ - if ($notInCheckoutOrPayPage && $notHasBlocks) { + if (($notInCheckoutOrPayPage && $notHasBlocks) || is_admin()) { return $gateways; } $mealVoucherGatewayIndex = false; diff --git a/src/Payment/MollieOrder.php b/src/Payment/MollieOrder.php index ce21ffa68..26d092cfb 100644 --- a/src/Payment/MollieOrder.php +++ b/src/Payment/MollieOrder.php @@ -4,6 +4,7 @@ namespace Mollie\WooCommerce\Payment; +use DateTime; use Exception; use Mollie\Api\Exceptions\ApiException; use Mollie\Api\Resources\Payment; @@ -164,7 +165,10 @@ public function getPaymentRequestData($order, $customerId, $voucherDefaultCatego $encodedApplePayToken = json_encode($applePayToken); $paymentRequestData['payment']['applePayPaymentToken'] = $encodedApplePayToken; } - + $customerBirthdate = $this->getCustomerBirthdate($order); + if ($customerBirthdate) { + $paymentRequestData['consumerDateOfBirth'] = $customerBirthdate; + } return $paymentRequestData; } @@ -940,6 +944,9 @@ protected function createBillingAddress($order) self::MAXIMAL_LENGHT_REGION ); $billingAddress->organizationName = $this->billingCompanyField($order); + $billingAddress->phone = (ctype_space($order->get_billing_phone())) + ? null + : $this->getFormatedPhoneNumber($order->get_billing_phone()); return $billingAddress; } @@ -1159,6 +1166,9 @@ public function billingCompanyField($order): ?string private function checkBillieCompanyField($order) { $gateway = wc_get_payment_gateway_by_order($order); + if (!$gateway || !$gateway->id) { + return null; + } $isBillieMethodId = $gateway->id === 'mollie_wc_gateway_billie'; if ($isBillieMethodId) { $companyFieldPosted = filter_input(INPUT_POST, 'billing_company', FILTER_SANITIZE_SPECIAL_CHARS) ?? false; @@ -1171,4 +1181,38 @@ private function checkBillieCompanyField($order) } return null; } + + protected function getCustomerBirthdate($order) + { + $gateway = wc_get_payment_gateway_by_order($order); + if (!$gateway || !isset($gateway->id)) { + return null; + } + $methodId = $gateway->id === 'mollie_wc_gateway_in3'; + if ($methodId) { + $fieldPosted = filter_input(INPUT_POST, 'billing_birthdate', FILTER_SANITIZE_SPECIAL_CHARS) ?? false; + if (!$fieldPosted) { + return null; + } + $format = "Y-m-d"; + $pattern = "/(\d{1,2})[\s,\/-]+(\d{1,2})[\s,\/-]+(\d{4})/"; + if (preg_match($pattern, $fieldPosted, $matches)) { + $date = $matches[3] . "-" . $matches[2] . "-" . $matches[1]; + return date($format, strtotime($date)); + } + } + return null; + } + + protected function getFormatedPhoneNumber(string $phone) + { + //remove whitespaces and all non numerical characters except + + $phone = preg_replace('/[^0-9+]+/', '', $phone); + + //check that $phone is in E164 format + if ($phone !== null && preg_match('/^\+[1-9]\d{1,14}$/', $phone)) { + return $phone; + } + return null; + } } diff --git a/src/Payment/PaymentService.php b/src/Payment/PaymentService.php index 4f675a614..94a2eaefa 100644 --- a/src/Payment/PaymentService.php +++ b/src/Payment/PaymentService.php @@ -386,6 +386,7 @@ protected function processAsMollieOrder( $paymentOrder->updatePaymentDataWithOrderData($orderWithPayments, $orderId); } } catch (ApiException $e) { + $this->handleMollieOutage($e); // Don't try to create a Mollie Payment for Klarna payment methods $order_payment_method = $order->get_payment_method(); $orderMandatoryPaymentMethods = [ @@ -393,9 +394,10 @@ protected function processAsMollieOrder( 'mollie_wc_gateway_klarnasliceit', 'mollie_wc_gateway_klarnapaynow', 'mollie_wc_gateway_billie', + 'mollie_wc_gateway_in3', ]; - if (in_array($order_payment_method, $orderMandatoryPaymentMethods)) { + if (in_array($order_payment_method, $orderMandatoryPaymentMethods, true)) { $this->logger->debug( 'Creating payment object: type Order failed, stopping process.' ); @@ -488,6 +490,7 @@ protected function processAsMolliePayment( $apiKey )->payments->create($data); } catch (ApiException $e) { + $this->handleMollieOutage($e); $message = $e->getMessage(); $this->logger->debug($message); throw $e; @@ -842,4 +845,27 @@ protected function processInitialOrderStatus($paymentMethod) $initialOrderStatus ); } + + /** + * Check if the exception is an outage, if so bail, log and inform user + * @param ApiException $e + * @return void + * @throws ApiException + */ + public function handleMollieOutage(ApiException $e): void + { + $isMollieOutage = $this->apiHelper->isMollieOutageException($e); + if ($isMollieOutage) { + $this->logger->debug( + "Creating payment object: type Order failed due to a Mollie outage, stopping process. Check Mollie status at https://status.mollie.com/. {$e->getMessage()}" + ); + + throw new ApiException( + __( + 'Payment failed due to: Mollie is out of service. Please try again later.', + 'mollie-payments-for-woocommerce' + ) + ); + } + } } diff --git a/src/PaymentMethods/AbstractPaymentMethod.php b/src/PaymentMethods/AbstractPaymentMethod.php index 359a83c9c..b17fa84e3 100644 --- a/src/PaymentMethods/AbstractPaymentMethod.php +++ b/src/PaymentMethods/AbstractPaymentMethod.php @@ -40,12 +40,17 @@ abstract class AbstractPaymentMethod implements PaymentMethodI * @var Surcharge */ protected $surcharge; + /** + * @var array + */ + private $apiPaymentMethod; public function __construct( IconFactory $iconFactory, Settings $settingsHelper, PaymentFieldsService $paymentFieldsService, - Surcharge $surcharge + Surcharge $surcharge, + array $apiPaymentMethod ) { $this->id = $this->getIdFromConfig(); @@ -55,6 +60,24 @@ public function __construct( $this->surcharge = $surcharge; $this->config = $this->getConfig(); $this->settings = $this->getSettings(); + $this->apiPaymentMethod = $apiPaymentMethod; + } + + public function title(): string + { + $titleIsDefault = $this->titleIsDefault(); + $useApiTitle = $this->getProperty(SharedDataDictionary::USE_API_TITLE) === 'yes'; + if ($titleIsDefault && $useApiTitle === false) { + $this->updateMethodOption(SharedDataDictionary::USE_API_TITLE, 'yes'); + $useApiTitle = true; + } + + $title = $this->getProperty('title'); + //new installations or installations that saved the default one should use the api title + if ($useApiTitle || $title === false || $titleIsDefault) { + return $this->getApiTitle(); + } + return $title; } /** @@ -121,8 +144,9 @@ public function shouldDisplayIcon(): bool */ public function getSharedFormFields() { + $defaultTitle = $this->getApiTitle(); return $this->settingsHelper->generalFormFields( - $this->config['defaultTitle'], + $defaultTitle, $this->config['defaultDescription'], $this->config['confirmationDelayed'] ); @@ -259,6 +283,39 @@ public function defaultSettings(): array $fields = array_filter($fields, static function ($key) { return !is_numeric($key); }, ARRAY_FILTER_USE_KEY); + //we don't save the default description or title, in case the language changes + unset($fields['description']); + unset($fields['title']); return array_combine(array_keys($fields), array_column($fields, 'default')) ?: []; } + + /** + * Update the payment method's settings + * @param string $optionName + * @param string $newValue + * @return void + */ + public function updateMethodOption(string $optionName, string $newValue) + { + $settingName = 'mollie_wc_gateway_' . $this->id . '_settings'; + $settings = get_option($settingName, false); + $settings[$optionName] = $newValue; + update_option($settingName, $settings, true); + } + + private function getApiTitle() + { + $apiTitle = $this->apiPaymentMethod['description'] ?? null; + return $apiTitle ?: $this->config['defaultTitle']; + } + + protected function titleIsDefault(): bool + { + $savedTitle = $this->getProperty('title'); + if (!$savedTitle) { + return false; + } + + return $savedTitle === $this->config['defaultTitle']; + } } diff --git a/src/PaymentMethods/Giftcard.php b/src/PaymentMethods/Giftcard.php index f20b7ea1b..395016fa3 100644 --- a/src/PaymentMethods/Giftcard.php +++ b/src/PaymentMethods/Giftcard.php @@ -73,7 +73,7 @@ protected function getConfig(): array public function getFormFields($generalFormFields): array { - $paymentMethodFormFieds = [ + $paymentMethodFormFields = [ 'issuers_dropdown_shown' => [ 'title' => __( 'Show gift cards dropdown', @@ -105,6 +105,6 @@ public function getFormFields($generalFormFields): array 'default' => __('Select your gift card', 'mollie-payments-for-woocommerce'), ], ]; - return array_merge($generalFormFields, $paymentMethodFormFieds); + return array_merge($generalFormFields, $paymentMethodFormFields); } } diff --git a/src/PaymentMethods/PaymentMethodI.php b/src/PaymentMethods/PaymentMethodI.php index 8b3ad1486..cd40adbf4 100644 --- a/src/PaymentMethods/PaymentMethodI.php +++ b/src/PaymentMethods/PaymentMethodI.php @@ -10,6 +10,7 @@ interface PaymentMethodI { public function getProperty(string $propertyName); public function hasProperty(string $propertyName): bool; + public function title(): string; public function hasPaymentFields(): bool; public function getProcessedDescriptionForBlock(): string; public function paymentFieldsService(): PaymentFieldsService; diff --git a/src/SDK/Api.php b/src/SDK/Api.php index 83503260d..7b7cd5fb0 100644 --- a/src/SDK/Api.php +++ b/src/SDK/Api.php @@ -71,4 +71,15 @@ public function getApiEndpoint() { return apply_filters($this->pluginId . '_api_endpoint', \Mollie\Api\MollieApiClient::API_ENDPOINT); } + + public function isMollieOutageException(\Mollie\Api\Exceptions\ApiException $e): bool + { + //see https://status.mollie.com/ + $outageCode = [400, 500]; + + if (in_array($e->getCode(), $outageCode, true)) { + return true; + } + return false; + } } diff --git a/src/Settings/General/MollieGeneralSettings.php b/src/Settings/General/MollieGeneralSettings.php index 2c9297cdd..bfa0b9b42 100644 --- a/src/Settings/General/MollieGeneralSettings.php +++ b/src/Settings/General/MollieGeneralSettings.php @@ -51,6 +51,15 @@ public function gatewayFormFields( 'default' => $defaultTitle, 'desc_tip' => true, ], + 'use_api_title' => [ + 'title' => __( + 'Use API dynamic title', + 'mollie-payments-for-woocommerce' + ), + 'type' => 'checkbox', + 'label' => __('Retrieve the gateway title from Mollie', 'mollie-payments-for-woocommerce'), + 'default' => 'no', + ], 'description' => [ 'title' => __('Description', 'mollie-payments-for-woocommerce'), 'type' => 'textarea', diff --git a/src/Settings/Page/MollieSettingsPage.php b/src/Settings/Page/MollieSettingsPage.php index b0e560e3b..3794fee68 100644 --- a/src/Settings/Page/MollieSettingsPage.php +++ b/src/Settings/Page/MollieSettingsPage.php @@ -350,7 +350,7 @@ public function getMollieMethods(): string $paymentMethodEnabledAtMollie = array_key_exists($gatewayKey, $mollieGateways); $content .= '
  • '; $content .= $paymentMethod->getIconUrl(); - $content .= ' ' . esc_html($paymentMethod->getProperty('defaultTitle')); + $content .= ' ' . esc_html($paymentMethod->title()); if ($paymentMethodEnabledAtMollie) { $content .= $iconAvailable; $content .= ' ' . strtolower( diff --git a/src/Shared/Data.php b/src/Shared/Data.php index f5b8eaf98..536b2866c 100644 --- a/src/Shared/Data.php +++ b/src/Shared/Data.php @@ -683,7 +683,10 @@ public function getAllAvailablePaymentMethods($use_cache = true) { $apiKey = $this->settingsHelper->getApiKey(); $methods = false; - $transient_id = $this->getTransientId(md5('mollie_available_methods')); + $locale = $this->getPaymentLocale(); + $filters_key = []; + $filters_key['locale'] = $locale; + $transient_id = $this->getTransientId(md5(http_build_query($filters_key))); try { if ($use_cache) { @@ -698,7 +701,7 @@ public function getAllAvailablePaymentMethods($use_cache = true) if (!$apiKey) { return []; } - $methods = $this->api_helper->getApiClient($apiKey)->methods->allAvailable(); + $methods = $this->api_helper->getApiClient($apiKey)->methods->allAvailable($filters_key); $methods_cleaned = []; diff --git a/src/Shared/SharedDataDictionary.php b/src/Shared/SharedDataDictionary.php index 5c519f1ab..68006e796 100644 --- a/src/Shared/SharedDataDictionary.php +++ b/src/Shared/SharedDataDictionary.php @@ -136,4 +136,8 @@ class SharedDataDictionary * @var string */ public const SETTING_LOCALE_DEFAULT_LANGUAGE = 'en_US'; + /** + * @var string + */ + public const USE_API_TITLE = 'use_api_title'; } diff --git a/src/Subscription/MollieSubscriptionGateway.php b/src/Subscription/MollieSubscriptionGateway.php index 774bf169f..a4d666693 100644 --- a/src/Subscription/MollieSubscriptionGateway.php +++ b/src/Subscription/MollieSubscriptionGateway.php @@ -307,6 +307,7 @@ public function scheduled_subscription_payment($renewal_total, WC_Order $renewal $payment->mandateId ); $subcriptionParentOrder->save(); + $mandateId = $payment->mandateId; } } else { throw new ApiException(sprintf(__('The customer (%s) does not have a valid mandate.', 'mollie-payments-for-woocommerce-mandate-problem'), $customer_id)); @@ -346,8 +347,7 @@ public function scheduled_subscription_payment($renewal_total, WC_Order $renewal 'result' => 'success', ]; } catch (ApiException $e) { - $this->logger->debug($this->id . ': Failed to create payment for order ' . $renewal_order_id . ': ' . $e->getMessage()); - + $this->logger->debug("{$this->id} : Failed to create payment for order {$renewal_order_id}, with customer {$customer_id} and mandate {$mandateId}. New status failed. API error: {$e->getMessage()}"); /* translators: Placeholder 1: Payment method title */ $message = sprintf(__('Could not create %s renewal payment.', 'mollie-payments-for-woocommerce'), $this->title); $message .= ' ' . $e->getMessage(); diff --git a/tests/e2e/Activation/Activation.spec.js b/tests/e2e/Activation/Activation.spec.js deleted file mode 100644 index 3ae023478..000000000 --- a/tests/e2e/Activation/Activation.spec.js +++ /dev/null @@ -1,27 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../Shared/base-test'); -const {deactivateWPPlugin, activateWPPlugin} = require("../Shared/wpUtils"); - -test.describe('Plugin active when WooCommerce is active', () => { - test.beforeEach(async ({ page, }) => { - await page.goto('/wp-admin/plugins.php'); - }); - - test('I see plugin active', async ({ page}) => { - await expect(page.getByTestId('mollie-payments-for-woocommerce')).toHaveClass(/active/); - }); - - test('I see plugin version', async ({ page}) => { - await expect(page.getByTestId('mollie-payments-for-woocommerce')).toHaveText(/7.3.6/); //TODO: remove this and retrieve the version from the plugin - }); -}); - -test.describe('Plugin deactivated when WooCommerce is NOT active', () => { - test('I see plugin notice deactivated', async ({ page}) => { - await page.goto('/wp-admin/plugins.php'); - await deactivateWPPlugin(page, 'WooCommerce'); - await expect(page.getByText(/Mollie Payments for WooCommerce is inactive/)).toBeVisible(); - //restore state - await activateWPPlugin(page, 'WooCommerce'); - }); -}); diff --git a/tests/e2e/Cart/PayPalButtonCart.block.spec.js b/tests/e2e/Cart/PayPalButtonCart.block.spec.js deleted file mode 100644 index df40fbfa1..000000000 --- a/tests/e2e/Cart/PayPalButtonCart.block.spec.js +++ /dev/null @@ -1,63 +0,0 @@ -// @ts-check -const { expect } = require('@playwright/test'); -const { test } = require('../Shared/base-test'); -const {setOrderAPI, markStatusInMollie} = require('../Shared/mollieUtils'); -const {addProductToCart} = require('../Shared/wooUtils'); -const {wooOrderPaidPage, wooOrderDetailsPageOnPaid} = require('../Shared/testMollieInWooPage'); -const {sharedUrl: {paypalSettings}} = require('../Shared/sharedUrl'); - - -test.describe('PayPal Transaction in classic cart', () => { - test('Not be seen if not enabled', async ({page, products}) => { - await page.goto(paypalSettings); - await page.locator('input[name="mollie_wc_gateway_paypal_mollie_paypal_button_enabled_cart"]').uncheck(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - await addProductToCart(page, products.virtual.name); - //go to cart and not see - await page.goto('/cart-block/'); - await expect(page.locator('#mollie-PayPal-button')).not.toBeVisible(); - //remove from cart - await page.locator('text=Remove item').click(); - }); - test('Not be seen if not virtual', async ({page, products}) => { - // set PayPal visible in cart - await page.goto(paypalSettings); - await page.locator('input[name="mollie_wc_gateway_paypal_mollie_paypal_button_enabled_cart"]').check(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - await addProductToCart(page, products.simple.name); - //go to cart and not see - await page.goto('/cart-block/'); - await expect(page.locator('#mollie-PayPal-button')).not.toBeVisible(); - //remove from cart - await page.locator('text=Remove item').click(); - }); - test('Transaction with Order API - virtual product', async ({page, gateways, products}) => { - let testedGateway = gateways - await setOrderAPI(page); - await addProductToCart(page, products.virtual.name); - //go to cart and click - await page.goto('/cart-block/'); - await expect(page.locator('#mollie-PayPal-button')).toBeVisible(); - //Capture WooCommerce total amount - const totalAmount = await page.innerText('div.wp-block-woocommerce-cart-order-summary-block > div:nth-child(4) > div > span.wc-block-formatted-money-amount.wc-block-components-formatted-money-amount.wc-block-components-totals-item__value'); - await Promise.all([ - page.waitForNavigation(/*{ url: 'https://www.mollie.com/checkout/test-mode?method=paypal&token=3.q6wq1i' }*/), - page.locator('input[alt="PayPal Button"]').click() - ]); - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Paid"); - - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderPaidPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnPaid(page, mollieOrder, testedGateway); - }); -}); diff --git a/tests/e2e/Cart/PayPalButtonCart.classic.spec.js b/tests/e2e/Cart/PayPalButtonCart.classic.spec.js deleted file mode 100644 index d64ede1d9..000000000 --- a/tests/e2e/Cart/PayPalButtonCart.classic.spec.js +++ /dev/null @@ -1,28 +0,0 @@ -// @ts-check -const { expect } = require('@playwright/test'); -const { test } = require('../Shared/base-test'); -const {resetSettings, insertAPIKeys} = require('../Shared/mollieUtils'); -const {addProductToCart} = require('../Shared/wooUtils'); -const {sharedUrl: {paypalSettings}} = require('../Shared/sharedUrl'); - -test.describe('PayPal Transaction in classic cart', () => { - test.beforeAll(async ({browser , baseURL}) => { - const page = await browser.newPage({ baseURL: baseURL, extraHTTPHeaders: {'ngrok-skip-browser-warning': '123'} }); - await resetSettings(page); - await insertAPIKeys(page); - }); - test('Not be seen if not enabled', async ({page, products}) => { - await page.goto(paypalSettings); - await page.locator('input[name="mollie_wc_gateway_paypal_mollie_paypal_button_enabled_cart"]').uncheck(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - await addProductToCart(page, products.virtual.name); - //go to cart and not see - await page.goto('/cart/'); - await expect(page.locator('#mollie-PayPal-button')).not.toBeVisible(); - //remove from cart - await page.locator('tr.woocommerce-cart-form__cart-item.cart_item > td.product-remove > a').click(); - }); -}); diff --git a/tests/e2e/Error Handling/_error_handling.spec.js b/tests/e2e/Error Handling/_error_handling.spec.js new file mode 100644 index 000000000..d59ed7578 --- /dev/null +++ b/tests/e2e/Error Handling/_error_handling.spec.js @@ -0,0 +1,59 @@ +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 new file mode 100644 index 000000000..50ffadce2 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/General/_mollie_settings_tab_general.spec.js @@ -0,0 +1,72 @@ +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 new file mode 100644 index 000000000..4d5f4f7a2 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Mollie Components/_mollie_settings_tab_mollie_components.spec.js @@ -0,0 +1,35 @@ +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 new file mode 100644 index 000000000..7f393d7bf --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings.spec.js @@ -0,0 +1,82 @@ +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 new file mode 100644 index 000000000..afaba2609 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_apple_pay_settings.spec.js @@ -0,0 +1,68 @@ +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 new file mode 100644 index 000000000..0838ffb93 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_bancontact_settings.spec.js @@ -0,0 +1,74 @@ +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 new file mode 100644 index 000000000..526625ab1 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_belfius_direct_net_settilngs.spec.js @@ -0,0 +1,71 @@ +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 new file mode 100644 index 000000000..816c8e0a2 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_billie_settings.spec.js @@ -0,0 +1,70 @@ +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 new file mode 100644 index 000000000..c860cd084 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_credit_card_settings.spec.js @@ -0,0 +1,162 @@ +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 new file mode 100644 index 000000000..7f6c5fde1 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_eps_settings.spec.js @@ -0,0 +1,71 @@ +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 new file mode 100644 index 000000000..fae0882f0 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_gift_cards_settings.spec.js @@ -0,0 +1,71 @@ +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 new file mode 100644 index 000000000..eae57786f --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_giropay_settings.spec.js @@ -0,0 +1,71 @@ +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 new file mode 100644 index 000000000..d1d7f4b9d --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_ideal_settings.spec.js @@ -0,0 +1,81 @@ +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 new file mode 100644 index 000000000..40bd0f550 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_in3_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..6239742a4 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_kbc_cbc_payment_button_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..ae1ecbf41 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_later_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..03d888bd6 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_pay_now_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..efb7ad8e6 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_klarna_slice_it_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..9d9e9814c --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_mybank_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..0381a1b6a --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paypal_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..74c67ccfb --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_paysafecard_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..6af7248a6 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_przelewy24_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..16bfdbc55 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sepa_bank_transfer_settings.spec.js @@ -0,0 +1,74 @@ +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 new file mode 100644 index 000000000..942e7b5e2 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_sofort_banking_settings.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..685c654e5 --- /dev/null +++ b/tests/e2e/Mollie Settings tab/Payment method settings/_mollie_settings_tab_payment_method_settings_voucher_settings.spec.js @@ -0,0 +1,79 @@ +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 new file mode 100644 index 000000000..662e897c3 --- /dev/null +++ b/tests/e2e/Plugins page/_plugins_page.spec.js @@ -0,0 +1,40 @@ +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/Product/PayPalButtonProduct.classic.spec.js b/tests/e2e/Product/PayPalButtonProduct.classic.spec.js deleted file mode 100644 index 405876563..000000000 --- a/tests/e2e/Product/PayPalButtonProduct.classic.spec.js +++ /dev/null @@ -1,67 +0,0 @@ -// @ts-check -const { expect } = require('@playwright/test'); -const { test } = require('../Shared/base-test'); -const {setOrderAPI, markStatusInMollie, resetSettings, insertAPIKeys} = require('../Shared/mollieUtils'); -const {wooOrderPaidPage, wooOrderDetailsPageVirtual} = require('../Shared/testMollieInWooPage'); -test.describe.configure({ mode: 'serial' }); -test.describe('PayPal Transaction in classic product', () => { - test.beforeAll(async ({browser , baseURL}) => { - const page = await browser.newPage({ baseURL: baseURL, extraHTTPHeaders: {'ngrok-skip-browser-warning': '123'}}); - await resetSettings(page); - await insertAPIKeys(page); - }); - test('Not be seen if not enabled', async ({ page }) => { - // Go to virtual product product - await page.goto('/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=mollie_wc_gateway_paypal'); - await page.locator('input[name="mollie_wc_gateway_paypal_mollie_paypal_button_enabled_product"]').uncheck(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - await page.goto('/product/album/'); - await expect(page.locator('#mollie-PayPal-button')).not.toBeVisible(); - }); - test('Not be seen if not virtual', async ({ page }) => { - // set PayPal visible in product - await page.goto('/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=mollie_wc_gateway_paypal'); - await page.locator('input[name="mollie_wc_gateway_paypal_mollie_paypal_button_enabled_product"]').check(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - // Go to simple product - await page.goto('/product/beanie'); - await expect(page.locator('#mollie-PayPal-button')).not.toBeVisible(); - }); - test('Transaction with Order API - virtual product', async ({ page, gateways, products }) => { - let testedGateway = gateways; - await setOrderAPI(page); - // set PayPal visible in product - await page.goto('/wp-admin/admin.php?page=wc-settings&tab=checkout§ion=mollie_wc_gateway_paypal'); - await page.locator('input[name="mollie_wc_gateway_paypal_mollie_paypal_button_enabled_product"]').check(); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - // Go to virtual product page - await page.goto('/product/album/'); - - await expect(page.locator('#mollie-PayPal-button')).toBeVisible(); - //Capture WooCommerce total amount - const totalAmount = await page.innerText('div.summary.entry-summary > p > span > bdi') - await Promise.all([ - page.waitForNavigation({ url: 'https://www.mollie.com/checkout/test-mode?method=paypal&token=3.q6wq1i' }), - page.locator('input[alt="PayPal Button"]').click() - ]); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Paid"); - - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderPaidPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageVirtual(page, mollieOrder, testedGateway); - }); -}); diff --git a/tests/e2e/Product/TestCI.spec.js b/tests/e2e/Product/TestCI.spec.js deleted file mode 100644 index 8aed238db..000000000 --- a/tests/e2e/Product/TestCI.spec.js +++ /dev/null @@ -1,10 +0,0 @@ -const { expect } = require('@playwright/test'); -const { test } = require('../Shared/base-test'); - -test.describe('CI is working', () => { - test('I see product page', async ({ page, gateways, products }) => { - // Go to virtual product page - await page.goto('/product/album/'); - await expect(page).toHaveTitle(/Album/); - }); -}); diff --git a/tests/e2e/README.md b/tests/e2e/README.md index 5ca2861d8..832dbe952 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -2,9 +2,11 @@ ### 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/Settings/GeneralSettings.spec.js b/tests/e2e/Settings/GeneralSettings.spec.js deleted file mode 100644 index ae5c191be..000000000 --- a/tests/e2e/Settings/GeneralSettings.spec.js +++ /dev/null @@ -1,21 +0,0 @@ -// @ts-check -const { expect } = require('@playwright/test'); -const { test } = require('../Shared/base-test'); -const {insertAPIKeys, resetSettings} = require('../Shared/mollieUtils'); -const {sharedUrl: {mollieSettingsTab}} = require('../Shared/sharedUrl'); -test.describe('Should show general settings', () => { - test('Should show empty and disconnected', async ({ page}) => { - await resetSettings(page); - await page.goto(mollieSettingsTab); - await expect(page.getByText(/API keys missing/)).toBeVisible(); - }); - test('Should connect when API key is present', async ({ page , gateways}) => { - await page.goto(mollieSettingsTab); - await insertAPIKeys(page); - await expect(page.getByText(/Mollie status: Connected/)).toBeVisible(); - for ( const gatewayName in gateways ){ - const title = gateways[gatewayName].defaultTitle - await expect(page.locator(`text=${title} enabled edit >> span`)).toBeVisible(); - } - }); -}); diff --git a/tests/e2e/Settings/PaymentSettings.classic.spec.js b/tests/e2e/Settings/PaymentSettings.classic.spec.js deleted file mode 100644 index 9d626ec31..000000000 --- a/tests/e2e/Settings/PaymentSettings.classic.spec.js +++ /dev/null @@ -1,105 +0,0 @@ -// @ts-check -const {expect} = require('@playwright/test'); -const {test} = require('../Shared/base-test'); -const {insertAPIKeys, resetSettings} = require('../Shared/mollieUtils'); -const {simple} = require('../Shared/products'); -const {banktransfer, paypal} = require('../Shared/gateways'); -const PRODUCTS = {simple} -const GATEWAYS = {banktransfer} -const {sharedUrl: {gatewaySettingsRoot}} = require('../Shared/sharedUrl'); -const {loginAdmin} = require("../Shared/wpUtils"); -test.describe.configure({ mode: 'serial' }); - -/** @type {import('@playwright/test').Page} */ -let page; -async function addProductToCart(page, productName) { - await page.goto('/shop/'); - await page.locator('[data-product_sku="' + productName + '"]').click(); -} - -test.describe('Should show payment settings on classic checkout', () => { - test.beforeAll(async ({ browser }) => { - page = await browser.newPage(); - await addProductToCart(page, PRODUCTS.simple.name); - }); - - for (const key in GATEWAYS) { - test(`Should show ${key} default settings`, async () => { - // Go to checkout - await page.goto('/checkout'); - let testedGateway = GATEWAYS[key] - //check default title - await page.locator('#payment_method_mollie_wc_gateway_' + testedGateway.id) - await expect(page.locator(`#payment`)).toContainText(testedGateway.defaultTitle); - //check default icon - const url = await page.$eval(`text=${testedGateway.defaultTitle} >> img`, img => img.src); - await expect(url).toContain(`/public/images/${testedGateway.id}.svg`) - - //check issuers dropdown show - if (testedGateway.paymentFields) { - let issuers = page.locator(`#payment > ul > li.wc_payment_method.payment_method_mollie_wc_gateway_${testedGateway.id} > div`) - await expect(issuers).toContainText(testedGateway.defaultDescription) - } - //no fee added - await expect(page.locator('#order_review')).not.toContainText('Fee') - }); - }// end loop gateways - for (const key in GATEWAYS) { - test(`Should show ${key} custom settings`, async () => { - let testedGateway = GATEWAYS[key] - //set custom settings - await page.goto(gatewaySettingsRoot + testedGateway.id) - await page.locator(`input[name="mollie_wc_gateway_${testedGateway.id}_title"]`).fill(`${testedGateway.defaultTitle} edited`); - await page.locator(`textarea[name="mollie_wc_gateway_${testedGateway.id}_description"]`).fill(`${testedGateway.defaultTitle} description edited`); - await page.locator(`input[name="mollie_wc_gateway_${testedGateway.id}_display_logo"]`).uncheck(); - //await page.locator(`#mainform > table:nth-child(9) > tbody > tr > td > span.select2.select2-container.select2-container--default > span.selection > span > ul > li > input`).click(); - 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.locator(`select[name="mollie_wc_gateway_${testedGateway.id}_payment_surcharge"]`).selectOption('fixed_fee'); - await page.locator(`input[name="mollie_wc_gateway_${testedGateway.id}_fixed_fee"]`).fill('10'); - if (testedGateway.paymentFields) { - await page.locator(`input[name="mollie_wc_gateway_${testedGateway.id}_issuers_dropdown_shown"]`).uncheck(); - } - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - // Go to checkout - await page.goto('/checkout'); - - //check custom title - await page.locator(`select[name="billing_country"]`).selectOption('ES'); - await page.locator(`#payment > ul > li.wc_payment_method.payment_method_mollie_wc_gateway_${testedGateway.id} > label`).click() - await expect(page.locator(`#payment > ul > li.wc_payment_method.payment_method_mollie_wc_gateway_${testedGateway.id} > label`)).toContainText(`${testedGateway.defaultTitle} edited`); - //check not display logo - await expect(page.locator(`text=${testedGateway.defaultTitle} >> img`)).toBeFalsy - //check custom description - await expect(page.locator('#payment')).toContainText(`${testedGateway.defaultTitle} description edited`); - //check issuers dropdown not show todo check components in creditcard - if (testedGateway.paymentFields) { - let issuers = page.locator(`#payment > ul > li.wc_payment_method.payment_method_mollie_wc_gateway_${testedGateway.id} > div`) - await expect(issuers).toBeEmpty - } - //check fee added todo check fee amount and taxes - await expect(page.locator('#order_review')).toContainText('Fee') - //check not sell to countries - await page.locator(`select[name="billing_country"]`).selectOption('DE'); - await expect(page.locator(`#payment > ul > li.wc_payment_method.payment_method_mollie_wc_gateway_${testedGateway.id} > label`)).not.toBeVisible(); - }); - }// end loop gateways*/ - //default state - test.afterAll(async () => { - await resetSettings(page); - await insertAPIKeys(page); - }); -}); - - - - - - - - - diff --git a/tests/e2e/Shared/base-test.js b/tests/e2e/Shared/base-test.js index 7e4c5547d..7bc45e0be 100644 --- a/tests/e2e/Shared/base-test.js +++ b/tests/e2e/Shared/base-test.js @@ -1,8 +1,8 @@ const base = require('@playwright/test'); -const {simple} = require('../Shared/products'); -const {ideal, banktransfer} = require('../Shared/gateways'); +const {allProducts} = require('./products'); +const {allMethods} = require('./gateways'); exports.test = base.test.extend({ - products: [simple, { option: true }], - gateways: [ideal, { option: true }], + products: [allProducts, { option: true }], + gateways: [allMethods, { option: true }], }); diff --git a/tests/e2e/Shared/gateways.js b/tests/e2e/Shared/gateways.js index 7116da626..53e618b88 100644 --- a/tests/e2e/Shared/gateways.js +++ b/tests/e2e/Shared/gateways.js @@ -1,49 +1,17 @@ -const banktransfer = { - 'id': 'banktransfer', - 'defaultTitle': 'Bank Transfer', - 'settingsDescription': '', - 'defaultDescription': '', - 'paymentFields': false, - 'instructions': true, - 'supports': [ - 'products', - 'refunds', - ], - 'filtersOnBuild': true, - 'confirmationDelayed': true, - 'SEPA': false, - 'customRedirect': true, +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 ideal = { - 'id': 'ideal', - 'defaultTitle': 'iDeal', - 'settingsDescription': '', - 'defaultDescription': 'Select your bank', - 'paymentFields': true, - 'instructions': true, - 'supports': [ - 'products', - 'refunds', - ], - 'SEPA': true -} -const creditcard = { - 'id': 'creditcard', - 'defaultTitle': 'Credit card', -} -const paypal = { - 'id' : 'paypal', - 'defaultTitle' : 'PayPal', - 'settingsDescription' : '', - 'defaultDescription' : '', - 'paymentFields' : false, - 'instructions' : true, - 'supports' : [ - 'products', - 'refunds', - ], - 'filtersOnBuild' : false, - 'confirmationDelayed' : false, - 'SEPA' : false, -} -module.exports = {banktransfer, ideal, creditcard, paypal}; +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/global-setup.js b/tests/e2e/Shared/global-setup.js deleted file mode 100644 index b160dad0e..000000000 --- a/tests/e2e/Shared/global-setup.js +++ /dev/null @@ -1,11 +0,0 @@ -const { chromium } = require('@playwright/test'); -const { loginAdmin } = require('../Shared/wpUtils'); - -module.exports = async config => { - const { storageState } = config.projects[0].use; - const browser = await chromium.launch(); - const page = await browser.newPage({ baseURL: config.projects[0].use.baseURL, extraHTTPHeaders: {'ngrok-skip-browser-warning': '123'}}); - await loginAdmin(page); - await page.context().storageState({ path: storageState }); - await browser.close(); -}; diff --git a/tests/e2e/Shared/mollieUtils.js b/tests/e2e/Shared/mollieUtils.js index 78c3b3075..889187f4f 100644 --- a/tests/e2e/Shared/mollieUtils.js +++ b/tests/e2e/Shared/mollieUtils.js @@ -1,10 +1,34 @@ const {sharedUrl: {mollieSettingsTab}} = require('../Shared/sharedUrl'); -const {loginAdmin} = require("./wpUtils"); +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 loginAdmin(page) await page.goto(mollieSettingsTab + '§ion=advanced'); await page.selectOption('select#mollie-payments-for-woocommerce_api_switch', 'order') await Promise.all([ @@ -37,10 +61,38 @@ const markStatusInMollie = async (page, status) =>{ 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 insertAPIKeys = async (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(); @@ -51,6 +103,20 @@ const insertAPIKeys = async (page) =>{ ]); } +/** + * @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 */ @@ -62,4 +128,277 @@ const resetSettings = async (page) => { ]); } -module.exports = {setOrderAPI, setPaymentAPI, markStatusInMollie, insertAPIKeys, resetSettings}; +/** + * @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 index f0d14c89b..5b6eea66d 100644 --- a/tests/e2e/Shared/products.js +++ b/tests/e2e/Shared/products.js @@ -1,11 +1,54 @@ -const simple = { - 'name': 'woo-beanie', - 'price': '18,00€' -} -const virtual = { - 'name': 'woo-album', - 'price': '15,00€' -} +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 = {simple, virtual}; +module.exports = {allProducts}; diff --git a/tests/e2e/Shared/sharedUrl.js b/tests/e2e/Shared/sharedUrl.js index 3f7b1a2ab..584d419dd 100644 --- a/tests/e2e/Shared/sharedUrl.js +++ b/tests/e2e/Shared/sharedUrl.js @@ -2,4 +2,5 @@ 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/test-logo.png b/tests/e2e/Shared/test-logo.png new file mode 100644 index 000000000..c493571d8 Binary files /dev/null and b/tests/e2e/Shared/test-logo.png differ diff --git a/tests/e2e/Shared/testMollieInWooPage.js b/tests/e2e/Shared/testMollieInWooPage.js index 41ce5347e..7885e7d82 100644 --- a/tests/e2e/Shared/testMollieInWooPage.js +++ b/tests/e2e/Shared/testMollieInWooPage.js @@ -1,4 +1,15 @@ +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 @@ -11,10 +22,11 @@ export const wooOrderPaidPage = async (page, mollieOrder, totalAmount, testedGat await expect(page.getByText('My company nameJulia CallasCalle Drutal22100 BerlinGermany 1234566788 test@test.')).toBeVisible; } // Check Mollie method appears - await expect(page.getByRole('strong').filter({ hasText: testedGateway.defaultTitle })).toBeVisible(); + const methodName = normalizedName(testedGateway.defaultTitle); + await expect(page.getByRole('cell', { name: methodName})).toBeVisible(); } -export const wooOrderRetryPage = async (page, mollieOrder, totalAmount, testedGateway) => { +export const wooOrderRetryPage = async (page) => { // Check we are in retry page const regex = new RegExp(/checkout\/order-pay/); await expect(page).toHaveURL(regex); @@ -24,41 +36,15 @@ export const wooOrderCanceledPage = async (page, mollieOrder, totalAmount, teste 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 wooOrderDetailsPageOnPaid = async (page, mollieOrder, testedGateway) => { - await page.goto('/wp-admin/edit.php?post_type=shop_order'); - // Check order is in status processing in order page - await expect(page.locator('#post-' + mollieOrder + '> td.order_status.column-order_status > mark > span')).toContainText("Processing"); - await page.goto('/wp-admin/post.php?post=' + mollieOrder + '&action=edit'); - - // Check order notes has correct text - await expect(page.getByText('Order completed using Mollie – ' + testedGateway.defaultTitle + ' payment')).toBeVisible(); -} - -export const wooOrderDetailsPageVirtual = async (page, mollieOrder, testedGateway) => { - await page.goto('/wp-admin/edit.php?post_type=shop_order'); - // Check order is in status processing in order page - await expect(page.locator('#post-' + mollieOrder + '> td.order_status.column-order_status > mark > span')).toContainText("Completed"); - 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('Order completed using Mollie – ' + testedGateway.defaultTitle + ' payment'); -} - -export const wooOrderDetailsPageOnFailed = async (page, mollieOrder, testedGateway) => { - await page.goto('/wp-admin/edit.php?post_type=shop_order'); - // Check order is in status processing in order page - await expect(page.locator('#post-' + mollieOrder + '> td.order_status.column-order_status > mark > span')).toContainText("Pending payment"); - 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(testedGateway.id + ' payment started'); -} -export const wooOrderDetailsPageOnCanceled = async (page, mollieOrder, testedGateway) => { +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("Cancelled"); + 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(testedGateway.id + ' payment started'); + 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 index 3e784ef83..2c7134459 100644 --- a/tests/e2e/Shared/wooUtils.js +++ b/tests/e2e/Shared/wooUtils.js @@ -1,27 +1,73 @@ +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 testedProductName + * @param productSku */ -const addProductToCart = async (page, testedProductName) => { - // Go to shop +const addProductToCart = async (page, productSku) => { await page.goto('/shop/'); - // Add product to cart - await page.locator('[data-product_sku="' + testedProductName + '"]').click() + 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) => { +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.locator('input[name="billing_company"]').fill('My company name'); - await page.selectOption('select#billing_country', 'DE'); + 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'); + }*/ } /** @@ -34,4 +80,73 @@ const fillCustomerInBlockCheckout = async (page) => { await page.locator('input[name="billing_last_name"]').fill('Callas'); } -module.exports = {addProductToCart, fillCustomerInCheckout, fillCustomerInBlockCheckout} +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 index fdcec2c9a..ae8e4a110 100644 --- a/tests/e2e/Shared/wpUtils.js +++ b/tests/e2e/Shared/wpUtils.js @@ -1,5 +1,17 @@ -const loginAdmin = async (page)=>{ - await page.goto('/wp-login.php'); +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([ @@ -9,11 +21,57 @@ const loginAdmin = async (page)=>{ } async function deactivateWPPlugin(page, pluginName) { - await page.getByRole('link', { name: `Deactivate ${pluginName}` }).click(); + await page.getByRole('link', {name: `Deactivate ${pluginName}`, exact: true}).click(); } + async function activateWPPlugin(page, pluginName) { - await page.getByRole('link', { name: `Activate ${pluginName}` }).click(); + 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}; +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 new file mode 100644 index 000000000..c76a721c8 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_apple_pay.spec.js @@ -0,0 +1,16 @@ +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 new file mode 100644 index 000000000..a0eb0f0d0 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_bancontact.spec.js @@ -0,0 +1,80 @@ +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 new file mode 100644 index 000000000..4d7814b8f --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_belfius_direct_net.spec.js @@ -0,0 +1,64 @@ +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 new file mode 100644 index 000000000..3e86a4d81 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_billie.spec.js @@ -0,0 +1,34 @@ +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 new file mode 100644 index 000000000..35fc84406 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_credit_card.spec.js @@ -0,0 +1,115 @@ +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 new file mode 100644 index 000000000..c46457571 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_eps.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..ecf6f1728 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_gift_cards.spec.js @@ -0,0 +1,22 @@ +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 new file mode 100644 index 000000000..dc3a755ab --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_giropay.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..d2186955f --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_ideal.spec.js @@ -0,0 +1,72 @@ +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 new file mode 100644 index 000000000..f570dd480 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_in3.spec.js @@ -0,0 +1,34 @@ +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 new file mode 100644 index 000000000..9b13555e4 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_kbc_cbc_payment_button.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..2b4e5e130 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_later.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..e7f4b4fa4 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_pay_now.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..a5a2e4767 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_klarna_slice_it.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..d45a4042a --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_mybank.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..b3f2ba45a --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paypal.spec.js @@ -0,0 +1,72 @@ +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 new file mode 100644 index 000000000..ad41092c4 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_paysafecard.spec.js @@ -0,0 +1,54 @@ +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 new file mode 100644 index 000000000..f5e6d8e3e --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_przelewy24.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..f64059ebc --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sepa_bank_transfer.spec.js @@ -0,0 +1,54 @@ +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 new file mode 100644 index 000000000..a9c61ea2f --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_sofort_banking.spec.js @@ -0,0 +1,54 @@ +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 new file mode 100644 index 000000000..77092ecac --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Block Checkout/_transaction_scenarios_payment_statuses_-_block_checkout_voucher.spec.js @@ -0,0 +1,40 @@ +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 new file mode 100644 index 000000000..9f9b7cb4e --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_apple_pay.spec.js @@ -0,0 +1,22 @@ +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 new file mode 100644 index 000000000..5c4346479 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_bancontact.spec.js @@ -0,0 +1,90 @@ +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 new file mode 100644 index 000000000..434eaca83 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_belfius_direct_net.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..18b9bc73d --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_billie.spec.js @@ -0,0 +1,61 @@ +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 new file mode 100644 index 000000000..2da03bc9d --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_credit_card.spec.js @@ -0,0 +1,116 @@ +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 new file mode 100644 index 000000000..ad2f2a1f1 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_eps.spec.js @@ -0,0 +1,64 @@ +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 new file mode 100644 index 000000000..416490ba7 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_gift_cards.spec.js @@ -0,0 +1,22 @@ +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 new file mode 100644 index 000000000..ceb4438a2 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_giropay.spec.js @@ -0,0 +1,64 @@ +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 new file mode 100644 index 000000000..b4450a425 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_ideal.spec.js @@ -0,0 +1,73 @@ +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 new file mode 100644 index 000000000..a9de259b4 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_in3.spec.js @@ -0,0 +1,64 @@ +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 new file mode 100644 index 000000000..3a03dd8c5 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_kbc_cbc_payment_button.spec.js @@ -0,0 +1,64 @@ +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 new file mode 100644 index 000000000..b219bdc6a --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_later.spec.js @@ -0,0 +1,62 @@ +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 new file mode 100644 index 000000000..542a70ea2 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_pay_now.spec.js @@ -0,0 +1,62 @@ +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 new file mode 100644 index 000000000..fa8f1cd87 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_klarna_slice_it.spec.js @@ -0,0 +1,62 @@ +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 new file mode 100644 index 000000000..1867d1720 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_mybank.spec.js @@ -0,0 +1,64 @@ +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 new file mode 100644 index 000000000..20e67553d --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paypal.spec.js @@ -0,0 +1,73 @@ +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 new file mode 100644 index 000000000..3b0f29d57 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_paysafecard.spec.js @@ -0,0 +1,55 @@ +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 new file mode 100644 index 000000000..77d7cc155 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_przelewy24.spec.js @@ -0,0 +1,63 @@ +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 new file mode 100644 index 000000000..2cda88823 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sepa_bank_transfer.spec.js @@ -0,0 +1,54 @@ +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 new file mode 100644 index 000000000..5676df863 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_sofort_banking.spec.js @@ -0,0 +1,54 @@ +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 new file mode 100644 index 000000000..d892c1774 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Checkout/_transaction_scenarios_payment_statuses_checkout_voucher.spec.js @@ -0,0 +1,40 @@ +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 new file mode 100644 index 000000000..8c0379656 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_apple_pay.spec.js @@ -0,0 +1,16 @@ +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 new file mode 100644 index 000000000..1ac6aec5c --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_bancontact.spec.js @@ -0,0 +1,87 @@ +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 new file mode 100644 index 000000000..b2c6ac8b3 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_belfius_direct_net.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..d448b89da --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_billie.spec.js @@ -0,0 +1,34 @@ +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 new file mode 100644 index 000000000..f293a1ce7 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_credit_card.spec.js @@ -0,0 +1,76 @@ +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 new file mode 100644 index 000000000..c1f0de617 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_eps.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..f376fb5a2 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_gift_cards.spec.js @@ -0,0 +1,22 @@ +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 new file mode 100644 index 000000000..ad047d5a1 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_giropay.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..3387cd99d --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_ideal.spec.js @@ -0,0 +1,79 @@ +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 new file mode 100644 index 000000000..bf2b4fac5 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_in3.spec.js @@ -0,0 +1,34 @@ +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 new file mode 100644 index 000000000..214d90881 --- /dev/null +++ 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 @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..e68aed768 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_later.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..ec1b143d7 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_pay_now.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..dab23113c --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_klarna_slice_it.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..9205aa0c2 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_mybank.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..0c73b44a6 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paypal.spec.js @@ -0,0 +1,78 @@ +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 new file mode 100644 index 000000000..7e08d6dc2 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_paysafecard.spec.js @@ -0,0 +1,60 @@ +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 new file mode 100644 index 000000000..f76e7f5d3 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_przelewy24.spec.js @@ -0,0 +1,69 @@ +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 new file mode 100644 index 000000000..695883d3c --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sepa_bank_transfer.spec.js @@ -0,0 +1,60 @@ +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 new file mode 100644 index 000000000..3bfdd8795 --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_sofort_banking.spec.js @@ -0,0 +1,60 @@ +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 new file mode 100644 index 000000000..6982b3d5d --- /dev/null +++ b/tests/e2e/Transaction Scenarios/Payment statuses - Pay for order page/_transaction_scenarios_payment_statuses_-_pay_for_order_page_voucher.spec.js @@ -0,0 +1,40 @@ +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/Transaction/Checkout.block.spec.js b/tests/e2e/Transaction/Checkout.block.spec.js deleted file mode 100644 index 0aa737d50..000000000 --- a/tests/e2e/Transaction/Checkout.block.spec.js +++ /dev/null @@ -1,169 +0,0 @@ -// @ts-check -const {test} = require('../Shared/base-test'); -const {setOrderAPI, setPaymentAPI, markStatusInMollie, resetSettings, insertAPIKeys} = require('../Shared/mollieUtils'); -const { - wooOrderPaidPage, wooOrderDetailsPageOnPaid, wooOrderRetryPage, wooOrderDetailsPageOnFailed, - wooOrderCanceledPage, - wooOrderDetailsPageOnCanceled -} = require('../Shared/testMollieInWooPage'); -const {addProductToCart, fillCustomerInBlockCheckout} = require('../Shared/wooUtils'); -const {sharedUrl: {mollieSettingsTab}} = require('../Shared/sharedUrl'); - -/** - * @param {import('@playwright/test').Page} page - * @param testedProduct - * @param testedGateway - */ -async function beforePlacingOrder(page, testedProduct, testedGateway) { - await addProductToCart(page, testedProduct.name); - await page.goto('/checkout/'); - - //Capture WooCommerce total amount - const totalAmount = await page.innerText('.order-total > td > strong > span > bdi'); - - // CUSTOMER DETAILS - await fillCustomerInBlockCheckout(page); - - // Check testedGateway option NO ISSUERS DROPDOWN - - await page.locator(`text=${testedGateway.defaultTitle}`).click(); - // 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 - */ -async function blockCheckoutPaidTransaction(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Paid"); - - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderPaidPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnPaid(page, mollieOrder, testedGateway); -} - -async function blockCheckoutFailedTransaction(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Failed"); - - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderRetryPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnFailed(page, mollieOrder, testedGateway); -} - -async function blockCheckoutCancelledTransactionPending(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Canceled"); - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderRetryPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnFailed(page, mollieOrder, testedGateway); -} - -async function blockCheckoutCancelledTransactionCancelled(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Canceled"); - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderCanceledPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnCanceled(page, mollieOrder, testedGateway); -} - -test.describe('Transaction in block checkout', () => { - test.beforeAll(async ({browser, baseURL}) => { - const page = await browser.newPage({ baseURL: baseURL, extraHTTPHeaders: {'ngrok-skip-browser-warning': '123'}}); - await resetSettings(page); - await insertAPIKeys(page); - }); - test('Transaction block with Order API paid', async ({page, products, gateways}) => { - await setOrderAPI(page); - for (const gateway in gateways) { - for (const product in products) { - await blockCheckoutPaidTransaction(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction block with Order API failed', async ({page, products, gateways}) => { - for (const gateway in gateways) { - for (const product in products) { - await blockCheckoutFailedTransaction(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction block with Order API cancelled setting as pending', async ({page, products, gateways}) => { - //setting as pending - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_order_status_cancelled_payments', 'pending'); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - for (const gateway in gateways) { - for (const product in products) { - await blockCheckoutCancelledTransactionPending(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction block with Payment API paid', async ({page, products, gateways}) => { - //Set Payment API - await setPaymentAPI(page); - for (const gateway in gateways) { - for (const product in products) { - await blockCheckoutPaidTransaction(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction block with Payment API cancelled setting as pending', async ({page, products, gateways}) => { - //setting as pending - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_order_status_cancelled_payments', 'pending'); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - for (const gateway in gateways) { - for (const product in products) { - await blockCheckoutCancelledTransactionPending(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction block with Payment API cancelled setting as cancelled', async ({page, products, gateways}) => { - //setting as cancelled - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_order_status_cancelled_payments', 'cancelled'); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - for (const gateway in gateways) { - for (const product in products) { - await blockCheckoutCancelledTransactionCancelled(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); -}); diff --git a/tests/e2e/Transaction/Checkout.classic.spec.js b/tests/e2e/Transaction/Checkout.classic.spec.js deleted file mode 100644 index 7d01a4232..000000000 --- a/tests/e2e/Transaction/Checkout.classic.spec.js +++ /dev/null @@ -1,218 +0,0 @@ -// @ts-check -const {expect} = require('@playwright/test'); -const {test} = require('../Shared/base-test'); -const {setOrderAPI, setPaymentAPI, markStatusInMollie, insertAPIKeys, resetSettings} = require('../Shared/mollieUtils'); -const {wooOrderPaidPage, wooOrderDetailsPageOnPaid, wooOrderRetryPage, wooOrderDetailsPageOnFailed, wooOrderCanceledPage, wooOrderDetailsPageOnCanceled} = require('../Shared/testMollieInWooPage'); -const {addProductToCart, fillCustomerInCheckout} = require('../Shared/wooUtils'); -const {sharedUrl: {mollieSettingsTab}} = require('../Shared/sharedUrl'); - -/** - * @param {import('@playwright/test').Page} page - * @param testedProduct - * @param testedGateway - */ -async function beforePlacingOrder(page, testedProduct, testedGateway) { - await addProductToCart(page, testedProduct.name); - await page.goto('/checkout/'); - - //Capture WooCommerce total amount - const totalAmount = await page.innerText('.order-total > td > strong > span > bdi'); - - // CUSTOMER DETAILS - await fillCustomerInCheckout(page); - - // Check testedGateway option NO ISSUERS DROPDOWN - await page.locator(`text=${testedGateway.defaultTitle}`).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 - */ -async function classicCheckoutPaidTransaction(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Paid"); - - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderPaidPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnPaid(page, mollieOrder, testedGateway); -} - -async function classicCheckoutFailedTransaction(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Failed"); - - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderRetryPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnFailed(page, mollieOrder, testedGateway); -} - -async function classicCheckoutCancelledTransactionPending(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Canceled"); - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderRetryPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnFailed(page, mollieOrder, testedGateway); -} - -async function classicCheckoutCancelledTransactionCancelled(page, testedProduct, testedGateway) { - const totalAmount = await beforePlacingOrder(page, testedProduct, testedGateway); - - // IN MOLLIE - // Capture order number in Mollie and mark as paid - const mollieOrder = await markStatusInMollie(page, "Canceled"); - // WOOCOMMERCE ORDER PAID PAGE - await wooOrderCanceledPage(page, mollieOrder, totalAmount, testedGateway); - - // WOOCOMMERCE ORDER PAGE - await wooOrderDetailsPageOnCanceled(page, mollieOrder, testedGateway); -} - -async function classicCheckoutPaidTransactionFullRefund(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"); -} - -async function classicCheckoutPaidTransactionPartialRefund(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(); -} -test.describe.configure({ mode: 'serial' }); -test.describe('Transaction in classic checkout', () => { - const failedGateways = ['ideal', 'paypal', 'creditcard']; - test('Transaction classic with Order API paid', async ({page, products, gateways}) => { - await setOrderAPI(page); - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutPaidTransaction(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic with Order API cancelled setting as pending', async ({page, products, gateways}) => { - //setting as pending - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_order_status_cancelled_payments', 'pending'); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutCancelledTransactionPending(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic with Order API failed setting pending', async ({page, products, gateways}) => { - //only the gateways that support failed transactions in testing - for (const gateway in gateways) { - if (failedGateways.includes(gateways[gateway].id)) { - for (const product in products) { - await classicCheckoutFailedTransaction(page, products[product], gateways[gateway]); - }// end loop products - } - }// end loop gateways - }); - test('Transaction classic full refund Order', async ({page, products, gateways}) => { - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutPaidTransactionFullRefund(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic partial refund Order', async ({page, products, gateways}) => { - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutPaidTransactionPartialRefund(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic with Payment API paid', async ({page, products, gateways}) => { - //Set Payment API - await setPaymentAPI(page); - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutPaidTransaction(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic with Payment API cancelled setting as pending', async ({page, products, gateways}) => { - //setting as pending - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_order_status_cancelled_payments', 'pending'); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutCancelledTransactionPending(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic with Payment API cancelled setting as cancelled', async ({page, products, gateways}) => { - //setting as cancelled - await page.goto(mollieSettingsTab + '§ion=advanced'); - await page.selectOption('select#mollie-payments-for-woocommerce_order_status_cancelled_payments', 'cancelled'); - await Promise.all([ - page.waitForNavigation(), - page.locator('text=Save changes').click() - ]); - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutCancelledTransactionCancelled(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic full refund Payment', async ({page, products, gateways}) => { - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutPaidTransactionFullRefund(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); - test('Transaction classic partial refund Payment', async ({page, products, gateways}) => { - for (const gateway in gateways) { - for (const product in products) { - await classicCheckoutPaidTransactionPartialRefund(page, products[product], gateways[gateway]); - }// end loop products - }// end loop gateways - }); -}); diff --git a/tests/e2e/WooCommerce Payments tab/_woocommerce_payments_tab.spec.js b/tests/e2e/WooCommerce Payments tab/_woocommerce_payments_tab.spec.js new file mode 100644 index 000000000..7966c9c00 --- /dev/null +++ b/tests/e2e/WooCommerce Payments tab/_woocommerce_payments_tab.spec.js @@ -0,0 +1,43 @@ +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 new file mode 100644 index 000000000..5148a8dd9 --- /dev/null +++ b/tests/e2e/globalSetup.js @@ -0,0 +1,12 @@ +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 new file mode 100644 index 000000000..3ce25599a --- /dev/null +++ b/tests/e2e/methodsConfig.json @@ -0,0 +1,340 @@ +{ + "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/php/Functional/HelperMocks.php b/tests/php/Functional/HelperMocks.php index cc7cd49e4..9ea1a44ac 100644 --- a/tests/php/Functional/HelperMocks.php +++ b/tests/php/Functional/HelperMocks.php @@ -204,7 +204,7 @@ public function paymentMethodBuilder($paymentMethodName, $isSepa = false, $isSub { $paymentMethod = $this->createPartialMock( Ideal::class, - ['getConfig', 'getInitialOrderStatus', 'getMergedProperties', 'getSettings'] + ['getConfig', 'getInitialOrderStatus', 'getMergedProperties', 'getSettings', 'title'] ); $paymentMethod ->method('getConfig') @@ -217,6 +217,9 @@ public function paymentMethodBuilder($paymentMethodName, $isSepa = false, $isSub $paymentMethod ->method('getMergedProperties') ->willReturn($this->paymentMethodMergedProperties($paymentMethodName, $isSepa, $isSubscription, $settings)); + $paymentMethod + ->method('title') + ->willReturn($paymentMethodName); return $paymentMethod; } diff --git a/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php b/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php index e859db7bd..44557a866 100644 --- a/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php +++ b/tests/php/Functional/PayPalButton/DataToPayPalButtonScriptsTest.php @@ -42,7 +42,8 @@ public function testPayPalScriptDataOnProduct() 'id' => $postDummyData->productId, 'price' => '1', 'isVariation' => false, - 'minFee' =>$minAmount + 'minFee' =>$minAmount, + 'stock' => null ], 'ajaxUrl' => 'admin-ajax.php' ]; diff --git a/tests/php/Functional/Payment/PaymentServiceTest.php b/tests/php/Functional/Payment/PaymentServiceTest.php index 1862c70cb..2326d4d63 100644 --- a/tests/php/Functional/Payment/PaymentServiceTest.php +++ b/tests/php/Functional/Payment/PaymentServiceTest.php @@ -114,6 +114,9 @@ public function processPayment_Order_success(){ $wcOrder->expects($this->any()) ->method('get_billing_company') ->willReturn(''); + $wcOrder->expects($this->any()) + ->method('get_billing_phone') + ->willReturn('+1234567890'); /* * Execute Test */ @@ -162,6 +165,7 @@ private function wcOrder($id, $orderKey) 'get_billing_city' => 'billingcity', 'get_billing_state' => 'billingregion', 'get_billing_country' => 'billingcountry', + 'get_billing_phone' => '+1234567890', 'get_shipping_address_1' => 'shippingstreetAndNumber', 'get_shipping_address_2' => 'shippingstreetAdditional', 'get_shipping_postcode' => 'shippingpostalCode', @@ -380,6 +384,7 @@ protected function billingAddress($order){ $billingAddress->region = $order->get_billing_state(); $billingAddress->country = $order->get_billing_country(); $billingAddress->organizationName = $order->get_billing_company(); + $billingAddress->phone = $order->get_billing_phone(); return $billingAddress; } diff --git a/tests/php/Functional/PaymentMethod/PaymentMethodTest.php b/tests/php/Functional/PaymentMethod/PaymentMethodTest.php index 4e69fe384..5538073d3 100644 --- a/tests/php/Functional/PaymentMethod/PaymentMethodTest.php +++ b/tests/php/Functional/PaymentMethod/PaymentMethodTest.php @@ -160,7 +160,7 @@ public function paymentMethodBuilder($paymentMethodName, $testSettings = []) $paymentMethod = $this->buildTesteeMock( Creditcard::class, - [$iconFactory, $settingsHelper, $paymentFieldsService, $surchargeService], + [$iconFactory, $settingsHelper, $paymentFieldsService, $surchargeService, []], ['getConfig', 'getSettings', 'getInitialOrderStatus', 'getIdFromConfig'] )->getMock(); diff --git a/tests/php/Stubs/woocommerce.php b/tests/php/Stubs/woocommerce.php index 13a2d4cd9..b4be89788 100644 --- a/tests/php/Stubs/woocommerce.php +++ b/tests/php/Stubs/woocommerce.php @@ -175,6 +175,9 @@ public function update_status() public function get_billing_company() { } + public function get_billing_phone() + { + } } class WC_Cart { diff --git a/webpack.config.js b/webpack.config.js index e2238b8c7..f86e58715 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -30,6 +30,7 @@ function configJavaScript ({ basePath }) .addEntry('paypalButtonBlockComponent.min', './resources/js/paypalButtonBlockComponent.js') .addEntry('applepayButtonBlockComponent.min', './resources/js/applepayButtonBlockComponent.js') .addEntry('mollieBillie.min', './resources/js/mollieBillie.js') + .addEntry('mollieIn3.min', './resources/js/mollieIn3.js') .enableSourceMaps(!Encore.isProduction()) return extractEncoreConfig('javascript-configuration')