|
| 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="AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest"> |
| 12 | + <annotations> |
| 13 | + <features value="Catalog"/> |
| 14 | + <stories value="Product attributes"/> |
| 15 | + <title value="Saving configurable product with custom product attribute (images as swatches)"/> |
| 16 | + <description value="Saving configurable product with custom product attribute (images as swatches)"/> |
| 17 | + <severity value="CRITICAL"/> |
| 18 | + <testCaseId value="MC-17552"/> |
| 19 | + <group value="catalog"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Login as admin --> |
| 23 | + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> |
| 24 | + </before> |
| 25 | + <after> |
| 26 | + <!-- Admin logout --> |
| 27 | + <actionGroup ref="logout" stepKey="adminLogout"/> |
| 28 | + </after> |
| 29 | + |
| 30 | + <!-- Create a new product attribute: set Catalog Input Type for Store Owner: Visual Swatch --> |
| 31 | + <actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillAttributeProperties"> |
| 32 | + <argument name="attributeCode" value="{{productVisualSwatchAttribute.attribute_code}}"/> |
| 33 | + <argument name="attributeType" value="{{productVisualSwatchAttribute.frontend_input}}"/> |
| 34 | + </actionGroup> |
| 35 | + |
| 36 | + <!-- Add a few Swatches and add images to Manage Swatch (Values of Your Attribute) |
| 37 | + 1. Set swatch #1 using the color picker --> |
| 38 | + <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddFirstSwatch"/> |
| 39 | + <actionGroup ref="openSwatchMenuByIndex" stepKey="clickFirstSwatch"> |
| 40 | + <argument name="index" value="0"/> |
| 41 | + </actionGroup> |
| 42 | + <click selector="{{AdminManageSwatchSection.chooseColorRow('1')}}" stepKey="clickChooseFirstColor"/> |
| 43 | + <actionGroup ref="setColorPickerValueByHex" stepKey="fillFirstHex"> |
| 44 | + <argument name="nthColorPicker" value="1"/> |
| 45 | + <argument name="hexColor" value="e74c3c"/> |
| 46 | + </actionGroup> |
| 47 | + <fillField selector="{{AdminManageSwatchSection.adminInputByIndex('0')}}" userInput="red" stepKey="fillFirstAdminField"/> |
| 48 | + |
| 49 | + <!-- 2. Set swatch #2 using the color picker --> |
| 50 | + <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSecondSwatch"/> |
| 51 | + <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSecondSwatch"> |
| 52 | + <argument name="index" value="1"/> |
| 53 | + </actionGroup> |
| 54 | + <click selector="{{AdminManageSwatchSection.chooseColorRow('2')}}" stepKey="clickChooseSecondColor"/> |
| 55 | + <actionGroup ref="setColorPickerValueByHex" stepKey="fillSecondHex"> |
| 56 | + <argument name="nthColorPicker" value="2"/> |
| 57 | + <argument name="hexColor" value="3498db"/> |
| 58 | + </actionGroup> |
| 59 | + <fillField selector="{{AdminManageSwatchSection.adminInputByIndex('1')}}" userInput="blue" stepKey="fillSecondAdminField"/> |
| 60 | + |
| 61 | + <!-- Set Scope: Global in Advanced Attribute Properties --> |
| 62 | + <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> |
| 63 | + <selectOption selector="{{AttributePropertiesSection.scope}}" userInput="1" stepKey="selectGlobalScope"/> |
| 64 | + |
| 65 | + <!-- Click "Save Attribute" button --> |
| 66 | + <click selector="{{AttributePropertiesSection.saveAndEdit}}" stepKey="clickSaveAndEdit"/> |
| 67 | + <waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> |
| 68 | + |
| 69 | + <!-- Add created product attribute to the Default set --> |
| 70 | + <actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/> |
| 71 | + <actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/> |
| 72 | + <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> |
| 73 | + <argument name="group" value="Product Details"/> |
| 74 | + <argument name="attribute" value="productVisualSwatchAttribute.attribute_code"/> |
| 75 | + </actionGroup> |
| 76 | + <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> |
| 77 | + |
| 78 | + <!-- Create configurable product --> |
| 79 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openOpenProductIndexPage"/> |
| 80 | + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> |
| 81 | + <argument name="product" value="BaseConfigurableProduct"/> |
| 82 | + </actionGroup> |
| 83 | + |
| 84 | + <!-- Select Attribute Set --> |
| 85 | + <actionGroup ref="AssignProductToAttributeSet" stepKey="selectAttributeSet"> |
| 86 | + <argument name="attributeSetName" value="Default"/> |
| 87 | + </actionGroup> |
| 88 | + |
| 89 | + <!-- Fill all the necessary information such as weight, name, SKU etc --> |
| 90 | + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> |
| 91 | + <argument name="product" value="BaseConfigurableProduct"/> |
| 92 | + </actionGroup> |
| 93 | + |
| 94 | + <!-- Click "Create Configurations" button, select created product attribute using the same Quantity for all products. Click "Generate products" button --> |
| 95 | + <actionGroup ref="AdminGenerateProductConfigurationsByAttributeCodeActionGroup" stepKey="addAttributeToProduct"> |
| 96 | + <argument name="attributeCode" value="{{productVisualSwatchAttribute.attribute_code}}"/> |
| 97 | + </actionGroup> |
| 98 | + |
| 99 | + <!-- Using this action to concatenate 2 strings to have unique identifier for grid --> |
| 100 | + <executeJS function="return '{{productVisualSwatchAttribute.attribute_code}}: red'" stepKey="attributeCodeRed"/> |
| 101 | + <executeJS function="return '{{productVisualSwatchAttribute.attribute_code}}: blue'" stepKey="attributeCodeBlue"/> |
| 102 | + |
| 103 | + <!-- Add images for the products --> |
| 104 | + <attachFile selector="{{AdminDataGridTableSection.rowTemplate({$attributeCodeRed})}}{{AdminProductFormConfigurationsSection.fileUploaderInput}}" userInput="{{MagentoLogo.file}}" stepKey="uploadImageForFirstProduct"/> |
| 105 | + <attachFile selector="{{AdminDataGridTableSection.rowTemplate({$attributeCodeBlue})}}{{AdminProductFormConfigurationsSection.fileUploaderInput}}" userInput="{{ProductImage.file}}" stepKey="uploadImageForSecondProduct"/> |
| 106 | + |
| 107 | + <!-- Click "Save" button --> |
| 108 | + <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> |
| 109 | + |
| 110 | + <!-- Delete all created product --> |
| 111 | + <actionGroup ref="AdminDeleteProductBySkuActionGroup" stepKey="deleteCreatedProducts"> |
| 112 | + <argument name="sku" value="{{BaseConfigurableProduct.sku}}"/> |
| 113 | + </actionGroup> |
| 114 | + |
| 115 | + <!-- Delete product attribute --> |
| 116 | + <actionGroup ref="deleteProductAttribute" stepKey="deleteProductAttribute"> |
| 117 | + <argument name="ProductAttribute" value="productVisualSwatchAttribute"/> |
| 118 | + </actionGroup> |
| 119 | + </test> |
| 120 | +</tests> |
0 commit comments