Skip to content

Commit 52d71a5

Browse files
committed
Refactoring
1 parent e91cff3 commit 52d71a5

File tree

5 files changed

+66
-60
lines changed

5 files changed

+66
-60
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@
386386
<var key="sku" entityType="product" entityKey="sku" />
387387
<requiredEntity type="product_option">ProductOptionDropDownWithLongValuesTitle</requiredEntity>
388388
</entity>
389-
<entity name="productWithOptions3" type="product">
389+
<entity name="ProductWithTextFieldAndAreaOptions" type="product">
390390
<var key="sku" entityType="product" entityKey="sku" />
391391
<requiredEntity type="product_option">ProductOptionField</requiredEntity>
392392
<requiredEntity type="product_option">ProductOptionArea</requiredEntity>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
<element name="ProductPriceByName" type="text"
1616
selector="//main//table[@id='shopping-cart-table']//tbody//tr[..//strong[contains(@class, 'product-item-name')]//a/text()='{{var1}}'][1]//td[contains(@class, 'price')]//span[@class='price']"
1717
parameterized="true"/>
18-
<element name="ProductSubtotalByName" type="text"
19-
selector="//main//table[@id='shopping-cart-table']//tbody//tr[..//strong[contains(@class, 'product-item-name')]//a/text()='{{var1}}'][1]//td[contains(@class, 'subtotal')]//span[@class='price']"
20-
parameterized="true"/>
2118
<element name="ProductImageByName" type="text"
2219
selector="//main//table[@id='shopping-cart-table']//tbody//tr//img[contains(@class, 'product-image-photo') and @alt='{{var1}}']"
2320
parameterized="true"/>
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>

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartTest.xml renamed to app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest.xml

Lines changed: 5 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -7,58 +7,8 @@
77
-->
88

99
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11-
<test name="UpdateShoppingCartTestVariation1">
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-
<field key="price">100</field>
24-
</createData>
25-
26-
<!-- Add the newly created product to the shopping cart -->
27-
<amOnPage url="$$createProduct.custom_attributes[url_key]$$.html" stepKey="navigateToSimpleProductPage"/>
28-
<waitForPageLoad stepKey="waitForCatalogPageLoad1"/>
29-
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage1">
30-
<argument name="productName" value="$$createProduct.name$$"/>
31-
</actionGroup>
32-
</before>
33-
<after>
34-
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
35-
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36-
</after>
37-
38-
<!-- Go to the shopping cart -->
39-
<amOnPage url="{{CheckoutCartPage.url}}" stepKey="amOnPageShoppingCart"/>
40-
<waitForPageLoad stepKey="waitForCheckoutPageLoad1"/>
41-
42-
<!-- Change the product QTY -->
43-
<fillField selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" userInput="3" stepKey="changeCartQty"/>
44-
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="openShoppingCart"/>
45-
<waitForPageLoad stepKey="waitForCheckoutPageLoad2"/>
46-
47-
<!-- The price and QTY values should be updated for the product -->
48-
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabProductQtyInCart"/>
49-
<see userInput="$300" selector="{{CheckoutCartProductSection.ProductSubtotalByName($$createProduct.name$$)}}" stepKey="assertProductPrice"/>
50-
<assertEquals expected="3" actual="$grabProductQtyInCart" stepKey="assertProductQtyInCart"/>
51-
52-
<!-- Subtotal should be updated -->
53-
<see userInput="$300" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertCartSubtotal"/>
54-
55-
<!-- Minicart product price and subtotal should be updated -->
56-
<actionGroup ref="clickViewAndEditCartFromMiniCart" stepKey="openMinicart"/>
57-
<grabValueFrom selector="{{StorefrontMinicartSection.itemQuantity($$createProduct.name$$)}}" stepKey="grabProductQtyInMinicart"/>
58-
<assertEquals expected="3" actual="$grabProductQtyInMinicart" stepKey="assertProductQtyInMinicart"/>
59-
<see userInput="$300" selector="{{StorefrontMinicartSection.subtotal}}" stepKey="assertMinicartSubtotal"/>
60-
</test>
61-
<test name="UpdateShoppingCartTestVariation2">
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontUpdateShoppingCartSimpleWithCustomOptionsProductQtyTest">
6212
<annotations>
6313
<features value="Checkout"/>
6414
<title value="Check updating shopping cart while updating qty of items with custom options"/>
@@ -68,13 +18,12 @@
6818
</annotations>
6919
<before>
7020
<createData entity="_defaultCategory" stepKey="createCategory"/>
71-
<createData entity="SimpleProduct" stepKey="createProduct">
21+
<createData entity="ApiSimpleProductWithCustomPrice" stepKey="createProduct">
7222
<requiredEntity createDataKey="createCategory"/>
73-
<field key="price">100</field>
7423
</createData>
7524

7625
<!-- Add two custom options to the product: field and textarea -->
77-
<updateData createDataKey="createProduct" entity="productWithOptions3" stepKey="updateProductWithOption"/>
26+
<updateData createDataKey="createProduct" entity="ProductWithTextFieldAndAreaOptions" stepKey="updateProductWithOption"/>
7827

7928
<!-- Go to the product page, fill the custom options values and add the product to the shopping cart -->
8029
<amOnPage url="{{StorefrontHomePage.url}}$createProduct.custom_attributes[url_key]$.html" stepKey="amOnProductPage"/>
@@ -101,7 +50,7 @@
10150

10251
<!-- The price and QTY values should be updated for the product -->
10352
<grabValueFrom selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="grabProductQtyInCart"/>
104-
<see userInput="$1,320.00" selector="{{CheckoutCartProductSection.ProductSubtotalByName($$createProduct.name$$)}}" stepKey="assertProductPrice"/>
53+
<see userInput="$1,320.00" selector="{{CheckoutCartProductSection.productSubtotalByName($$createProduct.name$$)}}" stepKey="assertProductPrice"/>
10554
<assertEquals expected="11" actual="$grabProductQtyInCart" stepKey="assertProductQtyInCart"/>
10655
<see userInput="$1,320.00" selector="{{CheckoutCartSummarySection.subtotal}}" stepKey="assertSubtotal"/>
10756

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)