Skip to content

Commit 316344c

Browse files
committed
MAGETWO-94889: Automate with MFTF Free Shipping is not available in Admin if "Minimum Order Amount" does not match Order total
1 parent 3a236b3 commit 316344c

8 files changed

+165
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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="DisableFlatRate">
12+
<amOnPage url="{{AdminShippingMethodsPage.url}}" stepKey="navigateToShippingMethodsPageDisable"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
<conditionalClick selector="{{ShippingMethodsSection.FlatRateTab}}" dependentSelector="{{ShippingMethodsSection.CheckIfFlatRateTabExpand}}" visible="true" stepKey="expandFlatRateTab"/>
15+
<waitForElementVisible selector="{{ShippingMethodsSection.FlatRateEnabled}}" stepKey="seeFlatRate"/>
16+
<uncheckOption selector="{{ShippingMethodsSection.EnableFlatRateEnabled}}" stepKey="uncheckUseSystemValue"/>
17+
<selectOption selector="{{ShippingMethodsSection.FlatRateEnabled}}" userInput="No" stepKey="setDisable"/>
18+
<click selector="{{ShippingMethodsSection.FlatRateTab}}" stepKey="collapseFlatRateTab"/>
19+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig" />
20+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
21+
</actionGroup>
22+
<actionGroup name="EnableFlatRate">
23+
<amOnPage url="{{AdminShippingMethodsPage.url}}" stepKey="navigateToShippingMethodsPage"/>
24+
<waitForPageLoad stepKey="waitForPageLoad2"/>
25+
<conditionalClick selector="{{ShippingMethodsSection.FlatRateTab}}" dependentSelector="{{ShippingMethodsSection.CheckIfFlatRateTabExpand}}" visible="true" stepKey="openFlatRateTab"/>
26+
<waitForElementVisible selector="{{ShippingMethodsSection.FlatRateEnabled}}" stepKey="seeFlatRate2"/>
27+
<selectOption selector="{{ShippingMethodsSection.FlatRateEnabled}}" userInput="Yes" stepKey="enableFlatRate"/>
28+
<checkOption selector="{{ShippingMethodsSection.EnableFlatRateEnabled}}" stepKey="useSystemValue"/>
29+
<click selector="{{ShippingMethodsSection.FlatRateTab}}" stepKey="collapseFlatRateTab2"/>
30+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>
31+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
32+
</actionGroup>
33+
</actionGroups>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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="DisableFreeShipping">
12+
<amOnPage url="{{AdminShippingMethodsPage.url}}" stepKey="navigateToShippingMethodsPageDisable"/>
13+
<waitForPageLoad stepKey="waitForPageLoad"/>
14+
<conditionalClick selector="{{ShippingMethodsSection.FreeShippingTab}}" dependentSelector="{{ShippingMethodsSection.CheckIfFreeShippingTabExpand}}" visible="true" stepKey="expandFreeShippingTab"/>
15+
<waitForElementVisible selector="{{ShippingMethodsSection.FreeShippingEnabled}}" stepKey="seeFreeShipping"/>
16+
<selectOption selector="{{ShippingMethodsSection.FreeShippingEnabled}}" userInput="No" stepKey="setDisable"/>
17+
<checkOption selector="{{ShippingMethodsSection.EnableFreeShippingEnabled}}" stepKey="useSystemValue"/>
18+
<clearField selector="{{ShippingMethodsSection.MinimumOrderAmount}}" stepKey="deleteMinimumOrderAmount"/>
19+
<click selector="{{ShippingMethodsSection.FreeShippingTab}}" stepKey="collapseFreeShippingTab"/>
20+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig" />
21+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
22+
</actionGroup>
23+
<actionGroup name="EnableFreeShipping">
24+
<arguments>
25+
<argument name="orderAmount" defaultValue="" type="string"/>
26+
</arguments>
27+
<amOnPage url="{{AdminShippingMethodsPage.url}}" stepKey="navigateToShippingMethodsPage"/>
28+
<waitForPageLoad stepKey="waitForPageLoad"/>
29+
<conditionalClick selector="{{ShippingMethodsSection.FreeShippingTab}}" dependentSelector="{{ShippingMethodsSection.CheckIfFreeShippingTabExpand}}" visible="true" stepKey="openFreeShippingTab"/>
30+
<waitForElementVisible selector="{{ShippingMethodsSection.FreeShippingEnabled}}" stepKey="seeFreeShipping2"/>
31+
<uncheckOption selector="{{ShippingMethodsSection.EnableFreeShippingEnabled}}" stepKey="uncheckUseSystemValue"/>
32+
<selectOption selector="{{ShippingMethodsSection.FreeShippingEnabled}}" userInput="Yes" stepKey="enableFreeShipping"/>
33+
<fillField selector="{{ShippingMethodsSection.MinimumOrderAmount}}" userInput="{{orderAmount}}" stepKey="enterMinimumOrderAmount"/>
34+
<click selector="{{ShippingMethodsSection.FreeShippingTab}}" stepKey="collapseFreeShippingTab2"/>
35+
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfiguration"/>
36+
<seeElement selector="{{AdminMessagesSection.success}}" stepKey="seeSuccessMessage"/>
37+
</actionGroup>
38+
</actionGroups>

app/code/Magento/Config/Test/Mftf/Page/AdminConfigPage.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@
2121
<page name="AdminConfigGeneralPage" url="admin/system_config/edit/section/general/" area="admin" module="Magento_Config">
2222
<section name="GeneralSection"/>
2323
</page>
24+
<page name="AdminShippingMethodsPage" url="admin/system_config/edit/section/carriers/" area="admin" module="Magento_Config">
25+
<section name="ShippingMethodsSection"/>
26+
</page>
2427
</pages>

