Skip to content

Commit

Permalink
Merge pull request #166 from magento-pangolin/MC-8893
Browse files Browse the repository at this point in the history
MC-8893 Backport for MC-12599
  • Loading branch information
kabothu authored Jun 13, 2019
2 parents d412edb + 3c9a52d commit 744ffc8
Show file tree
Hide file tree
Showing 12 changed files with 223 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
-->
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="OpenStorefrontProductPageActionGroup">
<actionGroup name="OpenStoreFrontProductPageActionGroup">
<arguments>
<argument name="productUrlKey" type="string"/>
</arguments>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,14 @@
<click selector="{{CheckoutPaymentSection.placeOrderNoWait}}" stepKey="clickPlaceOrder"/>
<waitForText selector="{{StorefrontMessagesSection.errorMessage}}" userInput="{{errorMessage}}" time="30" stepKey="seeShippingMethodError"/>
</actionGroup>

<!-- Check shipping method in checkout -->
<actionGroup name="CheckShippingMethodInCheckoutActionGroup">
<arguments>
<argument name="shippingMethod"/>
</arguments>
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/>
<seeElement selector="{{CheckoutPaymentSection.isPaymentSection}}" stepKey="assertPaymentSection"/>
<see userInput="{{shippingMethod}}" selector="{{CheckoutPaymentSection.shippingMethodInformation}}" stepKey="assertshippingMethodInformation"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="GuestCheckoutFillNewShippingAddressActionGroup">
<arguments>
<argument name="customer" type="entity"/>
<argument name="address" type="entity"/>
</arguments>
<fillField selector="{{CheckoutShippingSection.email}}" userInput="{{customer.email}}" stepKey="fillEmailField"/>
<fillField selector="{{CheckoutShippingSection.firstName}}" userInput="{{customer.firstName}}" stepKey="fillFirstName"/>
<fillField selector="{{CheckoutShippingSection.lastName}}" userInput="{{customer.lastName}}" stepKey="fillLastName"/>
<fillField selector="{{CheckoutShippingSection.street}}" userInput="{{address.street}}" stepKey="fillStreet"/>
<fillField selector="{{CheckoutShippingSection.city}}" userInput="{{address.city}}" stepKey="fillCity"/>
<selectOption selector="{{CheckoutShippingSection.region}}" userInput="{{address.state}}" stepKey="selectRegion"/>
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="{{address.postcode}}" stepKey="fillZipCode"/>
<fillField selector="{{CheckoutShippingSection.telephone}}" userInput="{{address.telephone}}" stepKey="fillPhone"/>
</actionGroup>
</actionGroups>
42 changes: 42 additions & 0 deletions app/code/Magento/Checkout/Test/Mftf/Data/ConfigData.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
<!-- Free shipping -->
<entity name="EnableFreeShippingConfigData">
<data key="path">carriers/freeshipping/active</data>
<data key="scope">carriers</data>
<data key="scope_id">1</data>
<data key="label">Yes</data>
<data key="value">1</data>
</entity>
<entity name="DisableFreeShippingConfigData">
<data key="path">carriers/freeshipping/active</data>
<data key="scope">carriers</data>
<data key="scope_id">1</data>
<data key="label">No</data>
<data key="value">0</data>
</entity>

<!-- Flat Rate shipping -->
<entity name="EnableFlatRateConfigData">
<data key="path">carriers/flatrate/active</data>
<data key="scope">carriers</data>
<data key="scope_id">1</data>
<data key="label">Yes</data>
<data key="value">1</data>
</entity>
<entity name="DisableFlatRateConfigData">
<data key="path">carriers/flatrate/active</data>
<data key="scope">carriers</data>
<data key="scope_id">1</data>
<data key="label">No</data>
<data key="value">0</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
<element name="billingAddressSelectShared" type="select" selector=".checkout-billing-address select[name='billing_address_id']"/>
<element name="billingAddressSameAsShippingShared" type="checkbox" selector="#billing-address-same-as-shipping-shared"/>
<element name="addressAction" type="button" selector="//div[@class='actions-toolbar']//span[text()='{{action}}']" parameterized="true"/>
<element name="shippingMethodInformation" type="text" selector=".ship-via .shipping-information-content"/>
</section>
</sections>
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
<element name="shippingMethodRowByName" type="text" selector="//div[@id='checkout-shipping-method-load']//td[contains(., '{{var1}}')]/.." parameterized="true"/>
<element name="flatRate" type="radio" selector="#label_carrier_flatrate_flatrate"/>
<element name="freeShippingShippingMethod" type="input" selector="#s_method_freeshipping_freeshipping" timeout="30"/>
<element name="shippingMethodFreeShipping" type="radio" selector="#checkout-shipping-method-load input[value='freeshipping_freeshipping']"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?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="AdminCheckConfigsChangesAreNotAffectedStartedCheckoutProcessTest">
<annotations>
<features value="Checkout"/>
<stories value="Changes in configs are not affecting checkout process"/>
<title value="Admin check configs changes are not affected started checkout process test"/>
<description value="Changes in admin for shipping rates are not affecting checkout process that has been started"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-8893"/>
<group value="checkout"/>
</annotations>
<before>
<!-- Create simple product -->
<createData entity="SimpleProduct3" stepKey="createProduct"/>

<!-- Enable free shipping method -->
<magentoCLI command="config:set {{EnableFreeShippingConfigData.path}} {{EnableFreeShippingConfigData.value}}" stepKey="enableFreeShipping"/>

<!-- Disable flat rate method -->
<magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/>
</before>
<after>
<!-- Roll back configuration -->
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
<magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/>

