Skip to content

Commit 44439c8

Browse files
committed
Merge branch '648-update-shopping-cart' of github.com:rogyar/magento-functional-tests-migration into community-tests-migration-pr
2 parents d976a2b + 52d71a5 commit 44439c8

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed

app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@
428428
<var key="sku" entityType="product" entityKey="sku" />
429429
<requiredEntity type="product_option">ProductOptionDropDownWithLongValuesTitle</requiredEntity>
430430
</entity>
431+
<entity name="ProductWithTextFieldAndAreaOptions" type="product">
432+
<var key="sku" entityType="product" entityKey="sku" />
433+
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
434+
<requiredEntity type="product_option">ProductOptionArea</requiredEntity>
435+
</entity>
431436
<entity name="ApiVirtualProductWithDescription" type="product">
432437
<data key="sku" unique="suffix">api-virtual-product</data>
433438
<data key="type_id">virtual</data>
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontUpdateShoppingCartSimpleProductQtyTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<title value="Check updating shopping cart while updating items qty"/>
15+
<description value="Check updating shopping cart while updating items qty"/>
16+
<group value="shoppingCart"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
<before>
20+
<createData entity="_defaultCategory" stepKey="createCategory"/>
21+
<createData entity="SimpleProduct" stepKey="createProduct">
22+
<requiredEntity createDataKey="createCategory"/>
23+
</createData>
24+
25+
<!-- Add the newly created product to the shopping cart -->
26+
<actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage">
27+
<argument name="product" value="$$createProduct$$"/>
28+
</actionGroup>
29+
</before>
30+
<after>
31+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
32+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
33+
</after>
34+
35+
<!-- Go to the shopping cart -->
36+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/>
37+
<waitForPageLoad stepKey="waitForCheckoutPageLoad1"/>
38+
39+
<!-- Change the product QTY -->
40+
<fillField selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" userInput="3" stepKey="changeCartQty"/>
41+
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="openShoppingCart"/>
42+
<waitForPageLoad stepKey="waitForCheckoutPageLoad2"/>
43+
44+
<!-- The price and QTY values should be updated for the product -->
45+
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabProductQtyInCart"/>
46+
<see userInput="$369" selector="{{CheckoutCartProductSection.productSubtotalByName($$createProduct.name$$)}}" stepKey="assertProductPrice"/>
47+
<assertEquals expected="3" actual="$grabProductQtyInCart" stepKey="assertProductQtyInCart"/>
48+
49+
<!-- Subtotal should be updated -->
50+
<see userInput="$369" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertCartSubtotal"/>
51+
52+
<!-- Minicart product price and subtotal should be updated -->
53+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openMinicart"/>
54+
<grabValueFrom selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="grabProductQtyInMinicart"/>
55+
<assertEquals expected="3" actual="$grabProductQtyInMinicart" stepKey="assertProductQtyInMinicart"/>
56+
<see userInput="$369" selector="{{StorefrontMinicartSection.subtotal}}" stepKey="assertMinicartSubtotal"/>
57+
</test>
58+
</tests>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest">
12+
<annotations>
13+
<features value="Checkout"/>
14+
<title value="Check updating shopping cart while updating qty of items with custom options"/>
15+
<description value="Check updating shopping cart while updating qty of items with custom options"/>
16+
<group value="shoppingCart"/>
17+
<group value="mtf_migrated"/>
18+
</annotations>
19+
<before>
20+
<createData entity="_defaultCategory" stepKey="createCategory"/>
21+
<createData entity="ApiSimpleProductWithCustomPrice" stepKey="createProduct">
22+
<requiredEntity createDataKey="createCategory"/>
23+
</createData>
24+
25+
<!-- Add two custom options to the product: field and textarea -->
26+
<updateData createDataKey="createProduct" entity="ProductWithTextFieldAndAreaOptions" stepKey="updateProductWithOption"/>
27+
28+
<!-- Go to the product page, fill the custom options values and add the product to the shopping cart -->
29+
<amOnPage url="{{StorefrontHomePage.url}}$createProduct.custom_attributes[url_key]$.html" stepKey="amOnProductPage"/>
30+
<waitForPageLoad stepKey="waitForCatalogPageLoad"/>
31+
<fillField userInput="OptionField" selector="{{StorefrontProductInfoMainSection.productOptionFieldInput(ProductOptionField.title)}}" stepKey="fillProductOptionInputField"/>
32+
<fillField userInput="OptionArea" selector="{{StorefrontProductInfoMainSection.productOptionAreaInput(ProductOptionArea.title)}}" stepKey="fillProductOptionInputArea"/>
33+
<actionGroup ref="StorefrontAddToCartCustomOptionsProductPageActionGroup" stepKey="addToCartFromStorefrontProductPage">
34+
<argument name="productName" value="$createProduct.name$"/>
35+
</actionGroup>
36+
</before>
37+
<after>
38+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
39+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
40+
</after>
41+
42+
<!-- Go to the shopping cart -->
43+
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/>
44+
<waitForPageLoad stepKey="waitForCheckoutPageLoad1"/>
45+
46+
<!-- Change the product QTY -->
47+
<fillField selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" userInput="11" stepKey="changeCartQty"/>
48+
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="openShoppingCart"/>
49+
<waitForPageLoad stepKey="waitForCheckoutPageLoad2"/>
50+
51+
<!-- The price and QTY values should be updated for the product -->
52+
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabProductQtyInCart"/>
53+
<see userInput="$1,320.00" selector="{{CheckoutCartProductSection.productSubtotalByName($$createProduct.name$$)}}" stepKey="assertProductPrice"/>
54+
<assertEquals expected="11" actual="$grabProductQtyInCart" stepKey="assertProductQtyInCart"/>
55+
<see userInput="$1,320.00" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/>
56+
57+
<!-- Minicart product price and subtotal should be updated -->
58+
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openMinicart"/>
59+
<grabValueFrom selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="grabProductQtyInMinicart"/>
60+
<assertEquals expected="11" actual="$grabProductQtyInMinicart" stepKey="assertProductQtyInMinicart"/>
61+
<see userInput="1,320.00" selector="{{StorefrontMinicartSection.subtotal}}" stepKey="assertMinicartSubtotal"/>
62+
</test>
63+
</tests>

dev/tests/functional/tests/app/Magento/Checkout/Test/TestCase/UpdateShoppingCartTest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/variations.xsd">
99
<testCase name="Magento\Checkout\Test\TestCase\UpdateShoppingCartTest" summary="Update Shopping Cart" ticketId="MAGETWO-25081">
1010
<variation name="UpdateShoppingCartTestVariation1">
11+
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
1112
<data name="tag" xsi:type="string">severity:S0</data>
1213
<data name="product/dataset" xsi:type="string">default</data>
1314
<data name="product/data/price/value" xsi:type="string">100</data>
@@ -20,6 +21,7 @@
2021
<constraint name="Magento\Checkout\Test\Constraint\AssertSubtotalInShoppingCart" />
2122
</variation>
2223
<variation name="UpdateShoppingCartTestVariation2">
24+
<data name="tag" xsi:type="string">mftf_migrated:yes</data>
2325
<data name="tag" xsi:type="string">severity:S0</data>
2426
<data name="product/dataset" xsi:type="string">with_two_custom_option</data>
2527
<data name="product/data/price/value" xsi:type="string">50</data>

0 commit comments

Comments
 (0)