diff --git a/Tests/E2E/helper/connectDefaultShippingMethodWithPayPalHelper.mjs b/Tests/E2E/helper/connectDefaultShippingMethodWithPayPalHelper.mjs new file mode 100644 index 00000000..f2b13026 --- /dev/null +++ b/Tests/E2E/helper/connectDefaultShippingMethodWithPayPalHelper.mjs @@ -0,0 +1,21 @@ +import MysqlFactory from './mysqlFactory.mjs'; +import fs from 'fs'; +import path from 'path'; + +const connectDefaultShippingMethodWithPayPalSql = fs.readFileSync(path.join(path.resolve(''), 'setup/sql/connect_default_shipping_method_with_paypal.sql'), 'utf8'); +const connection = MysqlFactory.getInstance(); + +export default (function() { + return { + connectDefaultShippingMethodWithPayPal: async function() { + await new Promise((resolve, reject) => { + connection.query(connectDefaultShippingMethodWithPayPalSql, function(err) { + if (err) { + reject(err); + } + resolve(); + }); + }); + } + }; +}()); diff --git a/Tests/E2E/setup/sql/connect_default_shipping_method_with_paypal.sql b/Tests/E2E/setup/sql/connect_default_shipping_method_with_paypal.sql new file mode 100644 index 00000000..e643057c --- /dev/null +++ b/Tests/E2E/setup/sql/connect_default_shipping_method_with_paypal.sql @@ -0,0 +1,5 @@ +SET @shippingMethodId = (SELECT id FROM `s_premium_dispatch` WHERE name='Standard Versand'); +SET @paymentMethodId = (SELECT id FROM `s_core_paymentmeans` WHERE name='SwagPaymentPayPalUnified'); + +INSERT INTO `s_premium_dispatch_paymentmeans`(`dispatchID`, `paymentID`) VALUES (@shippingMethodId, @paymentMethodId) +ON DUPLICATE KEY UPDATE `dispatchID` = `dispatchID`, `paymentID` = `paymentID`; diff --git a/Tests/E2E/test/pay_with_express.spec.mjs b/Tests/E2E/test/pay_with_express.spec.mjs index 057eb886..ea8f1f94 100644 --- a/Tests/E2E/test/pay_with_express.spec.mjs +++ b/Tests/E2E/test/pay_with_express.spec.mjs @@ -2,6 +2,7 @@ import { test, expect } from '@playwright/test'; import MysqlFactory from '../helper/mysqlFactory.mjs'; import defaultPaypalSettingsSql from '../helper/paypalSqlHelper.mjs'; import clearCacheHelper from '../helper/clearCacheHelper.mjs'; +import connector from '../helper/connectDefaultShippingMethodWithPayPalHelper.mjs'; import credentials from './credentials.mjs'; import leadingZeroProductSql from '../helper/updateProductNumberAddLeadingZero.mjs'; import tryUntilSucceed from '../helper/retryHelper.mjs'; @@ -11,6 +12,7 @@ const connection = MysqlFactory.getInstance(); test.describe('Is Express Checkout button available', () => { test.beforeEach(async() => { await connection.query(defaultPaypalSettingsSql); + await connector.connectDefaultShippingMethodWithPayPal(); await clearCacheHelper.clearCache(); });