Skip to content

Commit ef8edde

Browse files
Merge branch 'bugfix/allow-multiple-add-to-carts' into release-week-27
2 parents 8a4c7bf + 616252e commit ef8edde

File tree

5 files changed

+44
-1
lines changed

5 files changed

+44
-1
lines changed

.github/workflows/templates/magento/configure-mollie.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ bin/magento config:set payment/mollie_methods_twint/active 1
4646
# Enable Components
4747
bin/magento config:set payment/mollie_methods_creditcard/use_components 1
4848

49+
# Set a default payment method
50+
bin/magento config:set payment/mollie_general/default_selected_method mollie_methods_ideal
51+
4952
# Disable webhooks
5053
bin/magento config:set payment/mollie_general/use_webhooks custom_url
5154

@@ -60,6 +63,10 @@ bin/magento config:set payment/mollie_general/currency 0 --scope=ch --scope-code
6063
bin/magento config:set currency/options/default PLN --scope=pl --scope-code=ch
6164
bin/magento config:set payment/mollie_general/currency 0 --scope=pl --scope-code=ch
6265

66+
# Disable flat catalog
67+
bin/magento config:set catalog/frontend/flat_catalog_category 0
68+
bin/magento config:set catalog/frontend/flat_catalog_product 0
69+
6370
# Disable the use of the base currency
6471
bin/magento config:set payment/mollie_general/currency 0
6572

src/Mollie_HyvaCheckout/Observer/SalesQuoteCollectTotalsBefore/SetDefaultSelectedPaymentMethod.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\App\Config\ScopeConfigInterface;
1414
use Magento\Framework\Event\Observer;
1515
use Magento\Framework\Event\ObserverInterface;
16+
use Magento\Framework\Exception\State\InvalidTransitionException;
1617
use Magento\Quote\Api\Data\PaymentInterfaceFactory;
1718
use Magento\Quote\Api\PaymentMethodManagementInterface;
1819
use Magento\Quote\Model\Quote;
@@ -78,7 +79,11 @@ public function execute(Observer $observer): void
7879
$payment->setMethod($defaultMethod);
7980

8081
$quote->setPayment($payment);
81-
$this->paymentMethodManagement->set($quote->getId(), $payment);
82+
try {
83+
$this->paymentMethodManagement->set($quote->getId(), $payment);
84+
} catch (InvalidTransitionException $exception) {
85+
// We are not able to set the payment method. Probably the address is not set yet.
86+
}
8287
}
8388

8489
/**

tests/End-2-End/support/pages/frontend/CheckoutPaymentPage.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export default class CheckoutPaymentPage {
1515
const methodRow = page.locator('#payment-method-list > div').filter({ hasText: name });
1616
const input = methodRow.locator('input');
1717

18+
if (await input.isChecked()) {
19+
// If the input is already checked, we can skip clicking it again
20+
return;
21+
}
22+
1823
await input.click();
1924

2025
await hyvaCheckout.waitForLoaderWithText(page, 'Saving method');

tests/End-2-End/support/pages/frontend/ProductPage.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,7 @@ export default class ProductPage {
2525
const productTitle = await page.locator('[data-ui-id="page-title-wrapper"]').innerText();
2626
await page.getByText(`You added ${productTitle} to your shopping cart.`).waitFor({ state: 'visible' });
2727
await page.locator('#menu-cart-icon span').waitFor({ state: 'visible' });
28+
29+
return productTitle;
2830
}
2931
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright Magmodules.eu. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
import { test, expect } from '@playwright/test';
7+
import ProductPage from "Pages/frontend/ProductPage";
8+
9+
const productPage = new ProductPage();
10+
11+
test('[C4251741] Can add multiple products to the cart', async ({ page }) => {
12+
await productPage.openProduct(page, 4);
13+
const product1Name = await productPage.addSimpleProductToCart(page, 1);
14+
15+
await productPage.openProduct(page, 5);
16+
const product2Name = await productPage.addSimpleProductToCart(page, 1);
17+
18+
await page.goto('/checkout/cart');
19+
20+
await expect(page.locator('#shopping-cart-table .cart.item')).toHaveCount(2);
21+
22+
await page.locator('#shopping-cart-table').getByText(product1Name).waitFor({ state: 'visible' });
23+
await page.locator('#shopping-cart-table').getByText(product2Name).waitFor({ state: 'visible' });
24+
});

0 commit comments

Comments
 (0)