app/code/Magento/Config/Test/Mftf/Section/GeneralSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<element name="SwitcherSystemValue" type="button" selector="#cms_wysiwyg_editor_inherit"/>
1717
<element name="Switcher" type="button" selector="#cms_wysiwyg_editor" />
1818
<element name="StaticURL" type="button" selector="#cms_wysiwyg_use_static_urls_in_catalog" />
19-
<element name="Save" type="button" selector="#save"/>
19+
<element name="Save" type="button" selector="#save" timeout="30"/>
2020
</section>
2121
<section name="WebSection">
2222
<element name="DefaultLayoutsTab" type="button" selector="#web_default_layouts-head"/>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="ShippingMethodsSection">
12+
<!--Flat Rate tab in Shipping Methods-->
13+
<element name="FlatRateTab" type="button" selector="#carriers_flatrate-head"/>
14+
<element name="CheckIfFlatRateTabExpand" type="button" selector="#carriers_flatrate-head:not(.open)"/>
15+
<element name="FlatRateEnabled" type="button" selector="#carriers_flatrate_active"/>
16+
<element name="EnableFlatRateEnabled" type="checkbox" selector="#carriers_flatrate_active_inherit"/>
17+
<!--Free Shipping tab in Shipping Methods-->
18+
<element name="FreeShippingTab" type="button" selector="#carriers_freeshipping-head"/>
19+
<element name="CheckIfFreeShippingTabExpand" type="button" selector="#carriers_freeshipping-head:not(.open)"/>
20+
<element name="FreeShippingEnabled" type="button" selector="#carriers_freeshipping_active"/>
21+
<element name="EnableFreeShippingEnabled" type="checkbox" selector="#carriers_freeshipping_active_inherit"/>
22+
<element name="MinimumOrderAmount" type="input" selector="#carriers_freeshipping_free_shipping_subtotal"/>
23+
</section>
24+
</sections>

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderDetailsMessagesSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,6 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminOrderDetailsMessagesSection">
1212
<element name="successMessage" type="text" selector="div.message-success"/>
13+
<element name="errorMessage" type="text" selector="div.message-error"/>
1314
</section>
1415
</sections>

app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormPaymentSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
<element name="getShippingMethods" type="text" selector="#order-shipping_method a.action-default" timeout="30"/>
1414
<element name="flatRateOption" type="radio" selector="#s_method_flatrate_flatrate" timeout="30"/>
1515
<element name="shippingError" type="text" selector="#order[has_shipping]-error"/>
16+
<element name="freeShippingOption" type="radio" selector="#s_method_freeshipping_freeshipping" timeout="30"/>
1617
</section>
1718
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0"?>
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="AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest">
11+
<annotations>
12+
<features value="Sales"/>
13+
<stories value="Admin create order"/>
14+
<title value="Free Shipping is not available in Admin if Minimum Order Amount does not match Order total"/>
15+
<description value="Admin should not be able place order with Free Shipping method if Minimum Order Amount does not match Order total"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MAGETWO-61001"/>
18+
<group value="sales"/>
19+
</annotations>
20+
<before>
21+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
22+
<createData entity="SimpleProduct" stepKey="createProduct">
23+
<requiredEntity createDataKey="createCategory"/>
24+
<field key="price">100</field>
25+
</createData>
26+
<createData entity="Simple_US_Customer" stepKey="customer"/>
27+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
28+
<actionGroup ref="DisableFlatRate" stepKey="disableFlatRate"/>
29+
<actionGroup ref="EnableFreeShipping" stepKey="enableFreeShipping">
30+
<argument name="orderAmount" value="101"/>
31+
</actionGroup>
32+
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCacheBefore"/>
33+
</before>
34+
<after>
35+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
36+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
37+
<deleteData createDataKey="customer" stepKey="deleteCustomer"/>
38+
<actionGroup ref="EnableFlatRate" stepKey="enableFlatRate"/>
39+
<actionGroup ref="DisableFreeShipping" stepKey="disableFreeShipping"/>
40+
<actionGroup ref="ClearCacheActionGroup" stepKey="clearCacheAfter"/>
41+
<amOnPage url="{{AdminLogoutPage.url}}" stepKey="amOnLogoutPage"/>
42+
</after>
43+
44+
<actionGroup ref="navigateToNewOrderPageExistingCustomer" stepKey="goToCreateOrderPage">
45+
<argument name="customer" value="Simple_US_Customer"/>
46+
</actionGroup>
47+
48+
<!--Admin creates order-->
49+
<actionGroup ref="addSimpleProductToOrder" stepKey="addProductToOrder">
50+
<argument name="product" value="SimpleProduct"/>
51+
</actionGroup>
52+
53+
<click selector="{{AdminOrderFormPaymentSection.header}}" stepKey="unfocus"/>
54+
<waitForPageLoad stepKey="waitForJavascriptToFinish"/>
55+
<click selector="{{AdminOrderFormPaymentSection.getShippingMethods}}" stepKey="clickShippingMethods"/>
56+
<dontSeeElement selector="{{AdminOrderFormPaymentSection.freeShippingOption}}" stepKey="seeAbsentFreeShipping"/>
57+
58+
<!--Submit Order and verify information-->
59+
<click selector="{{AdminOrderFormActionSection.SubmitOrder}}" stepKey="clickSubmitOrder"/>
60+
61+
<dontSeeElement selector="{{AdminOrderDetailsMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
62+
<seeElement selector="{{AdminOrderDetailsMessagesSection.errorMessage}}" stepKey="seeErrorMessage"/>
63+
</test>
64+
</tests>

0 commit comments

Comments
 (0)