|
| 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-13641"/> |
| 19 | + <group value="catalog"/> |
| 20 | + </annotations> |
| 21 | + <before> |
| 22 | + <!-- Login as admin --> |
| 23 | + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> |
| 24 | + |
| 25 | + <!-- Create a new product attribute --> |
| 26 | + <actionGroup ref="AdminOpenProductAttributePageActionGroup" stepKey="openProductAttributePage"/> |
| 27 | + <click selector="{{AdminProductAttributeGridSection.createNewAttributeBtn}}" stepKey="createNewAttribute"/> |
| 28 | + <!-- Set Catalog Input Type for Store Owner: Visual Swatch --> |
| 29 | + <actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillAttributeProperties"> |
| 30 | + <argument name="attributeName" value="{{VisualSwatchProductAttribute.attribute_code}}"/> |
| 31 | + <argument name="attributeType" value="{{VisualSwatchProductAttribute.frontend_input}}"/> |
| 32 | + </actionGroup> |
| 33 | + <!-- Add a few Swatches and add images to Manage Swatch (Values of Your Attribute) |
| 34 | + 1. Set swatch #1 using the color picker --> |
| 35 | + <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddFirstSwatch"/> |
| 36 | + <actionGroup ref="openSwatchMenuByIndex" stepKey="clickFirstSwatch"> |
| 37 | + <argument name="index" value="0"/> |
| 38 | + </actionGroup> |
| 39 | + <click selector="{{AdminManageSwatchSection.nthChooseColor('1')}}" stepKey="clickChooseColor"/> |
| 40 | + <actionGroup ref="setColorPickerByHex" stepKey="fillFirstHex"> |
| 41 | + <argument name="nthColorPicker" value="1"/> |
| 42 | + <argument name="hexColor" value="e74c3c"/> |
| 43 | + </actionGroup> |
| 44 | + <fillField selector="{{AdminManageSwatchSection.adminInputByIndex('0')}}" userInput="red" stepKey="fillFirstAdminField"/> |
| 45 | + <!-- Set swatch #2 using upload file --> |
| 46 | + <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSecondSwatch"/> |
| 47 | + <actionGroup ref="openSwatchMenuByIndex" stepKey="clickSwatch2"> |
| 48 | + <argument name="index" value="1"/> |
| 49 | + </actionGroup> |
| 50 | + <click selector="{{AdminManageSwatchSection.nthUploadFile('2')}}" stepKey="clickUploadFile2"/> |
| 51 | + <attachFile selector="input[name='datafile']" userInput="{{placeholderSmallImage.file}}" stepKey="attachFile"/> |
| 52 | + <fillField selector="{{AdminManageSwatchSection.adminInputByIndex('1')}}" userInput="adobe-small" stepKey="fillAdminLabel"/> |
| 53 | + <!-- Set Scope: Global in Advanced Attribute Properties --> |
| 54 | + <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/> |
| 55 | + <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/> |
| 56 | + <!-- Click "Save Attribute" button --> |
| 57 | + <click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit"/> |
| 58 | + <waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/> |
| 59 | + </before> |
| 60 | + <after> |
| 61 | + <!-- Delete product attribute and clear grid filter --> |
| 62 | + <actionGroup ref="deleteProductAttributeByAttributeCode" stepKey="deleteProductAttribute"> |
| 63 | + <argument name="ProductAttributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> |
| 64 | + </actionGroup> |
| 65 | + <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearAttributesGridFilter"/> |
| 66 | + <!--Clear products grid filter--> |
| 67 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> |
| 68 | + <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearProductsGridFilter"/> |
| 69 | + <!-- Admin logout --> |
| 70 | + <actionGroup ref="logout" stepKey="adminLogout"/> |
| 71 | + </after> |
| 72 | + |
| 73 | + <!-- Add created product attribute to the Default set --> |
| 74 | + <actionGroup ref="AdminOpenAttributeSetGridPageActionGroup" stepKey="openAttributeSetPage"/> |
| 75 | + <actionGroup ref="AdminOpenAttributeSetByNameActionGroup" stepKey="openDefaultAttributeSet"/> |
| 76 | + <actionGroup ref="AssignAttributeToGroup" stepKey="assignAttributeToGroup"> |
| 77 | + <argument name="group" value="Product Details"/> |
| 78 | + <argument name="attribute" value="{{VisualSwatchProductAttribute.attribute_code}}"/> |
| 79 | + </actionGroup> |
| 80 | + <actionGroup ref="SaveAttributeSet" stepKey="saveAttributeSet"/> |
| 81 | + |
| 82 | + <!-- Create configurable product --> |
| 83 | + <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> |
| 84 | + <actionGroup ref="goToCreateProductPage" stepKey="goToCreateConfigurableProduct"> |
| 85 | + <argument name="product" value="ApiConfigurableProduct"/> |
| 86 | + </actionGroup> |
| 87 | + <!-- Fill all the necessary information such as weight, name, SKU etc --> |
| 88 | + <actionGroup ref="fillMainProductForm" stepKey="fillProductForm"> |
| 89 | + <argument name="product" value="ApiConfigurableProduct"/> |
| 90 | + </actionGroup> |
| 91 | + <!-- Click "Create Configurations" button, select created product attribute using the same Quantity for all products. Click "Generate products" button --> |
| 92 | + <actionGroup ref="generateConfigurationsByAttributeCode" stepKey="addAttributeToProduct"> |
| 93 | + <argument name="attributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/> |
| 94 | + </actionGroup> |
| 95 | + <!-- Using this action to concatenate 2 strings to have unique identifier for grid --> |
| 96 | + <executeJS function="return '{{VisualSwatchProductAttribute.attribute_code}}: red'" stepKey="attributeCodeRed"/> |
| 97 | + <executeJS function="return '{{VisualSwatchProductAttribute.attribute_code}}: {{placeholderSmallImage.name}}'" stepKey="attributeCodeAdobeSmall"/> |
| 98 | + <!-- Add images for the products --> |
| 99 | + <attachFile selector="{{AdminDataGridTableSection.rowTemplate({$attributeCodeRed})}}{{AdminProductFormConfigurationsSection.fileUploaderInput}}" userInput="{{MagentoLogo.file}}" stepKey="uploadImageForFirstProduct"/> |
| 100 | + <attachFile selector="{{AdminDataGridTableSection.rowTemplate({$attributeCodeAdobeSmall})}}{{AdminProductFormConfigurationsSection.fileUploaderInput}}" userInput="{{TestImageAdobe.file}}" stepKey="uploadImageForSecondProduct"/> |
| 101 | + |
| 102 | + <!-- Click "Save" button --> |
| 103 | + <actionGroup ref="saveProductForm" stepKey="clickSaveButton"/> |
| 104 | + |
| 105 | + <!-- Delete all created product --> |
| 106 | + <actionGroup ref="deleteProductBySku" stepKey="deleteCreatedProducts"> |
| 107 | + <argument name="sku" value="{{ApiConfigurableProduct.sku}}"/> |
| 108 | + </actionGroup> |
| 109 | + </test> |
| 110 | +</tests> |
0 commit comments