Skip to content

Commit aba95a8

Browse files
committed
Update test to correspond Magento standards
1 parent e86c156 commit aba95a8

6 files changed

+64
-40
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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="AssertMiniShoppingCartSubTotalActionGroup">
11+
<arguments>
12+
<argument name="dataQuote" type="entity" />
13+
</arguments>
14+
<waitForPageLoad stepKey="waitForPageLoad" time="120"/>
15+
<grabTextFrom selector="{{StorefrontMinicartSection.miniCartSubtotalField}}" stepKey="grabMiniCartTotal" />
16+
<assertContains stepKey="assertMiniCartTotal">
17+
<actualResult type="variable">$grabMiniCartTotal</actualResult>
18+
<expectedResult type="string">{{dataQuote.subtotal}}</expectedResult>
19+
</assertContains>
20+
<assertContains stepKey="assertMiniCartCurrency">
21+
<actualResult type="variable">$grabMiniCartTotal</actualResult>
22+
<expectedResult type="string">{{dataQuote.currency}}</expectedResult>
23+
</assertContains>
24+
</actionGroup>
25+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/ActionGroup/ShoppingCartCheckSummaryTotalActionGroup.xml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="StorefrontUpdateProductQtyMiniShoppingCartActionGroup">
11+
<arguments>
12+
<argument name="product" type="entity" />
13+
<argument name="quote" type="entity" />
14+
</arguments>
15+
16+
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="goToMiniShoppingCart"/>
17+
18+
<!-- Clearing QTY field -->
19+
<doubleClick selector="{{StorefrontMinicartSection.itemQuantityBySku(product.sku)}}" stepKey="doubleClickOnQtyInput" />
20+
<pressKey selector="{{StorefrontMinicartSection.itemQuantityBySku(product.sku)}}" parameterArray="[\WebDriverKeys::DELETE]" stepKey="clearQty"/>
21+
<!-- Clearing QTY field -->
22+
23+
<fillField selector="{{StorefrontMinicartSection.itemQuantityBySku(product.sku)}}" userInput="{{quote.qty}}" stepKey="changeQty"/>
24+
<click selector="{{StorefrontMinicartSection.itemQuantityUpdateBySku(product.sku)}}" stepKey="clickUpdateButton"/>
25+
<waitForPageLoad stepKey="waitForProductQtyUpdate" />
26+
27+
</actionGroup>
28+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Data/QuoteData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
<data key="shipping">10.00</data>
2323
<data key="total">1,130.00</data>
2424
<data key="shippingMethod">Flat Rate - Fixed</data>
25+
<data key="currency">$</data>
2526
</entity>
2627
</entities>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
<element name="deleteMiniCartItem" type="button" selector=".action.delete" timeout="30"/>
2626
<element name="deleteMiniCartItemByName" type="button" selector="//ol[@id='mini-cart']//div[contains(., '{{var}}')]//a[contains(@class, 'delete')]" parameterized="true"/>
2727
<element name="miniCartSubtotalField" type="text" selector=".block-minicart .amount span.price"/>
28+
<element name="itemQuantityBySku" type="input" selector="#minicart-content-wrapper input[data-cart-item-id='{{productSku}}']" parameterized="true"/>
29+
<element name="itemQuantityUpdateBySku" type="button" selector="//div[@id='minicart-content-wrapper']//input[@data-cart-item-id='{{productSku}}']/../button[contains(@class, 'update-cart-item')]" parameterized="true"/>
2830
<element name="itemQuantity" type="input" selector="//a[text()='{{productName}}']/../..//input[contains(@class,'cart-item-qty')]" parameterized="true"/>
2931
<element name="itemQuantityUpdate" type="button" selector="//a[text()='{{productName}}']/../..//span[text()='Update']" parameterized="true"/>
3032
<element name="itemDiscount" type="text" selector="//tr[@class='totals']//td[@class='amount']/span"/>

app/code/Magento/Checkout/Test/Mftf/Test/UpdateProductFromMiniShoppingCartEntityTest.xml

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<title value="Check updating product from mini shopping cart"/>
1515
<description value="Update Product Qty on Mini Shopping Cart"/>
1616
<severity value="MAJOR"/>
17-
<testCaseId value="MAGETWO-29812"/>
17+
<testCaseId value="MC-15068"/>
1818
<group value="shoppingCart"/>
1919
<group value="mtf_migrated"/>
2020
</annotations>
@@ -23,12 +23,9 @@
2323
<!--Create product according to dataset.-->
2424
<createData entity="simpleProductWithoutCategory" stepKey="createProduct"/>
2525

26-
<!-- Go to frontend -->
27-
<amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="navigateToProductPage"/>
28-
2926
<!--Add product to cart-->
30-
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
31-
<argument name="productName" value="$$createProduct.name$$"/>
27+
<actionGroup ref="AddSimpleProductToCart" stepKey="addToCartFromStorefrontProductPage">
28+
<argument name="product" value="$$createProduct$$"/>
3229
</actionGroup>
3330
</before>
3431

@@ -37,21 +34,13 @@
3734
<deleteData createDataKey="createProduct" stepKey="deleteProduct" />
3835
</after>
3936

40-
<!-- Click on mini shopping cart icon -->
41-
<click selector="{{StorefrontMinicartSection.showCart}}" stepKey="goToMiniShoppingCart"/>
42-
43-
<!-- Click Edit -->
44-
<click selector="{{StorefrontMinicartSection.viewAndEditCart}}" stepKey="editMiniCartItem"/>
45-
46-
<!-- Fill data from dataset -->
47-
<clearField selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" stepKey="deleteFiled"/>
48-
<fillField selector="{{CheckoutCartProductSection.ProductQuantityByName($$createProduct.name$$)}}" userInput="{{simpleOrderQty2.qty}}" stepKey="changeQty"/>
49-
50-
<!-- Click Update -->
51-
<click selector="{{CheckoutCartProductSection.updateShoppingCartButton}}" stepKey="updateQty"/>
37+
<actionGroup ref="StorefrontUpdateProductQtyMiniShoppingCartActionGroup" stepKey="updateProductQty">
38+
<argument name="product" value="$$createProduct$$" />
39+
<argument name="quote" value="simpleOrderQty2" />
40+
</actionGroup>
5241

5342
<!-- Perform all assertions -->
54-
<actionGroup ref="ShoppingCartCheckSummaryTotalActionGroup" stepKey="checkSummary">
43+
<actionGroup ref="AssertMiniShoppingCartSubTotalActionGroup" stepKey="checkSummary">
5544
<argument name="dataQuote" value="simpleOrderQty2"/>
5645
</actionGroup>
5746
</test>

0 commit comments

Comments
 (0)