|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | +/** |
| 4 | + * Copyright 2025 Adobe |
| 5 | + * All Rights Reserved. |
| 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="StorefrontValidatePriceTest"> |
| 11 | + <annotations> |
| 12 | + <features value="Catalog"/> |
| 13 | + <stories value="Validate Price in frontend product search and product details pages"/> |
| 14 | + <title value="Product price validation"/> |
| 15 | + <description value="This test case verifies price in frontend product search and product details pages based on catalog price scope"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-3183"/> |
| 18 | + <group value="catalog"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Precondition 2:Create Customer with allowed remote shopping assistance--> |
| 22 | + <createData entity="Simple_US_Customer_Assistance_Allowed" stepKey="createCustomer"/> |
| 23 | + <!-- Precondition 4:Create Simple Product --> |
| 24 | + <createData entity="_defaultProduct" stepKey="createProduct"> |
| 25 | + <field key="price">100</field> |
| 26 | + </createData> |
| 27 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/> |
| 28 | + <!-- Precondition 1:Create website--> |
| 29 | + <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite"> |
| 30 | + <argument name="newWebsiteName" value="{{customWebsite.name}}"/> |
| 31 | + <argument name="websiteCode" value="{{customWebsite.code}}"/> |
| 32 | + </actionGroup> |
| 33 | + <!-- Create second store --> |
| 34 | + <actionGroup ref="CreateCustomStoreActionGroup" stepKey="createCustomStore"> |
| 35 | + <argument name="website" value="{{customWebsite.name}}"/> |
| 36 | + <argument name="store" value="{{customStoreGroup.name}}"/> |
| 37 | + <argument name="rootCategory" value="Default Category"/> |
| 38 | + </actionGroup> |
| 39 | + <!-- Create second store view --> |
| 40 | + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView"> |
| 41 | + <argument name="StoreGroup" value="customStoreGroup"/> |
| 42 | + <argument name="customStore" value="customStoreEN"/> |
| 43 | + </actionGroup> |
| 44 | + <!--Open customer edit page--> |
| 45 | + <actionGroup ref="AdminOpenCustomerEditPageActionGroup" stepKey="openCustomerEditPage"> |
| 46 | + <argument name="customerId" value="$createCustomer.id$"/> |
| 47 | + </actionGroup> |
| 48 | + <!--Navigate to "Account Information" tab--> |
| 49 | + <actionGroup ref="AdminOpenAccountInformationTabFromCustomerEditPageActionGroup" stepKey="openAccountInformationEditPage"/> |
| 50 | + <!-- Precondition 3:Assign customer to custom website--> |
| 51 | + <actionGroup ref="AdminUpdateCustomerWebsiteInCustomerInformationPageActionGroup" stepKey="updateCustomerWebsite"> |
| 52 | + <argument name="websiteName" value="{{customWebsite.name}}"/> |
| 53 | + </actionGroup> |
| 54 | + <!--Verify that changes are saved successfully--> |
| 55 | + <actionGroup ref="AdminSaveCustomerAndAssertSuccessMessage" stepKey="assertThatChangesAreSavedSuccessfully"/> |
| 56 | + </before> |
| 57 | + <after> |
| 58 | + <!-- Logout from customer, delete product, customer, website --> |
| 59 | + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> |
| 60 | + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> |
| 61 | + <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> |
| 62 | + <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> |
| 63 | + <argument name="websiteName" value="{{customWebsite.name}}"/> |
| 64 | + </actionGroup> |
| 65 | + </after> |
| 66 | + <!-- Step-1: Set catalog price scope to website --> |
| 67 | + <actionGroup ref="AdminSetCatalogPriceToWebsiteActionGroup" stepKey="setPriceScopeWebsite"/> |
| 68 | + <!-- Step 2: Reindex and cache clear --> |
| 69 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> |
| 70 | + <argument name="indices" value=""/> |
| 71 | + </actionGroup> |
| 72 | + <actionGroup ref="CliCacheFlushActionGroup" stepKey="cleanCache"> |
| 73 | + <argument name="tags" value=""/> |
| 74 | + </actionGroup> |
| 75 | + <!-- Step 3: Open created product and assign to website--> |
| 76 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openProductEdit"> |
| 77 | + <argument name="productId" value="$createProduct.id$"/> |
| 78 | + </actionGroup> |
| 79 | + <actionGroup ref="AdminAssignProductInWebsiteActionGroup" stepKey="assignProductToSecondWebsite"> |
| 80 | + <argument name="website" value="{{customWebsite.name}}"/> |
| 81 | + </actionGroup> |
| 82 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveTheProduct"/> |
| 83 | + <!-- Step 4: Edit product and change the price in default scope--> |
| 84 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="openTheProductEdit"> |
| 85 | + <argument name="productId" value="$createProduct.id$"/> |
| 86 | + </actionGroup> |
| 87 | + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchDefaultStoreView"> |
| 88 | + <argument name="storeViewName" value="'Default Store View'"/> |
| 89 | + </actionGroup> |
| 90 | + <waitForElementVisible selector="{{AdminProductFormSection.productPrice}}" stepKey="waitForProductPriceField"/> |
| 91 | + <uncheckOption selector="{{AdminProductFormSection.productPriceUseDefault}}" stepKey="uncheckPriceDefaultValue"/> |
| 92 | + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="150" stepKey="fillSimpleProductPrice"/> |
| 93 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductPrice"/> |
| 94 | + <!-- Step 5: Edit product and change the price in custom website--> |
| 95 | + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="changeScopeToStoreView2"> |
| 96 | + <argument name="storeViewName" value="{{customStoreEN.name}}"/> |
| 97 | + </actionGroup> |
| 98 | + <waitForElementVisible selector="{{AdminProductFormSection.productPrice}}" stepKey="waitForTheProductPriceField"/> |
| 99 | + <uncheckOption selector="{{AdminProductFormSection.productPriceUseDefault}}" stepKey="uncheckThePriceDefaultValue"/> |
| 100 | + <fillField selector="{{AdminProductFormSection.productPrice}}" userInput="200" stepKey="fillTheSimpleProductPrice"/> |
| 101 | + <!--Save product--> |
| 102 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> |
| 103 | + <!--Step6: From admin login as customer to storefront and verify website scope product price is displayed in catalog search results page and product details page --> |
| 104 | + <actionGroup ref="AdminLoginAsCustomerLoginFromCustomerPageActionGroup" stepKey="loginAsCustomerFromCustomerPage"> |
| 105 | + <argument name="customerId" value="$$createCustomer.id$$"/> |
| 106 | + </actionGroup> |
| 107 | + <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName"> |
| 108 | + <argument name="phrase" value="$createProduct.name$"/> |
| 109 | + </actionGroup> |
| 110 | + <waitForPageLoad stepKey="waitForSearchResultsPage" /> |
| 111 | + <waitForText selector="{{StorefrontCategoryMainSection.productPrice}}" userInput="$200.00" stepKey="seeWebsiteScopeProductPriceInSearchResultsPage"/> |
| 112 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openProductPage"> |
| 113 | + <argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/> |
| 114 | + </actionGroup> |
| 115 | + <waitForText userInput="$200.00" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeWebsiteScopeProductPrice"/> |
| 116 | + <!-- Step 7: Set catalog price scope to website --> |
| 117 | + <actionGroup ref="AdminSetDefaultCatalogPriceActionGroup" stepKey="setScopeGlobal"/> |
| 118 | + <!-- Step 8: Reindex and cache clear --> |
| 119 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexing"> |
| 120 | + <argument name="indices" value=""/> |
| 121 | + </actionGroup> |
| 122 | + <actionGroup ref="CliCacheFlushActionGroup" stepKey="cacheClean"> |
| 123 | + <argument name="tags" value=""/> |
| 124 | + </actionGroup> |
| 125 | + <!--Step 9: Login as customer to storefront and verify global scope product price is displayed in catalog search results page and product details page --> |
| 126 | + <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchByProductName"> |
| 127 | + <argument name="phrase" value="$createProduct.name$"/> |
| 128 | + </actionGroup> |
| 129 | + <waitForPageLoad stepKey="waitSearchResult"/> |
| 130 | + <waitForText selector="{{StorefrontCategoryMainSection.productPrice}}" userInput="$100.00" stepKey="seeGlobalPrice"/> |
| 131 | + <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openTheProductPage"> |
| 132 | + <argument name="productUrl" value="$createProduct.custom_attributes[url_key]$"/> |
| 133 | + </actionGroup> |
| 134 | + <waitForPageLoad stepKey="waitForTheProductPageToOpen"/> |
| 135 | + <waitForText userInput="$100.00" selector="{{StorefrontProductInfoMainSection.price}}" stepKey="seeTheGlobalPrice"/> |
| 136 | + </test> |
| 137 | +</tests> |
0 commit comments