Skip to content

Commit f41c77e

Browse files
committed
Storefront available shipping rate is changed on shipping page
created test file
1 parent 7ead0dc commit f41c77e

6 files changed

+172
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
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="StorefrontVerifyFedexShippingMethodPricesActionGroup">
12+
<annotations>
13+
<description>Validates that the Fedex Shipping method prices in the checkout page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="smartPostPrice" type="string" defaultValue="$17.25"/>
17+
<argument name="groundPrice" type="string" defaultValue="$13.72"/>
18+
<argument name="expressSaverPrice" type="string" defaultValue="$37.97"/>
19+
<argument name="twoDayPrice" type="string" defaultValue="$44.11"/>
20+
<argument name="twoDayAMPrice" type="string" defaultValue="$50.91"/>
21+
<argument name="standardOvernightPrice" type="string" defaultValue="$90.31"/>
22+
<argument name="priorityOvernightPrice" type="string" defaultValue="$100.37"/>
23+
</arguments>
24+
<waitForPageLoad stepKey="waitForPageLoad2" />
25+
<waitForText selector="{{CheckoutShippingMethodsSection.smartPostFedexPrice}}" userInput="{{smartPostPrice}}" stepKey="waitForSmartPostPriceVisible"/>
26+
<waitForText selector="{{CheckoutShippingMethodsSection.groundFedexPrice}}" userInput="{{groundPrice}}" stepKey="waitForGroundPriceVisible"/>
27+
<waitForText selector="{{CheckoutShippingMethodsSection.expressSaverFedexPrice}}" userInput="{{expressSaverPrice}}" stepKey="waitForExpressPriceVisible"/>
28+
<waitForText selector="{{CheckoutShippingMethodsSection.twoDayFedexPrice}}" userInput="{{twoDayPrice}}" stepKey="waitForTwodayPriceVisible"/>
29+
<waitForText selector="{{CheckoutShippingMethodsSection.twoDayAMFedexPrice}}" userInput="{{twoDayAMPrice}}" stepKey="waitForTwodayAMPriceVisible"/>
30+
<waitForText selector="{{CheckoutShippingMethodsSection.standardOvernightFedexPrice}}" userInput="{{standardOvernightPrice}}" stepKey="waitForStandardPriceVisible"/>
31+
<waitForText selector="{{CheckoutShippingMethodsSection.priorityOvernightFedexPrice}}" userInput="{{priorityOvernightPrice}}" stepKey="waitForOvernightPriceVisible"/>
32+
</actionGroup>
33+
</actionGroups>

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,13 @@
3737
<element name="shippingMethodFreeShippingLabel" type="text" selector="#label_carrier_freeshipping_freeshipping"/>
3838
<element name="shippingDHLErrorMessage" type="text" selector="#checkout-shipping-method-load .table-checkout-shipping-method tr.row-error .error div"/>
3939
<element name="smartPostShippingMethod" type="radio" selector="#checkout-shipping-method-load input[value='fedex_SMART_POST']"/>
40+
<element name="shippingMethodFedexLabel" type="text" selector="#label_carrier_null_fedex"/>
41+
<element name="smartPostFedexPrice" type="text" selector="//tr[td[@id='label_carrier_SMART_POST_fedex']]//td[contains(@class, 'col-price')]//span[contains(@class, 'price') and contains(@data-bind, 'price_excl_tax')]"/>
42+
<element name="groundFedexPrice" type="text" selector="//tr[td[@id='label_method_FEDEX_GROUND_fedex']]//td[contains(@class, 'col-price')]//span[contains(@class, 'price') and contains(@data-bind, 'price_excl_tax')]"/>
43+
<element name="expressSaverFedexPrice" type="text" selector="//tr[td[@id='label_method_FEDEX_EXPRESS_SAVER_fedex']]//td[contains(@class, 'col-price')]//span[contains(@class, 'price') and contains(@data-bind, 'price_excl_tax')]"/>
44+
<element name="twoDayFedexPrice" type="text" selector="//tr[td[@id='label_method_FEDEX_2_DAY_fedex']]//td[contains(@class, 'col-price')]//span[contains(@class, 'price') and contains(@data-bind, 'price_excl_tax')]"/>
45+
<element name="twoDayAMFedexPrice" type="text" selector="//tr[td[@id='label_method_FEDEX_2_DAY_AM_fedex']]//td[contains(@class, 'col-price')]//span[contains(@class, 'price') and contains(@data-bind, 'price_excl_tax')]"/>
46+
<element name="standardOvernightFedexPrice" type="text" selector="//tr[td[@id='label_method_STANDARD_OVERNIGHT_fedex']]//td[contains(@class, 'col-price')]//span[contains(@class, 'price') and contains(@data-bind, 'price_excl_tax')]"/>
47+
<element name="priorityOvernightFedexPrice" type="text" selector="//tr[td[@id='label_method_PRIORITY_OVERNIGHT_fedex']]//td[contains(@class, 'col-price')]//span[contains(@class, 'price') and contains(@data-bind, 'price_excl_tax')]"/>
4048
</section>
4149
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="StorefrontAssertAvailableShippingRateIsChangedBasedOnInputedDataTest">
12+
<annotations>
13+
<features value="Fedex"/>
14+
<stories value="Shipping Rates"/>
15+
<title value="Storefront available shipping rate is changed on shipping page"/>
16+
<description value="Testcase verifies On storefront Available shipping rate is changed on fly according to inputed data"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-9283"/>
19+
</annotations>
20+
<before>
21+
<createData entity="SimpleProduct" stepKey="createProduct">
22+
<field key="price">10</field>
23+
</createData>
24+
<actionGroup ref="CliEnableFreeShippingMethodActionGroup" stepKey="enableFreeShippingMethod"/>
25+
<actionGroup ref="AdminEnableFreeShippingToSpecificCountriesActionGroup" stepKey="enableToSpecificCountrie"/>
26+
<actionGroup ref="AdminEnableFedExConfigurationActionGroup" stepKey="enableFedEx"/>
27+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
28+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
29+
<argument name="indices" value=""/>
30+
</actionGroup>
31+
<actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache">
32+
<argument name="tags" value="config full_page"/>
33+
</actionGroup>
34+
</before>
35+
<after>
36+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
37+
<actionGroup ref="CliDisableFreeShippingMethodActionGroup" stepKey="disableFreeShipping"/>
38+
<actionGroup ref="AdminEnableFreeShippingToAllCountriesActionGroup" stepKey="enableAllCountries"/>
39+
<actionGroup ref="AdminDisableFedexConfigurationActionGroup" stepKey="disableFedEx"/>
40+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
41+
</after>
42+
<!-- Add product to cart -->
43+
<actionGroup ref="StorefrontAddSimpleProductWithQtyActionGroup" stepKey="addSimpleProductToCart">
44+
<argument name="product" value="$$createProduct$$"/>
45+
<argument name="quantity" value="1"/>
46+
</actionGroup>
47+
<!-- Go to checkout page -->
48+
<actionGroup ref="OpenStoreFrontCheckoutShippingPageActionGroup" stepKey="openCheckoutShippingPage"/>
49+
<!-- Assert Shipping Page -->
50+
<actionGroup ref="StorefrontAssertShippingAddressPageDisplayActionGroup" stepKey="assertShippingPageDisplay"/>
51+
<waitForElement selector="{{CheckoutShippingSection.emailAddress}}" stepKey="waitForEmailField" />
52+
<actionGroup ref="StorefrontCheckForFlatRateShippingMethodAvailabilityActionGroup" stepKey="verifyFlatRateShippingMethod"/>
53+
<waitForElementNotVisible selector="{{CheckoutShippingMethodsSection.shippingMethodFreeShippingLabel}}" stepKey="waitForFreeShippingLabelNotVisible"/>
54+
<waitForElementVisible selector="{{CheckoutShippingMethodsSection.shippingMethodFedexLabel}}" stepKey="waitForFedexNullLabelVisible"/>
55+
<!-- Change country value -->
56+
<selectOption selector="{{CheckoutShippingSection.country}}" userInput="Afghanistan" stepKey="fillCountryField"/>
57+
<waitForPageLoad stepKey="waitForChangeAfterCountryLoad"/>
58+
<fillField selector="{{CheckoutShippingSection.postcode}}" userInput="1001" stepKey="enterPostcode"/>
59+
<actionGroup ref="StorefrontCheckForFlatRateShippingMethodAvailabilityActionGroup" stepKey="verifyShippingMethodAfterCountryChange"/>
60+
<waitForElementVisible selector="{{CheckoutShippingMethodsSection.shippingMethodFreeShipping}}" stepKey="waitForFreeShippingVisibleAfterCountryChange"/>
61+
<waitForElementVisible selector="{{CheckoutShippingMethodsSection.shippingMethodFreeShippingLabel}}" stepKey="waitForFreeShippingLabelVisibleAfterCountryChange"/>
62+
<waitForElementVisible selector="{{CheckoutShippingMethodsSection.shippingMethodFedexLabel}}" stepKey="waitForFedexNullLabelVisibleAfterCountryChange"/>
63+
<waitForText selector="{{CheckoutShippingMethodsSection.shippingDHLErrorMessage}}" userInput="This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us." stepKey="seeFedexErrorMessage"/>
64+
<!-- Fill customer new shipping address -->
65+
<actionGroup ref="CustomerCheckoutFillNewShippingAddressActionGroup" stepKey="fillShippingAddress">
66+
<argument name="address" value="US_Address_TX"/>
67+
</actionGroup>
68+
<waitForElementNotVisible selector="{{CheckoutShippingMethodsSection.shippingMethodFreeShippingLabel}}" stepKey="againWaitForFreeShippingLabelNotVisible"/>
69+
<actionGroup ref="StorefrontCheckForFlatRateShippingMethodAvailabilityActionGroup" stepKey="verifyFlatRateShippingMethodAfterCOuntryChangeToUS"/>
70+
<actionGroup ref="StorefrontVerifyFedexShippingMethodPricesActionGroup" stepKey="verifyFedexShippingMethodPrices"/>
71+
</test>
72+
</tests>
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 2024 Adobe
5+
* All Rights Reserved.
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="AdminDisableFedexConfigurationActionGroup">
12+
<annotations>
13+
<description>Admin Disbale fedex delivery method on configuration papge.</description>
14+
</annotations>
15+
<magentoCLI command="config:set {{AdminFedexDisableForCheckoutConfigData.path}} {{AdminFedexDisableForCheckoutConfigData.value}}" stepKey="disableCheckout"/>
16+
<magentoCLI command="config:set {{AdminFedexDisableSandboxModeConfigData.path}} {{AdminFedexDisableSandboxModeConfigData.value}}" stepKey="disableSandbox"/>
17+
<magentoCLI command="config:set {{AdminFedexDisableDebugConfigData.path}} {{AdminFedexDisableDebugConfigData.value}}" stepKey="disableDebug"/>
18+
<magentoCLI command="config:set {{AdminFedexDisableShowMethodConfigData.path}} {{AdminFedexDisableShowMethodConfigData.value}}" stepKey="disableShowMethod"/>
19+
<magentoCLI command="config:set {{AdminFedexAccount.path}} ''" stepKey="accountSetting"/>
20+
<magentoCLI command="config:set {{AdminFedexHubId.path}} ''" stepKey="accountHub"/>
21+
<magentoCLI command="config:set {{AdminFedexApiKey.path}} ''" stepKey="accountApiKey"/>
22+
<magentoCLI command="config:set {{AdminFedexSecretKey.path}} ''" stepKey="accountSecretKey"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
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="AdminEnableFreeShippingToAllCountriesActionGroup">
12+
<annotations>
13+
<description>Admin Enable Free Shipping To All Countries on configuration papge.</description>
14+
</annotations>
15+
<magentoCLI command="config:set {{EnableFreeShippingToAllAllowedCountriesConfigData.path}} {{EnableFreeShippingToAllAllowedCountriesConfigData.value}}" stepKey="selectAllCountries"/>
16+
</actionGroup>
17+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
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="AdminEnableFreeShippingToSpecificCountriesActionGroup">
12+
<annotations>
13+
<description>Admin Enable Free Shipping To Specific Countries on configuration papge.</description>
14+
</annotations>
15+
<magentoCLI command="config:set {{EnableFreeShippingToSpecificCountriesConfigData.path}} {{EnableFreeShippingToSpecificCountriesConfigData.value}}" stepKey="selectSpecificCountriesForFreeShipping"/>
16+
<magentoCLI command="config:set {{EnableFreeShippingToAfghanistanConfigData.path}} {{EnableFreeShippingToAfghanistanConfigData.value}}" stepKey="selectCountry"/>
17+
</actionGroup>
18+
</actionGroups>

0 commit comments

Comments
 (0)