|
| 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" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="StorefrontVerifySingleProductCatalogPriceRuleAcrossWebsitesTest"> |
| 11 | + <annotations> |
| 12 | + <features value="CatalogRule"/> |
| 13 | + <stories value="Apply catalog price rule"/> |
| 14 | + <title value="Catalog rule should apply for product on multiple websites"/> |
| 15 | + <description value="Testcase verifies On storefront catalog price rule applied for product on multiple websites"/> |
| 16 | + <severity value="CRITICAL"/> |
| 17 | + <testCaseId value="AC-7409"/> |
| 18 | + </annotations> |
| 19 | + <before> |
| 20 | + <!--Create dropdown product attribute--> |
| 21 | + <createData entity="productAttributeAgeGroupDropdown" stepKey="createDropdownAttribute"/> |
| 22 | + <!--Create attribute options--> |
| 23 | + <createData entity="productAttributeOptionAdult" stepKey="createFirstAttributeOption"> |
| 24 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 25 | + </createData> |
| 26 | + <createData entity="productAttributeOptionChildren" stepKey="createSecondAttributeOption"> |
| 27 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 28 | + </createData> |
| 29 | + <!--Add attribute to default attribute set--> |
| 30 | + <createData entity="AddToDefaultSet" stepKey="addAttributeToDefaultSet"> |
| 31 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 32 | + </createData> |
| 33 | + <!-- Create Simple Product --> |
| 34 | + <createData entity="SimpleProduct" stepKey="createProduct"> |
| 35 | + <field key="price">100.00</field> |
| 36 | + </createData> |
| 37 | + <!-- Login as Admin --> |
| 38 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 39 | + <!--Create custom website --> |
| 40 | + <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createCustomWebsite"> |
| 41 | + <argument name="newWebsiteName" value="{{NewWebSiteData.name}}"/> |
| 42 | + <argument name="websiteCode" value="{{NewWebSiteData.code}}"/> |
| 43 | + </actionGroup> |
| 44 | + <!-- Create custom store--> |
| 45 | + <actionGroup ref="AdminCreateNewStoreGroupActionGroup" stepKey="createCustomStore"> |
| 46 | + <argument name="website" value="{{NewWebSiteData.name}}"/> |
| 47 | + <argument name="storeGroupName" value="{{NewWebSiteData.name}}"/> |
| 48 | + <argument name="storeGroupCode" value="{{NewWebSiteData.code}}"/> |
| 49 | + </actionGroup> |
| 50 | + <!-- Create custom store view--> |
| 51 | + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createCustomStoreView"> |
| 52 | + <argument name="StoreGroup" value="NewWebSiteData"/> |
| 53 | + <argument name="customStore" value="NewWebSiteData"/> |
| 54 | + </actionGroup> |
| 55 | + </before> |
| 56 | + <after> |
| 57 | + <!--set main website as default--> |
| 58 | + <actionGroup ref="AdminSetDefaultWebsiteActionGroup" stepKey="setMainWebsiteAsDefault"> |
| 59 | + <argument name="websiteName" value="Main Website"/> |
| 60 | + </actionGroup> |
| 61 | + <!-- Delete product --> |
| 62 | + <deleteData createDataKey="createProduct" stepKey="deleteFirstProduct"/> |
| 63 | + <deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/> |
| 64 | + <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteCustomWebsite"> |
| 65 | + <argument name="websiteName" value="{{NewWebSiteData.name}}"/> |
| 66 | + </actionGroup> |
| 67 | + <!-- Delete created price rules --> |
| 68 | + <actionGroup ref="RemoveCatalogPriceRuleActionGroup" stepKey="deleteCatalogPriceRule"> |
| 69 | + <argument name="ruleName" value="{{_defaultCatalogRule.name}}"/> |
| 70 | + </actionGroup> |
| 71 | + <!-- Logout --> |
| 72 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> |
| 73 | + </after> |
| 74 | + <!--Assign product to custom website--> |
| 75 | + <actionGroup ref="AdminProductPageOpenByIdActionGroup" stepKey="goToProductEditPage"> |
| 76 | + <argument name="productId" value="$$createProduct.id$$"/> |
| 77 | + </actionGroup> |
| 78 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 79 | + <actionGroup ref="SelectProductInWebsitesActionGroup" stepKey="selectWebsiteInProduct"> |
| 80 | + <argument name="website" value="{{NewWebSiteData.name}}"/> |
| 81 | + </actionGroup> |
| 82 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> |
| 83 | + <!--Switch scope to Default store view--> |
| 84 | + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="SwitchDefaultStoreView"> |
| 85 | + <argument name="storeViewName" value="'Default Store View'"/> |
| 86 | + </actionGroup> |
| 87 | + <uncheckOption selector="{{AdminProductFormSection.attributeOptionUncheckDefaultValue('$$createDropdownAttribute.attribute_code$$')}}" stepKey="unCheckDefaultValueInDefaultStoreview"/> |
| 88 | + <selectOption selector="{{AdminProductFormSection.customSelectAttribute('$$createDropdownAttribute.attribute_code$$')}}" userInput="Adult" stepKey="selectValueForAttributeInDefaultStoreview"/> |
| 89 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductInDefaultStoreView"/> |
| 90 | + <!--Switch scope to custom store view--> |
| 91 | + <actionGroup ref="SwitchToTheNewStoreViewActionGroup" stepKey="switchScopeToCustomStoreView"> |
| 92 | + <argument name="storeViewName" value="{{NewWebSiteData.name}}"/> |
| 93 | + </actionGroup> |
| 94 | + <uncheckOption selector="{{AdminProductFormSection.attributeOptionUncheckDefaultValue('$$createDropdownAttribute.attribute_code$$')}}" stepKey="unCheckDefaultValueInCustomStoreview"/> |
| 95 | + <selectOption selector="{{AdminProductFormSection.customSelectAttribute('$$createDropdownAttribute.attribute_code$$')}}" userInput="children" stepKey="selectValueForAttributeInCustomStoreview"/> |
| 96 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductInCustomStoreView"/> |
| 97 | + <!-- create catalog price with 50% discount and condition --> |
| 98 | + <actionGroup ref="AdminOpenNewCatalogPriceRuleFormPageActionGroup" stepKey="openNewCatalogPriceRulePage"/> |
| 99 | + <actionGroup ref="AdminCatalogPriceRuleFillMainInfoActionGroup" stepKey="fillMainInfoForSecondCatalogPriceRule"> |
| 100 | + <argument name="websites" value="'Main Website',{{NewWebSiteData.name}}"/> |
| 101 | + </actionGroup> |
| 102 | + <actionGroup ref="AdminFillCatalogRuleConditionWithSelectAttributeActionGroup" stepKey="fillConditionsForCatalogPriceRule"> |
| 103 | + <argument name="condition" value="$$createDropdownAttribute.default_frontend_label$$"/> |
| 104 | + <argument name="conditionValue" value="Adult"/> |
| 105 | + </actionGroup> |
| 106 | + <actionGroup ref="AdminCatalogPriceRuleFillActionsActionGroup" stepKey="fillActionsForCatalogPriceRule"> |
| 107 | + <argument name="discountAmount" value="50"/> |
| 108 | + </actionGroup> |
| 109 | + <actionGroup ref="AdminCatalogPriceRuleSaveAndApplyActionGroup" stepKey="saveAndApplyCatalogPriceRule"/> |
| 110 | + <actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex"> |
| 111 | + <argument name="indices" value=""/> |
| 112 | + </actionGroup> |
| 113 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="cleanCache"> |
| 114 | + <argument name="tags" value="config full_page"/> |
| 115 | + </actionGroup> |
| 116 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="goToProductOnStorefront"> |
| 117 | + <argument name="product" value="$$createProduct$$"/> |
| 118 | + </actionGroup> |
| 119 | + <waitForText selector="{{StorefrontProductInfoMainSection.updatedPrice}}" userInput="$50.00" stepKey="assertProductPriceAmountOnMainWebsite"/> |
| 120 | + <actionGroup ref="AdminSetDefaultWebsiteActionGroup" stepKey="setSecondaryWebsiteAsDefault"> |
| 121 | + <argument name="websiteName" value="{{NewWebSiteData.name}}"/> |
| 122 | + </actionGroup> |
| 123 | + <!-- Clean config and full page cache--> |
| 124 | + <actionGroup ref="CliCacheCleanActionGroup" stepKey="flushCache"> |
| 125 | + <argument name="tags" value="config full_page"/> |
| 126 | + </actionGroup> |
| 127 | + <actionGroup ref="StorefrontOpenProductEntityPageActionGroup" stepKey="openProductOnStorefront"> |
| 128 | + <argument name="product" value="$$createProduct$$"/> |
| 129 | + </actionGroup> |
| 130 | + <waitForText selector="{{StorefrontProductInfoMainSection.updatedPrice}}" userInput="$100.00" stepKey="assertProductPriceAmountOnCustomWebsite"/> |
| 131 | + </test> |
| 132 | +</tests> |
0 commit comments