|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | +/** |
| 4 | + * Copyright 2026 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="AdminMassUpdateProductSpecialPriceDateValidationTest"> |
| 11 | + <annotations> |
| 12 | + <features value="Catalog"/> |
| 13 | + <stories value="Mass update product attributes"/> |
| 14 | + <title value="Mass update product special price with invalid date range should display validation error"/> |
| 15 | + <description value="Validates special price date range during mass product attribute update"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-15367"/> |
| 18 | + <group value="catalog"/> |
| 19 | + <group value="product_attributes"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Step 1: Login to magento admin panel. --> |
| 23 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 24 | + <!-- Create test data: category and SIMPLE products --> |
| 25 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 26 | + <createData entity="ApiSimpleProduct" stepKey="createProductOne"> |
| 27 | + <requiredEntity createDataKey="createCategory"/> |
| 28 | + </createData> |
| 29 | + <createData entity="ApiSimpleProduct" stepKey="createProductTwo"> |
| 30 | + <requiredEntity createDataKey="createCategory"/> |
| 31 | + </createData> |
| 32 | + </before> |
| 33 | + <after> |
| 34 | + <!-- Cleanup: Delete created products and category --> |
| 35 | + <helper class="Magento\Catalog\Test\Mftf\Helper\ProductApiHelper" method="deleteAllProductsApi" stepKey="deleteAllProductsViaApi"/> |
| 36 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 37 | + <actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductFilter"/> |
| 38 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
| 39 | + </after> |
| 40 | + <!-- Step 2: Navigate to Catalog > Products to open the product grid --> |
| 41 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/> |
| 42 | + <actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="resetGrid"/> |
| 43 | + <!-- Step 3: Select one or more products using the checkbox. --> |
| 44 | + <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectFirstProduct"> |
| 45 | + <argument name="product" value="$createProductOne$"/> |
| 46 | + </actionGroup> |
| 47 | + <actionGroup ref="AdminCheckProductOnProductGridActionGroup" stepKey="selectSecondProduct"> |
| 48 | + <argument name="product" value="$createProductTwo$"/> |
| 49 | + </actionGroup> |
| 50 | + <!-- Step 4: From the Actions dropdown, choose Update Attributes --> |
| 51 | + <actionGroup ref="AdminClickMassUpdateProductAttributesActionGroup" stepKey="clickMassUpdateAttributes"/> |
| 52 | + <!-- Step 5: Enable special price date fields and set invalid dates --> |
| 53 | + <checkOption selector="{{AdminUpdateAttributesSection.toggleSpecialFromDate}}" stepKey="enableSpecialFromDateToggle"/> |
| 54 | + <checkOption selector="{{AdminUpdateAttributesSection.toggleSpecialToDate}}" stepKey="enableSpecialToDateToggle"/> |
| 55 | + <checkOption selector="{{AdminUpdateAttributesSection.toggleSpecialPrice}}" stepKey="enableSpecialPriceToggle"/> |
| 56 | + <waitForElementVisible selector="{{AdminEditProductAttributesSection.attributeInput('special_from_date')}}" stepKey="waitForFromDateField"/> |
| 57 | + <!-- Set Special Price From Date to a date AFTER Special Price To Date (Invalid) --> |
| 58 | + <fillField selector="{{AdminEditProductAttributesSection.attributeInput('special_from_date')}}" userInput="12/31/2026" stepKey="fillSpecialPriceFromDateWithInvalidFutureDate"/> |
| 59 | + <fillField selector="{{AdminEditProductAttributesSection.attributeInput('special_to_date')}}" userInput="01/01/2026" stepKey="fillToDate"/> |
| 60 | + <fillField selector="{{AdminEditProductAttributesSection.attributeInput('special_price')}}" userInput="5.00" stepKey="fillSpecialPrice"/> |
| 61 | + <!-- Click Save button --> |
| 62 | + <click selector="{{AdminEditProductAttributesSection.Save}}" stepKey="clickSaveButton"/> |
| 63 | + <waitForPageLoad stepKey="waitForSaveAction"/> |
| 64 | + <!-- Step 6: Verify error message --> |
| 65 | + <waitForText selector="{{AdminMessagesSection.errorMessage}}" userInput="{{ProductAttributeMessages.special_price_date_validation_error}}" stepKey="seeValidationErrorMessage"/> |
| 66 | + </test> |
| 67 | +</tests> |
0 commit comments