Skip to content

Commit

Permalink
Merge pull request #160 from magento-pangolin/MC-7438
Browse files Browse the repository at this point in the history
MC-7438 Backport for MC-13581
  • Loading branch information
kabothu authored Jun 13, 2019
2 parents 449fb1e + 7be090a commit 3eae1da
Show file tree
Hide file tree
Showing 13 changed files with 302 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?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="OpenStoreFrontProductPageActionGroup">
<arguments>
<argument name="productUrlKey" type="string"/>
</arguments>
<amOnPage url="{{StorefrontProductPage.url(productUrlKey)}}" stepKey="amOnProductPage"/>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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">
<!-- Assert shipping method name and price are present in cart -->
<actionGroup name="StorefrontAssertShippingMethodOptionPresentInCartActionGroup">
<arguments>
<argument name="methodName" type="string"/>
<argument name="price" type="string"/>
</arguments>
<see selector="{{StorefrontCheckoutCartSummarySection.methodName}}" userInput="{{methodName}}" stepKey="seeShippingName"/>
<see selector="{{StorefrontCheckoutCartSummarySection.shippingPrice}}" userInput="{{price}}" stepKey="seeShippingPrice"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@
<element name="tableTotals" type="text" selector="#cart-totals .data.table.totals"/>
<element name="shippingMethodLabel" type="text" selector="#co-shipping-method-form dl dt span"/>
<element name="shippingMethodElementId" type="radio" selector="#s_method_{{carrierCode}}_{{methodCode}}" parameterized="true"/>
<element name="methodName" type="text" selector="#co-shipping-method-form label"/>
<element name="shippingPrice" type="text" selector="#co-shipping-method-form span .price"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?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="AdminSaveConfigActionGroup">
<click selector="{{AdminConfigSection.saveButton}}" stepKey="clickSaveConfigBtn"/>
<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,22 @@
<?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="LoginToStorefrontActionGroup">
<arguments>
<argument name="Customer"/>
</arguments>
<amOnPage url="{{StorefrontCustomerSignInPage.url}}" stepKey="amOnSignInPage"/>
<waitForPageLoad stepKey="waitPageFullyLoaded"/>
<waitForElementVisible selector="{{StorefrontCustomerSignInFormSection.emailField}}" stepKey="waitFormAppears"/>
<fillField userInput="{{Customer.email}}" selector="{{StorefrontCustomerSignInFormSection.emailField}}" stepKey="fillEmail"/>
<fillField userInput="{{Customer.password}}" selector="{{StorefrontCustomerSignInFormSection.passwordField}}" stepKey="fillPassword"/>
<click selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}" stepKey="clickSignInAccountButton"/>
<waitForPageLoad stepKey="waitForCustomerLoggedIn" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?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">
<!-- Enable/Disable Table Rates shipping method -->
<actionGroup name="AdminChangeTableRatesShippingMethodStatusActionGroup">
<arguments>
<argument name="status" type="string" defaultValue="1"/>
</arguments>
<conditionalClick selector="{{AdminShippingMethodTableRatesSection.carriersTableRateTab}}" dependentSelector="{{AdminShippingMethodTableRatesSection.carriersTableRateActive}}" visible="false" stepKey="expandTab"/>
<uncheckOption selector="{{AdminShippingMethodTableRatesSection.enabledUseSystemValue}}" stepKey="uncheckUseSystemValue"/>
<selectOption selector="{{AdminShippingMethodTableRatesSection.carriersTableRateActive}}" userInput="{{status}}" stepKey="changeTableRatesMethodStatus"/>
</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.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminOpenShippingMethodsConfigPageActionGroup">
<amOnPage url="{{AdminShippingMethodsConfigPage.url}}" stepKey="navigateToAdminShippingMethodsPage"/>
<waitForPageLoad stepKey="waitForAdminShippingMethodsPageToLoad"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?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">
<!-- Prices from file "table_rate_30895.csv" -->
<entity name="TableRatesWeightVSDestination" type="shipping_method">
<data key="condition">Weight vs. Destination</data>
<data key="priceCA">5.00</data>
<data key="price">10.00</data>
<data key="title">Best Way</data>
<data key="methodName">Table Rate</data>
</entity>
</entities>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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="AdminShippingMethodTableRatesSection">
<element name="carriersTableRateTab" type="button" selector="#carriers_tablerate-head"/>
<element name="enabledUseSystemValue" type="checkbox" selector="#carriers_tablerate_active_inherit"/>
<element name="carriersTableRateActive" type="select" selector="#carriers_tablerate_active"/>
<element name="condition" type="select" selector="#carriers_tablerate_condition_name"/>
<element name="importFile" type="input" selector="#carriers_tablerate_import"/>
</section>
</sections>
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<?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="TableRatesShippingMethodForDifferentStatesTest">
<annotations>
<features value="Shipping"/>
<stories value="Table Rates"/>
<title value="Table rates shipping method for different states test"/>
<description value="Checkout with Table Rates for different states of the USA"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-7438"/>
<group value="shipping"/>
</annotations>
<before>
<!-- Create product -->
<createData entity="SimpleProduct3" stepKey="createProduct"/>

