forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
magento#108: Clear Shopping Cart - Refactor MFTF to include confirmat…
…ion modal
- Loading branch information
John Carlo Octabio
committed
Jul 14, 2020
1 parent
b960859
commit e8a36e7
Showing
4 changed files
with
97 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...ento/Checkout/Test/Mftf/Section/StorefrontCheckoutRequisitionConfirmationModalSection.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> | ||
<section name="StorefrontCheckoutRequisitionConfirmationModalSection"> | ||
<element name="confirm" type="button" selector=".modal-popup.confirm .action-accept"/> | ||
<element name="cancel" type="button" selector=".modal-popup.confirm .action-dismiss"/> | ||
</section> | ||
</sections> |
73 changes: 0 additions & 73 deletions
73
...st/StorefrontCheckRenderingClearCartButtonOnTheCartPageBasedOnStoresConfigurationTest.xml
This file was deleted.
Oops, something went wrong.
81 changes: 81 additions & 0 deletions
81
.../Magento/Checkout/Test/Mftf/Test/StorefrontClearShoppingCartWithConfirmationModalTest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?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"/> | ||
|
||
<!-- Back to the Cart page 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> |