|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<!-- |
| 3 | + /** |
| 4 | + * Copyright © Magento, Inc. All rights reserved. |
| 5 | + * See COPYING.txt for license details. |
| 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="AdminProductGridFilteringByCustomAttributeTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <stories value="Product grid"/> |
| 15 | + <title value="Sorting the product grid by custom product attribute"/> |
| 16 | + <description value="Sorting the product grid by custom product attribute should sort Alphabetically instead of value id"/> |
| 17 | + <severity value="MAJOR"/> |
| 18 | + <useCaseId value="MC-19031"/> |
| 19 | + <testCaseId value="MC-20329"/> |
| 20 | + <group value="catalog"/> |
| 21 | + </annotations> |
| 22 | + <before> |
| 23 | + <!--Login as admin and delete all products --> |
| 24 | + <actionGroup ref="LoginAsAdmin" stepKey="login"/> |
| 25 | + <actionGroup ref="deleteAllProductsUsingProductGrid" stepKey="deleteAllProducts"/> |
| 26 | + <!--Create dropdown product attribute--> |
| 27 | + <createData entity="productDropDownAttribute" stepKey="createDropdownAttribute"/> |
| 28 | + <!--Create attribute options--> |
| 29 | + <createData entity="ProductAttributeOption7" stepKey="createFirstProductAttributeOption"> |
| 30 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 31 | + </createData> |
| 32 | + <createData entity="ProductAttributeOption8" stepKey="createSecondProductAttributeOption"> |
| 33 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 34 | + </createData> |
| 35 | + <createData entity="ProductAttributeOption9" stepKey="createThirdProductAttributeOption"> |
| 36 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 37 | + </createData> |
| 38 | + <!--Add attribute to default attribute set--> |
| 39 | + <createData entity="AddToDefaultSet" stepKey="addAttributeToDefaultSet"> |
| 40 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 41 | + </createData> |
| 42 | + <!--Create category--> |
| 43 | + <createData entity="_defaultCategory" stepKey="createCategory"/> |
| 44 | + <!--Create 3 products--> |
| 45 | + <createData entity="ApiSimpleProduct" stepKey="createFirstProduct"> |
| 46 | + <requiredEntity createDataKey="createCategory"/> |
| 47 | + </createData> |
| 48 | + <createData entity="ApiSimpleProduct" stepKey="createSecondProduct"> |
| 49 | + <requiredEntity createDataKey="createCategory"/> |
| 50 | + </createData> |
| 51 | + <createData entity="ApiSimpleProduct" stepKey="createThirdProduct"> |
| 52 | + <requiredEntity createDataKey="createCategory"/> |
| 53 | + </createData> |
| 54 | + <!--Update first product--> |
| 55 | + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForFirstProduct"> |
| 56 | + <argument name="product" value="$$createFirstProduct$$"/> |
| 57 | + </actionGroup> |
| 58 | + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="editFirstProduct"> |
| 59 | + <argument name="product" value="$$createFirstProduct$$"/> |
| 60 | + </actionGroup> |
| 61 | + <selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createFirstProductAttributeOption.option[store_labels][0][label]$$" stepKey="setFirstAttributeValue"/> |
| 62 | + <actionGroup ref="saveProductForm" stepKey="saveFirstProduct"/> |
| 63 | + <!--Update second product--> |
| 64 | + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSecondProduct"> |
| 65 | + <argument name="product" value="$$createSecondProduct$$"/> |
| 66 | + </actionGroup> |
| 67 | + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="editSecondProduct"> |
| 68 | + <argument name="product" value="$$createSecondProduct$$"/> |
| 69 | + </actionGroup> |
| 70 | + <selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createSecondProductAttributeOption.option[store_labels][0][label]$$" stepKey="setSecondAttributeValue"/> |
| 71 | + <actionGroup ref="saveProductForm" stepKey="saveSecondProduct"/> |
| 72 | + <!--Update third product--> |
| 73 | + <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForThirdProduct"> |
| 74 | + <argument name="product" value="$$createThirdProduct$$"/> |
| 75 | + </actionGroup> |
| 76 | + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="editThirdProduct"> |
| 77 | + <argument name="product" value="$$createThirdProduct$$"/> |
| 78 | + </actionGroup> |
| 79 | + <selectOption selector="{{AdminProductFormSection.customSelectField($$createDropdownAttribute.attribute[attribute_code]$$)}}" userInput="$$createThirdProductAttributeOption.option[store_labels][0][label]$$" stepKey="setThirdAttributeValue"/> |
| 80 | + <actionGroup ref="saveProductForm" stepKey="saveThirdProduct"/> |
| 81 | + </before> |
| 82 | + <after> |
| 83 | + <!--Delete products--> |
| 84 | + <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> |
| 85 | + <deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/> |
| 86 | + <deleteData createDataKey="createThirdProduct" stepKey="deleteThirdProduct"/> |
| 87 | + <!--Delete attribute--> |
| 88 | + <deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/> |
| 89 | + <!--Delete category--> |
| 90 | + <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
| 91 | + <actionGroup ref="NavigateToAndResetProductGridToDefaultView" stepKey="NavigateToAndResetProductGridToDefaultViewAfterTest"/> |
| 92 | + <actionGroup ref="logout" stepKey="logout"/> |
| 93 | + </after> |
| 94 | + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> |
| 95 | + <waitForPageLoad stepKey="waitForProductGridPageLoad"/> |
| 96 | + <actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearProductGridFilters"/> |
| 97 | + <!--Sort by custom attribute DESC using grabbed value--> |
| 98 | + <conditionalClick selector="{{AdminProductGridSection.columnHeader($$createDropdownAttribute.attribute[frontend_labels][0][label]$$)}}" dependentSelector="{{AdminProductGridSection.columnHeader($$createDropdownAttribute.attribute[frontend_labels][0][label]$$)}}" visible="true" stepKey="ascendSortByCustomAttribute"/> |
| 99 | + <waitForPageLoad stepKey="waitForProductGridLoad"/> |
| 100 | + <!--Check products sorting. Expected result => Blue-Green-Red --> |
| 101 | + <see selector="{{AdminProductGridSection.productGridNameProduct($$createSecondProduct.name$$)}}" userInput="$$createSecondProduct.name$$" stepKey="seeSecondProductName"/> |
| 102 | + <see selector="{{AdminProductGridSection.productGridNameProduct($$createFirstProduct.name$$)}}" userInput="$$createFirstProduct.name$$" stepKey="seeFirstProductName"/> |
| 103 | + <see selector="{{AdminProductGridSection.productGridNameProduct($$createThirdProduct.name$$)}}" userInput="$$createThirdProduct.name$$" stepKey="seeThirdProductName"/> |
| 104 | + </test> |
| 105 | +</tests> |
0 commit comments