Skip to content

Commit 2034958

Browse files
committed
MAGETWO-91628: Bundle product price doubled when switching currency
- Add automation test
1 parent ea91685 commit 2034958

File tree

5 files changed

+132
-1
lines changed

5 files changed

+132
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StoreFrontAddProductToCartFromBundleWithCurrencyActionGroup">
12+
<arguments>
13+
<argument name="product"/>
14+
<argument name="currency" type="string" defaultValue="US Dollar"/>
15+
</arguments>
16+
<click selector="{{StorefrontBundledSection.currencyTrigger}}" stepKey="openCurrencyTrigger"/>
17+
<click selector="{{StorefrontBundledSection.currency(currency)}}" stepKey="chooseCurrency"/>
18+
<click selector="{{StorefrontBundledSection.addToCart}}" stepKey="clickCustomize"/>
19+
<waitForPageLoad stepKey="waitForBundleOpen"/>
20+
<checkOption selector="{{StorefrontBundledSection.productInBundle(product.name)}}" stepKey="chooseProduct"/>
21+
<click selector="{{StorefrontBundledSection.addToCartConfigured}}" stepKey="addToCartProduct"/>
22+
<scrollToTopOfPage stepKey="scrollToTop"/>
23+
</actionGroup>
24+
</actionGroups>

app/code/Magento/Bundle/Test/Mftf/Section/StorefrontBundledSection.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88

