Skip to content

Commit

Permalink
ci: Connect the default shipping method to PayPal payment method
Browse files Browse the repository at this point in the history
This should prevent that the cart amount is changed on the confirm page, which is not expected to happen in the E2E scenarios
  • Loading branch information
mitelg committed Aug 29, 2023
1 parent 4f1af1f commit 59abc00
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Tests/E2E/helper/connectDefaultShippingMethodWithPayPalHelper.mjs
Original file line number Diff line number Diff line change
@@ -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();
});
});
}
};
}());
Original file line number Diff line number Diff line change
@@ -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`;
2 changes: 2 additions & 0 deletions Tests/E2E/test/pay_with_express.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();
});

Expand Down

0 comments on commit 59abc00

Please sign in to comment.