<!-- Delete simple product -->
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>

<!-- Log out -->
<actionGroup ref="logout" stepKey="logout"/>
</after>

<!-- Add product to cart -->
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
<argument name="product" value="$$createProduct$$"/>
<argument name="productCount" value="1"/>
</actionGroup>

<!-- Proceed to Checkout from mini shopping cart -->
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckout"/>

<!-- Fill all required fields -->
<actionGroup ref="GuestCheckoutFillNewShippingAddressActionGroup" stepKey="fillNewShippingAddress">
<argument name="customer" value="Simple_Customer_Without_Address"/>
<argument name="address" value="US_Address_TX"/>
</actionGroup>

<!-- Assert Free Shipping checkbox -->
<seeCheckboxIsChecked selector="{{CheckoutShippingMethodsSection.shippingMethodFreeShipping}}" stepKey="freeShippingMethodCheckboxIsChecked"/>

<!-- Click Next button -->
<click selector="{{GuestCheckoutShippingSection.next}}" stepKey="clickNext"/>
<waitForPageLoad stepKey="waitForShipmentPageLoad"/>

<!-- Payment step is opened -->
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSectionLoaded"/>

<!-- Order Summary block contains information about shipping -->
<actionGroup ref="CheckShippingMethodInCheckoutActionGroup" stepKey="guestCheckoutCheckShippingMethod">
<argument name="shippingMethod" value="freeTitleDefault.value"/>
</actionGroup>

<!-- Open new browser's window and login as Admin -->
<openNewTab stepKey="openNewTab"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>

<!-- Go to Store > Configuration > Sales > Shipping Methods -->
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/>

<!-- Enable "Flat Rate" -->
<actionGroup ref="AdminChangeFlatRateShippingMethodStatusActionGroup" stepKey="enableFlatRateShippingStatus"/>

<!-- Flush cache -->
<magentoCLI command="cache:flush" stepKey="cacheFlush"/>

<!-- Back to the Checkout and refresh the page -->
<switchToPreviousTab stepKey="switchToPreviousTab"/>
<reloadPage stepKey="refreshPage"/>
<waitForPageLoad stepKey="waitPageReload"/>

<!-- Payment step is opened after refreshing -->
<waitForElement selector="{{CheckoutPaymentSection.paymentSectionTitle}}" stepKey="waitForPaymentSection"/>

<!-- Order Summary block contains information about free shipping -->
<actionGroup ref="CheckShippingMethodInCheckoutActionGroup" stepKey="guestCheckoutCheckFreeShippingMethod">
<argument name="shippingMethod" value="freeTitleDefault.value"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<before>
<!--Set default flat rate shipping method settings-->
<createData entity="FlatRateShippingMethodDefault" stepKey="setDefaultFlatRateShippingMethod"/>
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>

<!--Create simple customer-->
<createData entity="Simple_US_CA_Customer" stepKey="simpleCustomer"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<field key="price">100</field>
</createData>
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
<createData entity="DisableFlatRateShippingMethodConfig" stepKey="disableFlatRate"/>
<magentoCLI command="config:set {{DisableFlatRateConfigData.path}} {{DisableFlatRateConfigData.value}}" stepKey="disableFlatRate"/>
<createData entity="FreeShippinMethodConfig" stepKey="enableFreeShippingMethod"/>
<createData entity="setFreeShippingSubtotal" stepKey="setFreeShippingSubtotal"/>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
Expand All @@ -34,7 +34,7 @@
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
<createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/>
<magentoCLI command="config:set {{EnableFlatRateConfigData.path}} {{EnableFlatRateConfigData.value}}" stepKey="enableFlatRate"/>
<createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/>
<createData entity="setFreeShippingSubtotalToDefault" stepKey="setFreeShippingSubtotalToDefault"/>
<actionGroup ref="logout" stepKey="logout"/>
Expand All @@ -60,4 +60,4 @@
<dontSeeElement selector="{{AdminMessagesSection.successMessage}}" stepKey="seeSuccessMessage"/>
<seeElement selector="{{AdminMessagesSection.errorMessage}}" stepKey="seeErrorMessage"/>
</test>
</tests>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</after>

<!-- Add product to the shopping cart -->
<actionGroup ref="OpenStorefrontProductPageActionGroup" stepKey="openProductPage">
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="openProductPage">
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
</actionGroup>
<actionGroup ref="StorefrontAddProductToCartActionGroup" stepKey="addProductToCart">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminChangeFlatRateShippingMethodStatusActionGroup">
<arguments>
<argument name="status" type="string" defaultValue="1"/>
</arguments>
<conditionalClick selector="{{AdminShippingMethodFlatRateSection.carriersFlatRateTab}}" dependentSelector="{{AdminShippingMethodFlatRateSection.carriersFlatRateActive}}" visible="false" stepKey="expandTab"/>
<selectOption selector="{{AdminShippingMethodFlatRateSection.carriersFlatRateActive}}" userInput="{{status}}" stepKey="changeFlatRateMethodStatus"/>
<click selector="{{AdminConfigSection.saveButton}}" stepKey="saveConfigs"/>
<waitForPageLoad stepKey="waitForPageLoad"/>
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration." stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?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="AdminShippingMethodFlatRateSection">
<element name="carriersFlatRateTab" type="button" selector="#carriers_flatrate-head"/>
<element name="carriersFlatRateActive" type="select" selector="#carriers_flatrate_active"/>
</section>
</sections>

0 comments on commit 744ffc8

Please sign in to comment.