Skip to content

Commit 35a469b

Browse files
author
John Carlo Octabio
committed
#108: Clear Shopping Cart - Updated MFTF for code review changes
1 parent d8eeb97 commit 35a469b

10 files changed

+150
-121
lines changed

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

Lines changed: 0 additions & 24 deletions
This file was deleted.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1010
<actionGroup name="AdminOpenSalesCheckoutConfigPageActionGroup">
11+
<annotations>
12+
<description>Goes to the Store Configuration > Sales > Checkout configuration page in admin.</description>
13+
</annotations>
1114
<arguments>
1215
<argument name="tabGroupAnchor" type="string" defaultValue=""/>
1316
</arguments>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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="AdminSelectClearShoppingCartConfigurationActionGroup">
12+
<annotations>
13+
<description>Enable/Disable clear shopping cart store configuration using UI.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="value" type="string" defaultValue="{{EnableClearShoppingCart.textValue}}"/>
17+
</arguments>
18+
<waitForElementVisible selector="{{AdminCheckoutConfigSection.clearShoppingCartEnabledInherit}}" stepKey="waitForClearShoppingCartEnabledInherit" />
19+
<uncheckOption selector="{{AdminCheckoutConfigSection.clearShoppingCartEnabledInherit}}" stepKey="uncheckUseSystem" />
20+
<waitForElementVisible selector="{{AdminCheckoutConfigSection.clearShoppingCartEnabled}}" stepKey="waitForClearShoppingCartEnabled" />
21+
<selectOption selector="{{AdminCheckoutConfigSection.clearShoppingCartEnabled}}" userInput="{{value}}" stepKey="fillClearShoppingCartEnabled" />
22+
</actionGroup>
23+
</actionGroups>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="StorefrontClearShoppingCartActionGroup">
12+
<annotations>
13+
<description>Clicks the Clear Shopping Cart button on the storefront on the shopping cart page and verifies shopping cart gets emptied.</description>
14+
</annotations>
15+
16+
<waitForElementVisible selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="waitForEmptyCartButton"/>
17+
<click selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="clickEmptyCartButton"/>
18+
<waitForElementVisible selector="{{CheckoutCartProductSection.modalMessage}}" stepKey="waitForModalMessage"/>
19+
<waitForText selector="{{CheckoutCartProductSection.modalMessage}}" userInput="Are you sure you want to remove all items from your shopping cart?" stepKey="waitForTextModalMessage"/>
20+
<waitForElementVisible selector="{{CheckoutCartProductSection.modalConfirmButton}}" stepKey="waitForModalConfirmButton"/>
21+
<click selector="{{CheckoutCartProductSection.modalConfirmButton}}" stepKey="clickModalConfirmButton"/>
22+
<waitForPageLoad stepKey="waitForPageLoad"/>
23+
<seeCurrentUrlEquals url="{{_ENV.MAGENTO_BASE_URL}}checkout/cart" stepKey="seeCurrentUrlEqualsCartPage"/>
24+
<waitForText selector="{{CheckoutCartMessageSection.emptyCartMessage}}" userInput="You have no items in your shopping cart." stepKey="waitForEmptyCartMessage"/>
25+
26+
</actionGroup>
27+
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,12 @@
105105
<data key="path">checkout/cart/enable_clear_shopping_cart</data>
106106
<data key="label">Display clear shopping cart button on the cart page</data>
107107
<data key="value">1</data>
108+
<data key="textValue">Yes</data>
108109
</entity>
109110
<entity name="DisableClearShoppingCart">
110111
<data key="path">checkout/cart/enable_clear_shopping_cart</data>
111112
<data key="label">Do not display clear shopping cart button on the cart page</data>
112113
<data key="value">0</data>
114+
<data key="textValue">No</data>
113115
</entity>
114116
</entities>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
99
<section name="AdminCheckoutConfigSection">
10-
<element name="clearShoppingCartEnabled" type="select" selector="#checkout_cart_enable_clear_shopping_cart"/>
11-
<element name="clearShoppingCartEnabledInherit" type="select" selector="#checkout_cart_enable_clear_shopping_cart_inherit"/>
10+
<element name="clearShoppingCartEnabled" type="select" selector="#checkout_cart_enable_clear_shopping_cart" timeout="30"/>
11+
<element name="clearShoppingCartEnabledInherit" type="select" selector="#checkout_cart_enable_clear_shopping_cart_inherit" timeout="30"/>
1212
</section>
1313
</sections>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
<element name="checkoutCartSubtotal" type="text" selector="//td[@class='col subtotal']//span[@class='price']"/>
5050
<element name="emptyCart" selector=".cart-empty" type="text"/>
5151
<element name="emptyCartButton" selector="#empty_cart_button" type="button"/>
52+
<element name="modalMessage" type="text" selector=".modal-popup.confirm._show .modal-content" timeout="30"/>
53+
<element name="modalConfirmButton" type="button" selector=".modal-popup.confirm._show .action-accept" timeout="30"/>
5254
<!-- Required attention section -->
5355
<element name="removeProductBySku" type="button" selector="//div[contains(., '{{sku}}')]/ancestor::tbody//button" parameterized="true" timeout="30"/>
5456
<element name="failedItemBySku" type="block" selector="//div[contains(.,'{{sku}}')]/ancestor::tbody" parameterized="true" timeout="30"/>

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

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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="ClearShoppingCartEnableDisableConfigurationTest">
11+
<annotations>
12+
<features value="Checkout"/>
13+
<stories value="Shopping Cart"/>
14+
<title value="Enable and Disable Clear Shopping Cart Configuration"/>
15+
<description value="Verify that disabling the clear shopping cart store configuration will remove the clear shopping cart configuration button from the storefront's shopping cart page. Verify that enabling the configuration will add the button to the page and that the button functions as expected"/>
16+
<group value="shoppingCart"/>
17+
</annotations>
18+
<before>
19+
<!-- Create simple products and category -->
20+
<createData entity="_defaultCategory" stepKey="createCategory"/>
21+
<createData entity="SimpleProduct" stepKey="createProduct1">
22+
<requiredEntity createDataKey="createCategory"/>
23+
</createData>
24+
<createData entity="SimpleProduct" stepKey="createProduct2">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
28+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
29+
</before>
30+
<after>
31+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
32+
<deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/>
33+
<deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/>
34+
35+
<!-- Disable clear shopping cart -->
36+
<magentoCLI command="config:set {{DisableClearShoppingCart.path}} {{DisableClearShoppingCart.value}}" stepKey="disableClearShoppingCart"/>
37+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
38+
</after>
39+
40+
<!-- Navigate to sales checkout cart configuration -->
41+
<actionGroup ref="AdminOpenSalesCheckoutConfigPageActionGroup" stepKey="openSalesCheckoutCartConfig1">
42+
<argument name="tabGroupAnchor" value="#checkout_cart-link"/>
43+
</actionGroup>
44+
45+
<!-- Enable clear shopping cart button -->
46+
<actionGroup ref="AdminSelectClearShoppingCartConfigurationActionGroup" stepKey="enableClearShoppingCartButton"/>
47+
<actionGroup ref="SaveStoreConfigurationActionGroup" stepKey="saveStoreConfiguration1"/>
48+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cliCacheClean1">
49+
<argument name="tags" value=""/>
50+
</actionGroup>
51+
52+
<!-- Open product 1 and add to cart -->
53+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProduct1Page1">
54+
<argument name="product" value="$$createProduct1$$"/>
55+
</actionGroup>
56+
<actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product1AddToCart"/>
57+
58+
<!-- Open product 2 and add to cart -->
59+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProduct2Page">
60+
<argument name="product" value="$$createProduct2$$"/>
61+
</actionGroup>
62+
<actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product2AddToCart"/>
63+
64+
<!-- Go to shopping cart page -->
65+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage1"/>
66+
67+
<!-- Clear shopping cart -->
68+
<actionGroup ref="StorefrontClearShoppingCartActionGroup" stepKey="clearShoppingCart"/>
69+
<actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="assertMiniCartEmpty"/>
70+
71+
<!-- Return to Admin to disable clear shopping cart -->
72+
<actionGroup ref="AdminOpenSalesCheckoutConfigPageActionGroup" stepKey="openSalesCheckoutCartConfig2"/>
73+
<actionGroup ref="AdminSelectClearShoppingCartConfigurationActionGroup" stepKey="disableClearShoppingCartButton">
74+
<argument name="value" value="{{DisableClearShoppingCart.textValue}}"/>
75+
</actionGroup>
76+
<actionGroup ref="SaveStoreConfigurationActionGroup" stepKey="saveStoreConfiguration2"/>
77+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cliCacheClean2">
78+
<argument name="tags" value=""/>
79+
</actionGroup>
80+
81+
<!-- Open product 1 page and add to cart -->
82+
<actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProduct1Page2">
83+
<argument name="product" value="$$createProduct1$$"/>
84+
</actionGroup>
85+
<actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product1AddToCart2"/>
86+
87+
<!-- Go to shopping cart and assert clear shopping cart button is not rendered in UI -->
88+
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage2"/>
89+
<dontSeeElementInDOM selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="dontSeeElementEmptyCartButton"/>
90+
</test>
91+
</tests>

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

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)