diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminCheckoutClearShoppingCartEnabledActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminCheckoutClearShoppingCartEnabledActionGroup.xml deleted file mode 100644 index 2a7de87054888..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminCheckoutClearShoppingCartEnabledActionGroup.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - Enable/disable display of clear shopping cart button on the cart page via checkout cart configuration. - - - - - - - - - - - diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminOpenSalesCheckoutConfigPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminOpenSalesCheckoutConfigPageActionGroup.xml index cf1e2c51fb980..4e76e3113bdb8 100644 --- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminOpenSalesCheckoutConfigPageActionGroup.xml +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminOpenSalesCheckoutConfigPageActionGroup.xml @@ -8,6 +8,9 @@ + + Goes to the Store Configuration > Sales > Checkout configuration page in admin. + diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminSelectClearShoppingCartConfigurationActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminSelectClearShoppingCartConfigurationActionGroup.xml new file mode 100644 index 0000000000000..7d9cc0ca90d4e --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AdminSelectClearShoppingCartConfigurationActionGroup.xml @@ -0,0 +1,23 @@ + + + + + + + Enable/Disable clear shopping cart store configuration using UI. + + + + + + + + + + diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontClearShoppingCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontClearShoppingCartActionGroup.xml new file mode 100644 index 0000000000000..2582cba5a6871 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontClearShoppingCartActionGroup.xml @@ -0,0 +1,27 @@ + + + + + + + Clicks the Clear Shopping Cart button on the storefront on the shopping cart page and verifies shopping cart gets emptied. + + + + + + + + + + + + + + diff --git a/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml index bf488617c7d1d..9ab8a64c9ab88 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml @@ -105,10 +105,12 @@ checkout/cart/enable_clear_shopping_cart Display clear shopping cart button on the cart page 1 + Yes checkout/cart/enable_clear_shopping_cart Do not display clear shopping cart button on the cart page 0 + No diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/AdminCheckoutConfigSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/AdminCheckoutConfigSection.xml index afb0910025628..72cba8349ec0b 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/AdminCheckoutConfigSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/AdminCheckoutConfigSection.xml @@ -7,7 +7,7 @@ -->
- - + +
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml index a531f85c81304..293d70df8c8e6 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartProductSection.xml @@ -49,6 +49,8 @@ + + diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutRequisitionConfirmationModalSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutRequisitionConfirmationModalSection.xml deleted file mode 100644 index 4d814cfe4e04b..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/Section/StorefrontCheckoutRequisitionConfirmationModalSection.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - -
- - -
-
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ClearShoppingCartEnableDisableConfigurationTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ClearShoppingCartEnableDisableConfigurationTest.xml new file mode 100644 index 0000000000000..5e2690e619436 --- /dev/null +++ b/app/code/Magento/Checkout/Test/Mftf/Test/ClearShoppingCartEnableDisableConfigurationTest.xml @@ -0,0 +1,91 @@ + + + + + + + + + <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"/> + <group value="shoppingCart"/> + </annotations> + <before> + <!-- Create simple products and category --> + <createData entity="_defaultCategory" stepKey="createCategory"/> + <createData entity="SimpleProduct" stepKey="createProduct1"> + <requiredEntity createDataKey="createCategory"/> + </createData> + <createData entity="SimpleProduct" stepKey="createProduct2"> + <requiredEntity createDataKey="createCategory"/> + </createData> + + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> + </before> + <after> + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> + <deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/> + <deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/> + + <!-- Disable clear shopping cart --> + <magentoCLI command="config:set {{DisableClearShoppingCart.path}} {{DisableClearShoppingCart.value}}" stepKey="disableClearShoppingCart"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + + <!-- Navigate to sales checkout cart configuration --> + <actionGroup ref="AdminOpenSalesCheckoutConfigPageActionGroup" stepKey="openSalesCheckoutCartConfig1"> + <argument name="tabGroupAnchor" value="#checkout_cart-link"/> + </actionGroup> + + <!-- Enable clear shopping cart button --> + <actionGroup ref="AdminSelectClearShoppingCartConfigurationActionGroup" stepKey="enableClearShoppingCartButton"/> + <actionGroup ref="SaveStoreConfigurationActionGroup" stepKey="saveStoreConfiguration1"/> + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cliCacheClean1"> + <argument name="tags" value=""/> + </actionGroup> + + <!-- Open product 1 and add to cart --> + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProduct1Page1"> + <argument name="product" value="$$createProduct1$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product1AddToCart"/> + + <!-- Open product 2 and add to cart --> + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProduct2Page"> + <argument name="product" value="$$createProduct2$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product2AddToCart"/> + + <!-- Go to shopping cart page --> + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage1"/> + + <!-- Clear shopping cart --> + <actionGroup ref="StorefrontClearShoppingCartActionGroup" stepKey="clearShoppingCart"/> + <actionGroup ref="AssertMiniCartEmptyActionGroup" stepKey="assertMiniCartEmpty"/> + + <!-- Return to Admin to disable clear shopping cart --> + <actionGroup ref="AdminOpenSalesCheckoutConfigPageActionGroup" stepKey="openSalesCheckoutCartConfig2"/> + <actionGroup ref="AdminSelectClearShoppingCartConfigurationActionGroup" stepKey="disableClearShoppingCartButton"> + <argument name="value" value="{{DisableClearShoppingCart.textValue}}"/> + </actionGroup> + <actionGroup ref="SaveStoreConfigurationActionGroup" stepKey="saveStoreConfiguration2"/> + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cliCacheClean2"> + <argument name="tags" value=""/> + </actionGroup> + + <!-- Open product 1 page and add to cart --> + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProduct1Page2"> + <argument name="product" value="$$createProduct1$$"/> + </actionGroup> + <actionGroup ref="StorefrontAddToTheCartActionGroup" stepKey="product1AddToCart2"/> + + <!-- Go to shopping cart and assert clear shopping cart button is not rendered in UI --> + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage2"/> + <dontSeeElementInDOM selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="dontSeeElementEmptyCartButton"/> + </test> +</tests> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontClearShoppingCartWithConfirmationModalTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontClearShoppingCartWithConfirmationModalTest.xml deleted file mode 100644 index c6c76e737633c..0000000000000 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontClearShoppingCartWithConfirmationModalTest.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="StorefrontClearShoppingCartWithConfirmationModalTest"> - <annotations> - <features value="Checkout"/> - <stories value="Shopping Cart"/> - <title value="Show clear shopping cart button with confirmation modal"/> - <description value="Show clear shopping cart button on shopping cart page based on checkout shopping cart stores configuration"/> - <group value="shoppingCart"/> - </annotations> - <before> - <!-- Create simple product and category --> - <createData entity="_defaultCategory" stepKey="createCategory"/> - <createData entity="SimpleProduct" stepKey="createProduct"> - <requiredEntity createDataKey="createCategory"/> - </createData> - </before> - <after> - <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - - <!-- Disable clear shopping cart --> - <magentoCLI command="config:set {{DisableClearShoppingCart.path}} {{DisableClearShoppingCart.value}}" stepKey="disableClearShoppingCart"/> - </after> - - <!-- Add the newly created product to the shopping cart --> - <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage"> - <argument name="product" value="$$createProduct$$"/> - </actionGroup> - - <!-- Go to the shopping cart --> - <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="amOnPageShoppingCart"/> - - <!-- Assert that clear shopping cart button is not rendered on the cart page --> - <dontSeeElement selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="dontSeeClearShoppingCartButton"/> - - <!-- Open new tab and login as Admin --> - <openNewTab stepKey="openNewTab"/> - <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> - - <!-- Navigate to sales checkout cart configuration --> - <actionGroup ref="AdminOpenSalesCheckoutConfigPageActionGroup" stepKey="openCheckoutCartConfig"> - <argument name="tabGroupAnchor" value="#checkout_cart-link"/> - </actionGroup> - - <!-- Enable clear shopping cart button --> - <actionGroup ref="AdminCheckoutClearShoppingCartEnabledActionGroup" stepKey="enableClearShoppingCartButton"/> - - <!-- Flush cache --> - <magentoCLI command="cache:flush" stepKey="cacheFlush"/> - - <!-- Switch back to the Cart page tab and refresh the page --> - <switchToPreviousTab stepKey="switchToPreviousTab"/> - <reloadPage stepKey="refreshPage"/> - <waitForPageLoad stepKey="waitForPageReload"/> - - <!-- Assert that empty cart button is rendered on the cart page --> - <waitForElementVisible selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="waitForClearShoppingCartButton"/> - <seeElement selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="SeeClearShoppingCartButton"/> - - <!-- Click clear shopping cart button --> - <click selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="clickClearShoppingCartButton"/> - - <!-- Show confirmation modal --> - <waitForElementVisible selector=".modal-popup.confirm" stepKey="waitForRequisitionConfirmationModal"/> - <seeElement selector=".modal-popup.confirm" stepKey="seeRequisitionConfirmationModal"/> - - <!-- Confirm modal --> - <click selector="{{StorefrontCheckoutRequisitionConfirmationModalSection.confirm}}" stepKey="clickOkRequisitionConfirmationModal"/> - <waitForPageLoad stepKey="waitForEmptyShoppingCartPageLoad"/> - <waitForText userInput="You have no items in your shopping cart." stepKey="waitForEmptyShoppingCartText"/> - <see userInput="You have no items in your shopping cart." stepKey="seeEmptyCartMessage"/> - </test> -</tests>