99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="../../../../../../../dev/tests/acceptance/vendor/magento/magento2-functional-testing-framework/src/Magento/FunctionalTestingFramework/Page/etc/SectionObject.xsd">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="StorefrontBundledSection">
1212
<element name="nthBundledOption" type="input" selector=".option:nth-of-type({{numOption}}) .choice:nth-of-type({{numOptionSelect}}) input" parameterized="true"/>
1313
<element name="addToCart" type="button" selector="#bundle-slide" timeout="30"/>
@@ -24,10 +24,13 @@
2424
<element name="bundleProductName" type="text" selector="//*[@id='maincontent']//span[@itemprop='name']"/>
2525
<element name="pageNotFound" type="text" selector="//h1[@class='page-title']//span[contains(., 'Whoops, our bad...')]"/>
2626
<element name="dropDownOptionOneProducts" type="select" selector="//label//span[contains(text(), '{{productName}}')]/../..//div[@class='control']//select" parameterized="true"/>
27+
<element name="productInBundle" type="select" selector="//label//span[contains(text(), '{{productName}}')]" parameterized="true"/>
2728
<element name="dropDownOptionOneQuantity" type="input" selector="//span[contains(text(), '{{productName}}')]/../..//input" parameterized="true"/>
2829
<element name="radioButtonOptionTwoProducts" type="checkbox" selector="//label//span[contains(text(), '{{productName}}')]/../..//div[@class='control']//div[@class='field choice'][{{productNumber}}]/input" parameterized="true"/>
2930
<element name="radioButtonOptionTwoQuantity" type="input" selector="//label//span[contains(text(), '{{productName}}')]/../..//div[@class='control']//div[@class='field qty qty-holder']//input" parameterized="true"/>
3031
<element name="checkboxOptionThreeProducts" type="checkbox" selector="//label//span[contains(text(), '{{productName}}')]/../..//div[@class='control']//div[@class='field choice'][{{productNumber}}]/input" parameterized="true"/>
3132
<element name="multiselectOptionFourProducts" type="multiselect" selector="//label//span[contains(text(), '{{productName}}')]/../..//select[@multiple='multiple']" parameterized="true"/>
33+
<element name="currencyTrigger" type="select" selector="#switcher-currency-trigger" timeout="30"/>
34+
<element name="currency" type="select" selector="//a[text()='{{arg}}']" parameterized="true"/>
3235
</section>
3336
</sections>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="CurrencyChangingBundleProductInCartTest">
11+
<annotations>
12+
<features value="Bundle"/>
13+
<stories value="Check that after changing currency price of cart is correct when the bundle product added to the cart"/>
14+
<title value="User should be able change the currency and get right price in cart when the bundle product added to the cart"/>
15+
<description value="User should be able change the currency and add one more product in cart and get right price in previous currency"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-94467"/>
18+
<group value="Bundle"/>
19+
</annotations>
20+
<before>
21+
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
22+
<createData entity="SimpleProduct2" stepKey="simpleProduct1"/>
23+
<createData entity="SimpleProduct2" stepKey="simpleProduct2"/>
24+
</before>
25+
<after>
26+
<!-- Delete the bundled product -->
27+
<actionGroup stepKey="deleteBundle" ref="deleteProductUsingProductGrid">
28+
<argument name="product" value="BundleProduct"/>
29+
</actionGroup>
30+
<actionGroup ref="AdminClearFiltersActionGroup" stepKey="ClearFiltersAfter"/>
31+
<!--Clear Configs-->
32+
<amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/>
33+
<waitForPageLoad stepKey="waitForAdminLoginPageLoad"/>
34+
<amOnPage url="{{ConfigCurrencySetupPage.url}}" stepKey="navigateToConfigCurrencySetupPage"/>
35+
<waitForPageLoad stepKey="waitForConfigCurrencySetupPageForUnselectEuroCurrency"/>
36+
<unselectOption selector="{{CurrencySetupSection.allowCurrencies}}" userInput="Euro" stepKey="unselectEuro"/>
37+
<click stepKey="saveUnselectedConfigs" selector="{{AdminConfigSection.saveButton}}"/>
38+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="logout"/>
39+
<deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/>
40+
<deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/>
41+
</after>
42+
<!--Go to bundle product creation page-->
43+
<amOnPage url="{{AdminProductCreatePage.url(BundleProduct.set, BundleProduct.type)}}" stepKey="goToBundleProductCreationPage"/>
44+
<waitForPageLoad stepKey="waitForBundleProductCreatePageToLoad"/>
45+
<actionGroup ref="fillMainBundleProductForm" stepKey="fillMainFieldsForBundle"/>
46+
<!-- Add Option, a "Radio Buttons" type option -->
47+
<actionGroup ref="addBundleOptionWithTwoProducts" stepKey="addBundleOptionWithTwoProducts2">
48+
<argument name="x" value="0"/>
49+
<argument name="n" value="1"/>
50+
<argument name="prodOneSku" value="$$simpleProduct1.sku$$"/>
51+
<argument name="prodTwoSku" value="$$simpleProduct2.sku$$"/>
52+
<argument name="optionTitle" value="Option"/>
53+
<argument name="inputType" value="radio"/>
54+
</actionGroup>
55+
<checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '0')}}" stepKey="userDefinedQuantitiyOptionProduct0"/>
56+
<checkOption selector="{{AdminProductFormBundleSection.userDefinedQuantity('0', '1')}}" stepKey="userDefinedQuantitiyOptionProduct1"/>
57+
<actionGroup ref="saveProductForm" stepKey="saveProduct"/>
58+
<amOnPage url="{{ConfigCurrencySetupPage.url}}" stepKey="navigateToConfigCurrencySetupPage"/>
59+
<waitForPageLoad stepKey="waitForConfigCurrencySetupPage"/>
60+
<selectOption selector="{{CurrencySetupSection.allowCurrencies}}" parameterArray="['Euro', 'US Dollar']" stepKey="selectCurrencies"/>
61+
<click stepKey="saveConfigs" selector="{{AdminConfigSection.saveButton}}"/>
62+
<!-- Go to storefront BundleProduct -->
63+
<amOnPage url="{{BundleProduct.sku}}.html" stepKey="goToStorefront"/>
64+
<waitForPageLoad stepKey="waitForStorefront"/>
65+
<actionGroup ref="StoreFrontAddProductToCartFromBundleWithCurrencyActionGroup" stepKey="addProduct1ToCartAndChangeCurrencyToEuro">
66+
<argument name="product" value="$$simpleProduct1$$"/>
67+
<argument name="currency" value="EUR - Euro"/>
68+
</actionGroup>
69+
<actionGroup ref="StoreFrontAddProductToCartFromBundleWithCurrencyActionGroup" stepKey="addProduct2ToCartAndChangeCurrencyToUSD">
70+
<argument name="product" value="$$simpleProduct2$$"/>
71+
<argument name="currency" value="USD - US Dollar"/>
72+
</actionGroup>
73+
<click stepKey="openMiniCart" selector="{{StorefrontMinicartSection.showCart}}"/>
74+
<waitForPageLoad stepKey="waitForMiniCart"/>
75+
<see stepKey="seeCartSubtotal" userInput="$12,300.00"/>
76+
</test>
77+
</tests>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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+
9+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
11+
<page name="ConfigCurrencySetupPage" url="admin/system_config/edit/section/currency" area="admin" module="Magento_Config">
12+
</page>
13+
</pages>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
9+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="CurrencySetupSection">
12+
<element name="allowCurrencies" type="select" selector="#currency_options_allow"/>
13+
</section>
14+
</sections>

0 commit comments

Comments
 (0)