|
| 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="StorefrontClearShoppingCartWithConfirmationModalTest"> |
| 11 | + <annotations> |
| 12 | + <features value="Checkout"/> |
| 13 | + <stories value="Shopping Cart"/> |
| 14 | + <title value="Show clear shopping cart button with confirmation modal"/> |
| 15 | + <description value="Show clear shopping cart button on shopping cart page based on checkout shopping cart stores configuration"/> |
| 16 | + <group value="shoppingCart"/> |
| 17 | + </annotations> |
| 18 | + <before> |
| 19 | + <!-- Create simple product and category --> |
| 20 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 21 | + <createData entity="SimpleProduct" stepKey="createProduct"> |
| 22 | + <requiredEntity createDataKey="createCategory"/> |
| 23 | + </createData> |
| 24 | + </before> |
| 25 | + <after> |
| 26 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 27 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 28 | + |
| 29 | + <!-- Disable clear shopping cart --> |
| 30 | + <magentoCLI command="config:set {{DisableClearShoppingCart.path}} {{DisableClearShoppingCart.value}}" stepKey="disableClearShoppingCart"/> |
| 31 | + </after> |
| 32 | + |
| 33 | + <!-- Add the newly created product to the shopping cart --> |
| 34 | + <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addToCartFromStorefrontProductPage"> |
| 35 | + <argument name="product" value="$$createProduct$$"/> |
| 36 | + </actionGroup> |
| 37 | + |
| 38 | + <!-- Go to the shopping cart --> |
| 39 | + <actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="amOnPageShoppingCart"/> |
| 40 | + |
| 41 | + <!-- Assert that clear shopping cart button is not rendered on the cart page --> |
| 42 | + <dontSeeElement selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="dontSeeClearShoppingCartButton"/> |
| 43 | + |
| 44 | + <!-- Open new tab and login as Admin --> |
| 45 | + <openNewTab stepKey="openNewTab"/> |
| 46 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 47 | + |
| 48 | + <!-- Navigate to sales checkout cart configuration --> |
| 49 | + <actionGroup ref="AdminOpenSalesCheckoutConfigPageActionGroup" stepKey="openCheckoutCartConfig"> |
| 50 | + <argument name="tabGroupAnchor" value="#checkout_cart-link"/> |
| 51 | + </actionGroup> |
| 52 | + |
| 53 | + <!-- Enable clear shopping cart button --> |
| 54 | + <actionGroup ref="AdminCheckoutClearShoppingCartEnabledActionGroup" stepKey="enableClearShoppingCartButton"/> |
| 55 | + |
| 56 | + <!-- Flush cache --> |
| 57 | + <magentoCLI command="cache:flush" stepKey="cacheFlush"/> |
| 58 | + |
| 59 | + <!-- Back to the Cart page and refresh the page --> |
| 60 | + <switchToPreviousTab stepKey="switchToPreviousTab"/> |
| 61 | + <reloadPage stepKey="refreshPage"/> |
| 62 | + <waitForPageLoad stepKey="waitForPageReload"/> |
| 63 | + |
| 64 | + <!-- Assert that empty cart button is rendered on the cart page --> |
| 65 | + <waitForElementVisible selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="waitForClearShoppingCartButton"/> |
| 66 | + <seeElement selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="SeeClearShoppingCartButton"/> |
| 67 | + |
| 68 | + <!-- Click clear shopping cart button --> |
| 69 | + <click selector="{{CheckoutCartProductSection.emptyCartButton}}" stepKey="clickClearShoppingCartButton"/> |
| 70 | + |
| 71 | + <!-- Show confirmation modal --> |
| 72 | + <waitForElementVisible selector=".modal-popup.confirm" stepKey="waitForRequisitionConfirmationModal"/> |
| 73 | + <seeElement selector=".modal-popup.confirm" stepKey="seeRequisitionConfirmationModal"/> |
| 74 | + |
| 75 | + <!-- Confirm modal --> |
| 76 | + <click selector="{{StorefrontCheckoutRequisitionConfirmationModalSection.confirm}}" stepKey="clickOkRequisitionConfirmationModal"/> |
| 77 | + <waitForPageLoad stepKey="waitForEmptyShoppingCartPageLoad"/> |
| 78 | + <waitForText userInput="You have no items in your shopping cart." stepKey="waitForEmptyShoppingCartText"/> |
| 79 | + <see userInput="You have no items in your shopping cart." stepKey="seeEmptyCartMessage"/> |
| 80 | + </test> |
| 81 | +</tests> |
0 commit comments