Skip to content

Commit 254eb5a

Browse files
committed
MC-18963: Bundle Product Cart Pricing issue when added a special price for associated products
1 parent 63e7e0b commit 254eb5a

File tree

2 files changed

+39
-26
lines changed

2 files changed

+39
-26
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSpecialPriceBundleProductInCartTest.xml

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,27 @@
1515
<description value="Customer should not be able to add a Bundle Product to the cart when added a special price for associated products"/>
1616
<severity value="MAJOR"/>
1717
<testCaseId value="MC-19134"/>
18+
<useCaseId value="MC-18963"/>
1819
<group value="bundle"/>
1920
</annotations>
2021
<before>
2122
<createData entity="_defaultCategory" stepKey="category"/>
22-
<!-- Create simple product and add special price -->
23+
<!-- Create simple product -->
2324
<createData entity="SimpleProductWithSpecialPrice" stepKey="simpleProduct">
2425
<requiredEntity createDataKey="category"/>
2526
</createData>
27+
<!-- Create the bundle product -->
28+
<createData entity="ApiBundleProduct" stepKey="bundleProduct"/>
29+
<createData entity="RadioButtonsOption" stepKey="bundleOption">
30+
<requiredEntity createDataKey="bundleProduct"/>
31+
<field key="required">true</field>
32+
</createData>
33+
<createData entity="ApiBundleLink" stepKey="linkOptionToProduct">
34+
<requiredEntity createDataKey="bundleProduct"/>
35+
<requiredEntity createDataKey="bundleOption"/>
36+
<requiredEntity createDataKey="simpleProduct"/>
37+
</createData>
38+
<!-- Add special price to simple product -->
2639
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
2740
<amOnPage url="{{AdminProductEditPage.url($simpleProduct.id$)}}" stepKey="goToAdminProductPage"/>
2841
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPrice">
@@ -31,39 +44,22 @@
3144
<actionGroup ref="saveProductForm" stepKey="saveSimpleProduct"/>
3245
</before>
3346
<after>
47+
<deleteData createDataKey="bundleProduct" stepKey="deleteBundleProduct"/>
3448
<deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/>
3549
<deleteData createDataKey="category" stepKey="deleteCategory"/>
36-
<!-- Delete the bundled product -->
37-
<actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid">
38-
<argument name="product" value="BundleProduct"/>
39-
</actionGroup>
40-
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClearFiltersAfter"/>
4150
<actionGroup ref="logout" stepKey="logout"/>
4251
</after>
43-
<!--Go to bundle product creation page-->
44-
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage"/>
45-
<actionGroup ref="fillMainBundleProductForm" stepKey="fillMainFieldsForBundle"/>
46-
<!-- Add Option, a "Radio Buttons" type option -->
47-
<actionGroup ref="addBundleOptionWithOneProduct" stepKey="addBundleOptions">
48-
<argument name="x" value="0"/>
49-
<argument name="n" value="1"/>
50-
<argument name="prodOneSku" value="$$simpleProduct.sku$$"/>
51-
<argument name="prodTwoSku" value=""/>
52-
<argument name="optionTitle" value="Option"/>
53-
<argument name="inputType" value="radio"/>
54-
</actionGroup>
55-
<checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '0')}}" stepKey="userDefinedQuantitiyOptionProduct"/>
56-
<actionGroup ref="saveProductForm" stepKey="saveBundleProduct"/>
5752
<!-- Go to storefront BundleProduct -->
58-
<amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/>
53+
<amOnPage url="{{StorefrontProductPage.url($$bundleProduct.custom_attributes[url_key]$$)}}" stepKey="goToStorefront"/>
5954
<actionGroup ref="StorefrontAddBundleProductFromProductToCartActionGroup" stepKey="addProductToCartFirstTime">
60-
<argument name="productName" value="{{BundleProduct.name}}"/>
55+
<argument name="productName" value="$$bundleProduct.name$$"/>
6156
</actionGroup>
6257
<actionGroup ref="StorefrontAddBundleProductFromProductToCartActionGroup" stepKey="addProductToCartSecondTime">
63-
<argument name="productName" value="{{BundleProduct.name}}"/>
58+
<argument name="productName" value="$$bundleProduct.name$$"/>
59+
</actionGroup>
60+
<actionGroup ref="StorefrontClickOnMiniCartActionGroup" stepKey="openMiniCart"/>
61+
<actionGroup ref="AssertStorefrontMiniCartSubtotalActionGroup" stepKey="assertSubtotal">
62+
<argument name="subtotal" value="$180"/>
6463
</actionGroup>
65-
<click stepKey="openMiniCart" selector="{{StorefrontMinicartSection.showCart}}"/>
66-
<waitForPageLoad stepKey="waitForMiniCart"/>
67-
<see stepKey="seeCartSubtotal" userInput="$180.00"/>
6864
</test>
6965
</tests>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AssertStorefrontMiniCartSubtotalActionGroup">
11+
<arguments>
12+
<argument name="subtotal" type="string"/>
13+
</arguments>
14+
<waitForElementVisible selector="{{StorefrontMinicartSection.productSubTotal}}" stepKey="waitForSubtotal"/>
15+
<see selector="{{StorefrontMinicartSection.productSubTotal}}" userInput="{{subtotal}}" stepKey="seeSubtotal"/>
16+
</actionGroup>
17+
</actionGroups>

0 commit comments

Comments
 (0)