<!-- Create customer -->
<createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/>

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
</before>
<after>
<!-- Delete product -->
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>

<!-- Delete customer -->
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>

<!-- Rollback config -->
<actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodSystemConfigPage"/>
<actionGroup ref="AdminSwitchWebsiteByNameActionGroup" stepKey="AdminSwitchStoreViewToMainWebsite">
<argument name="website" value="_defaultWebsite"/>
</actionGroup>
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="disableTableRatesShippingMethod">
<argument name="status" value="0"/>
</actionGroup>
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveSystemConfig"/>

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

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

<!-- Switch to Website scope -->
<actionGroup ref="AdminSwitchWebsiteByNameActionGroup" stepKey="AdminSwitchStoreView">
<argument name="website" value="_defaultWebsite"/>
</actionGroup>

<!-- Enable Table Rate method and save config -->
<actionGroup ref="AdminChangeTableRatesShippingMethodStatusActionGroup" stepKey="enableTableRatesShippingMethod"/>
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfig"/>

<!-- Make sure you have Condition Weight vs. Destination -->
<see selector="{{AdminShippingMethodTableRatesSection.condition}}" userInput="{{TableRatesWeightVSDestination.condition}}" stepKey="seeDefaultCondition"/>

<!-- Import file and save config -->
<attachFile selector="{{AdminShippingMethodTableRatesSection.importFile}}" userInput="table_rate_30895.csv" stepKey="attachFileForImport"/>
<actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveConfigs"/>

<!-- Login as customer -->
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
<argument name="Customer" value="$$createCustomer$$"/>
</actionGroup>

<!-- Add product to the shopping 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>

<!-- Open the shopping cart page -->
<actionGroup ref="StorefrontOpenCartFromMinicartActionGroup" stepKey="openShoppingCart"/>

<!-- Expand Estimate Shipping and Tax section in Summary -->
<conditionalClick selector="{{StorefrontCheckoutCartSummarySection.estimateShippingAndTax}}" dependentSelector="{{StorefrontCheckoutCartSummarySection.country}}" visible="false" stepKey="expandEstimateShippingAndTax"/>
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>

<!-- See available Table Rate option -->
<actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabel">
<argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/>
</actionGroup>
<actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOption">
<argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/>
<argument name="price" value="{{TableRatesWeightVSDestination.priceCA}}"/>
</actionGroup>

<!-- Change State to New York -->
<selectOption selector="{{StorefrontCheckoutCartSummarySection.region}}" userInput="{{US_Address_NY.state}}" stepKey="selectAnotherState"/>
<waitForPageLoad stepKey="waitForShippingMethodLoad"/>

<!-- See available Table Rate option for another state -->
<actionGroup ref="StorefrontAssertShippingMethodPresentInCartActionGroup" stepKey="assertShippingMethodLabelForAnotherState">
<argument name="shippingMethod" value="{{TableRatesWeightVSDestination.title}}"/>
</actionGroup>
<actionGroup ref="StorefrontAssertShippingMethodOptionPresentInCartActionGroup" stepKey="assertShippingMethodOptionForAnotherState">
<argument name="methodName" value="{{TableRatesWeightVSDestination.methodName}}"/>
<argument name="price" value="{{TableRatesWeightVSDestination.price}}"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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="AdminSwitchWebsiteByNameActionGroup">
<arguments>
<argument name="website"/>
</arguments>
<scrollToTopOfPage stepKey="scrollToTop"/>
<click selector="{{AdminMainActionsSection.storeViewDropdown}}" stepKey="clickWebsiteSwitchDropdown"/>
<waitForElementVisible selector="{{AdminMainActionsSection.websiteByName('Main Website')}}" stepKey="waitForWebsiteAreVisible"/>
<click selector="{{AdminMainActionsSection.websiteByName(website.name)}}" stepKey="clickWebsiteByName"/>
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitingForInformationModal"/>
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmStoreSwitch"/>
<see userInput="{{website.name}}" selector="{{AdminMainActionsSection.storeSwitcher}}" stepKey="seeNewWebsiteName"/>
</actionGroup>
</actionGroups>
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.
*/
-->

<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
<page name="AdminShippingMethodsConfigPage" url="admin/system_config/edit/section/carriers/" area="admin" module="Magento_Ups">
<section name="AdminShippingMethodsUpsSection"/>
</page>
</pages>
3 changes: 3 additions & 0 deletions dev/tests/acceptance/tests/_data/table_rate_30895.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Country,Region/State,Zip/Postal Code,Weight (and above),Shipping Price
US,CA,*,0,5
US,*,*,0,10

0 comments on commit 3eae1da

Please sign in to comment.