|
| 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="AdminCreateProductWithTextSwatchInCustomAttributeSetTest"> |
| 11 | + <annotations> |
| 12 | + <features value="Swatches"/> |
| 13 | + <stories value="Create product with text swatch attribute in custom attribute set"/> |
| 14 | + <title value="Admin can create product with text swatch attribute in custom attribute set and verify single selection behavior"/> |
| 15 | + <description value="Admin creates text swatch attribute, adds it to custom attribute set, creates product with that set, selects swatch option, changes selection to verify previous option is deselected, saves and edits product to change option again"/> |
| 16 | + <severity value="MAJOR"/> |
| 17 | + <testCaseId value="AC-3894"/> |
| 18 | + <group value="swatches"/> |
| 19 | + </annotations> |
| 20 | + <before> |
| 21 | + <!-- Precondition1: Login as Admin --> |
| 22 | + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
| 23 | + <!-- Precondition2,3,4,5,6: Create text swatch attribute with 3 options --> |
| 24 | + <actionGroup ref="AddTextSwatchToProductActionGroup" stepKey="createTextSwatchAttribute"> |
| 25 | + <argument name="attributeName" value="{{textSwatchAttribute.default_label}}"/> |
| 26 | + <argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/> |
| 27 | + <argument name="option1" value="{{textSwatchOption1.admin_label}}"/> |
| 28 | + <argument name="option2" value="{{textSwatchOption2.admin_label}}"/> |
| 29 | + <argument name="option3" value="{{textSwatchOption3.admin_label}}"/> |
| 30 | + </actionGroup> |
| 31 | + <waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForAttributeSuccessMessage"/> |
| 32 | + <!-- Precondition7,8: Create new attribute set based on Default --> |
| 33 | + <actionGroup ref="CreateDefaultAttributeSetActionGroup" stepKey="createAttributeSet"> |
| 34 | + <argument name="label" value="newattrset"/> |
| 35 | + </actionGroup> |
| 36 | + <waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForAttributeSetSuccessMessage"/> |
| 37 | + <!-- Precondition9: Drag and drop text swatch attribute to Product Details group --> |
| 38 | + <actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignSwatchToProductDetails"> |
| 39 | + <argument name="group" value="Product Details"/> |
| 40 | + <argument name="attribute" value="{{textSwatchAttribute.attribute_code}}"/> |
| 41 | + </actionGroup> |
| 42 | + <!-- Precondition10: Save attribute set --> |
| 43 | + <actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/> |
| 44 | + </before> |
| 45 | + <after> |
| 46 | + <!-- Delete created product --> |
| 47 | + <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct"> |
| 48 | + <argument name="sku" value="{{SimpleProduct.sku}}"/> |
| 49 | + </actionGroup> |
| 50 | + <actionGroup ref="ResetAdminDataGridToDefaultViewActionGroup" stepKey="clearFilters"/> |
| 51 | + <!-- Delete text swatch attribute --> |
| 52 | + <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteSwatchAttribute"> |
| 53 | + <argument name="ProductAttribute" value="textSwatchAttribute"/> |
| 54 | + </actionGroup> |
| 55 | + <!-- Delete custom attribute set --> |
| 56 | + <actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/> |
| 57 | + <actionGroup ref="DeleteAttributeSetByLabelActionGroup" stepKey="deleteAttributeSet"> |
| 58 | + <argument name="label" value="newattrset"/> |
| 59 | + </actionGroup> |
| 60 | + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> |
| 61 | + </after> |
| 62 | + <!-- Step 1,2: Navigate to Products - Catalog --> |
| 63 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/> |
| 64 | + <!-- Step 3: Click Add Product button --> |
| 65 | + <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProductPage"> |
| 66 | + <argument name="product" value="SimpleProduct"/> |
| 67 | + </actionGroup> |
| 68 | + <!-- Step 4: Select custom attribute set 'newattrset' --> |
| 69 | + <actionGroup ref="AdminProductPageSelectAttributeSetActionGroup" stepKey="selectCustomAttributeSet"> |
| 70 | + <argument name="attributeSetName" value="newattrset"/> |
| 71 | + </actionGroup> |
| 72 | + <waitForPageLoad stepKey="waitForAttributeSetToLoad"/> |
| 73 | + <!-- Step 5: Fill out required fields --> |
| 74 | + <actionGroup ref="FillMainProductFormNoWeightActionGroup" stepKey="fillMainProductForm"> |
| 75 | + <argument name="product" value="SimpleProduct"/> |
| 76 | + </actionGroup> |
| 77 | + <!-- Step 6: Verify text swatch attribute is present in Product Details tab and select first option of text swatch attribute --> |
| 78 | + <waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" stepKey="waitForTextSwatchAttribute"/> |
| 79 | + <actionGroup ref="AdminSelectTextSwatchAttributeOptionActionGroup" stepKey="selectFirstOption"> |
| 80 | + <argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/> |
| 81 | + <argument name="optionValue" value="{{textSwatchOption1.admin_label}}"/> |
| 82 | + </actionGroup> |
| 83 | + <!-- Step 7: Select second option - this should deselect the first option automatically --> |
| 84 | + <actionGroup ref="AdminSelectTextSwatchAttributeOptionActionGroup" stepKey="selectSecondOption"> |
| 85 | + <argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/> |
| 86 | + <argument name="optionValue" value="{{textSwatchOption2.admin_label}}"/> |
| 87 | + </actionGroup> |
| 88 | + <!-- Verify second option is selected --> |
| 89 | + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption2.admin_label}}" stepKey="verifySecondOptionSelected"/> |
| 90 | + <!-- Step 8: Save product --> |
| 91 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProduct"/> |
| 92 | + <!-- Step 9: Edit product and verify second option is still selected --> |
| 93 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexForEdit"/> |
| 94 | + <actionGroup ref="FilterProductGridBySkuActionGroup" stepKey="filterProductGrid"> |
| 95 | + <argument name="product" value="SimpleProduct"/> |
| 96 | + </actionGroup> |
| 97 | + <actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openProductForEdit"> |
| 98 | + <argument name="product" value="SimpleProduct"/> |
| 99 | + </actionGroup> |
| 100 | + <waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" stepKey="waitForSwatchAttributeAfterEdit"/> |
| 101 | + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption2.admin_label}}" stepKey="verifySecondOptionStillSelected"/> |
| 102 | + <!-- Change option to third option - previous option should be deselected --> |
| 103 | + <actionGroup ref="AdminSelectTextSwatchAttributeOptionActionGroup" stepKey="selectThirdOption"> |
| 104 | + <argument name="attributeCode" value="{{textSwatchAttribute.attribute_code}}"/> |
| 105 | + <argument name="optionValue" value="{{textSwatchOption3.admin_label}}"/> |
| 106 | + </actionGroup> |
| 107 | + <!-- Verify third option is selected --> |
| 108 | + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption3.admin_label}}" stepKey="verifyThirdOptionSelected"/> |
| 109 | + <!-- Step 10: Save product again --> |
| 110 | + <actionGroup ref="SaveProductFormActionGroup" stepKey="saveProductAgain"/> |
| 111 | + <!-- Verify third option persisted after save --> |
| 112 | + <waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" stepKey="waitForSwatchAttributeAfterSecondSave"/> |
| 113 | + <seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(textSwatchAttribute.attribute_code)}}" userInput="{{textSwatchOption3.admin_label}}" stepKey="verifyThirdOptionPersisted"/> |
| 114 | + </test> |
| 115 | +</tests> |
0 commit comments