|
| 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 | +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 9 | + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> |
| 10 | + <test name="AdminCheckCustomAttributeValuesAfterProductSaveTest"> |
| 11 | + <annotations> |
| 12 | + <features value="Catalog"/> |
| 13 | + <stories value="Product attributes"/> |
| 14 | + <title value="Saving custom attribute values using UI"/> |
| 15 | + <description value="Checks that saved custom attribute values are reflected on the product's edit page"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="MC-29653"/> |
| 18 | + <useCaseId value="MC-29023"/> |
| 19 | + <group value="catalog"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Create multi select product attribute --> |
| 23 | + <createData entity="productAttributeMultiselectTwoOptions" stepKey="createMultiSelectProductAttribute"/> |
| 24 | + <!-- Add options to created product attribute --> |
| 25 | + <createData entity="productAttributeOption1" stepKey="addFirstOptionToAttribute"> |
| 26 | + <requiredEntity createDataKey="createMultiSelectProductAttribute"/> |
| 27 | + </createData> |
| 28 | + <createData entity="productAttributeOption2" stepKey="addSecondOptionToAttribute"> |
| 29 | + <requiredEntity createDataKey="createMultiSelectProductAttribute"/> |
| 30 | + </createData> |
| 31 | + <createData entity="productAttributeOption3" stepKey="addThirdOptionToAttribute"> |
| 32 | + <requiredEntity createDataKey="createMultiSelectProductAttribute"/> |
| 33 | + </createData> |
| 34 | + <!-- Create simple product --> |
| 35 | + <createData entity="SimpleProduct2" stepKey="createSimpleProduct"/> |
| 36 | + <magentoCLI command="indexer:reindex" arguments="catalogsearch_fulltext" stepKey="reindexCatalogSearch"/> |
| 37 | + <!-- Login to Admin page --> |
| 38 | + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> |
| 39 | + </before> |
| 40 | + <after> |
| 41 | + <!-- Delete created entities --> |
| 42 | + <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> |
| 43 | + <deleteData createDataKey="createMultiSelectProductAttribute" stepKey="deleteMultiSelectProductAttribute"/> |
| 44 | + <!-- Logout from Admin page --> |
| 45 | + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> |
| 46 | + </after> |
| 47 | + |
| 48 | + <!-- Open created product for edit --> |
| 49 | + <amOnPage url="{{AdminProductEditPage.url($createSimpleProduct.id$)}}" stepKey="goToProductEditPage"/> |
| 50 | + <waitForPageLoad stepKey="waitForProductPageLoad"/> |
| 51 | + |
| 52 | + <!-- Add created attribute to the product --> |
| 53 | + <actionGroup ref="AddProductAttributeInProductModalActionGroup" stepKey="addAttributeToProduct"> |
| 54 | + <argument name="attributeCode" value="$createMultiSelectProductAttribute.attribute_code$"/> |
| 55 | + </actionGroup> |
| 56 | + <waitForPageLoad stepKey="waitForAttributeAdded"/> |
| 57 | + |
| 58 | + <!-- Expand 'Attributes' tab --> |
| 59 | + <actionGroup ref="AdminExpandProductAttributesTabActionGroup" stepKey="expandAttributesTab"/> |
| 60 | + <!-- Check created attribute presents in the 'Attributes' tab --> |
| 61 | + <seeElement selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" stepKey="assertAttributeIsPresentInTab"/> |
| 62 | + <!-- Select attribute options --> |
| 63 | + <selectOption selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" parameterArray="[$addFirstOptionToAttribute.option[store_labels][0][label]$, $addThirdOptionToAttribute.option[store_labels][0][label]$]" stepKey="selectAttributeOptions"/> |
| 64 | + <!-- Save product --> |
| 65 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductForm"/> |
| 66 | + |
| 67 | + <!-- Check attribute options are selected --> |
| 68 | + <actionGroup ref="AdminExpandProductAttributesTabActionGroup" stepKey="expandAttributesTabAfterProductSave"/> |
| 69 | + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" userInput="$addFirstOptionToAttribute.option[store_labels][0][label]$" stepKey="assertFirstOptionIsSelected"/> |
| 70 | + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode($createMultiSelectProductAttribute.attribute_code$)}}" userInput="$addThirdOptionToAttribute.option[store_labels][0][label]$" stepKey="assertThirdOptionIsSelected"/> |
| 71 | + |
| 72 | + <!-- Search for the product on Storefront --> |
| 73 | + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> |
| 74 | + <waitForPageLoad stepKey="waitForHomePageLoad"/> |
| 75 | + <actionGroup ref="StorefrontCheckQuickSearchActionGroup" stepKey="searchProductOnStorefront"> |
| 76 | + <argument name="phrase" value="$createSimpleProduct.name$"/> |
| 77 | + </actionGroup> |
| 78 | + |
| 79 | + <!-- Assert that attribute values present in layered navigation --> |
| 80 | + <actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertFirstAttributeOptionPresence"> |
| 81 | + <argument name="attributeLabel" value="$createMultiSelectProductAttribute.attribute[frontend_labels][0][label]$"/> |
| 82 | + <argument name="attributeOptionLabel" value="$addFirstOptionToAttribute.option[store_labels][0][label]$"/> |
| 83 | + <argument name="attributeOptionPosition" value="1"/> |
| 84 | + </actionGroup> |
| 85 | + <actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertThirdAttributeOptionPresence"> |
| 86 | + <argument name="attributeLabel" value="$createMultiSelectProductAttribute.attribute[frontend_labels][0][label]$"/> |
| 87 | + <argument name="attributeOptionLabel" value="$addThirdOptionToAttribute.option[store_labels][0][label]$"/> |
| 88 | + <argument name="attributeOptionPosition" value="2"/> |
| 89 | + </actionGroup> |
| 90 | + </test> |
| 91 | +</tests> |
0 commit comments