Skip to content

Commit 0043bee

Browse files
authored
Merge pull request #176 from magento-pangolin/MC-17552
MC-17552 Backport for MC-13641
2 parents 9947885 + 3ff8e76 commit 0043bee

10 files changed

+250
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!-- Delete a product by filtering grid and using delete action-->
12+
<actionGroup name="AdminDeleteProductBySkuActionGroup">
13+
<arguments>
14+
<argument name="sku" type="string"/>
15+
</arguments>
16+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
17+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
18+
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
19+
<fillField selector="{{AdminProductGridFilterSection.skuFilter}}" userInput="{{sku}}" stepKey="fillProductSkuFilter"/>
20+
<click selector="{{AdminProductGridFilterSection.applyFilters}}" stepKey="clickApplyFilters"/>
21+
<see selector="{{AdminProductGridSection.productGridCell('1', 'SKU')}}" userInput="{{sku}}" stepKey="seeProductSkuInGrid"/>
22+
<click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/>
23+
<click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/>
24+
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
25+
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>
26+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmModal"/>
27+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmProductDelete"/>
28+
<see selector="{{AdminMessagesSection.success}}" userInput="record(s) have been deleted." stepKey="seeSuccessMessage"/>
29+
</actionGroup>
30+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="AdminGenerateProductConfigurationsByAttributeCodeActionGroup">
12+
<arguments>
13+
<argument name="attributeCode" type="string" defaultValue="SomeString"/>
14+
</arguments>
15+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
16+
<click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/>
17+
<fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{attributeCode}}" stepKey="fillFilterAttributeCodeField"/>
18+
<click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/>
19+
<click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/>
20+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/>
21+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/>
22+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/>
23+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
24+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="99" stepKey="enterAttributeQuantity"/>
25+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
26+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
27+
</actionGroup>
28+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminOpenAttributeSetByNameActionGroup">
11+
<arguments>
12+
<argument name="attributeSetName" type="string" defaultValue="Default"/>
13+
</arguments>
14+
<click selector="{{AdminProductAttributeSetGridSection.attributeSetName(attributeSetName)}}" stepKey="chooseAttributeSet"/>
15+
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminOpenAttributeSetGridPageActionGroup">
11+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
12+
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
13+
</actionGroup>
14+
</actionGroups>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="AdminOpenProductIndexPageActionGroup">
11+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductIndexPage"/>
12+
<waitForPageLoad stepKey="waitForProductIndexPageLoad"/>
13+
</actionGroup>
14+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductAttributeActionGroup.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,14 @@
8080
<argument name="attributeType" type="string" defaultValue="select"/>
8181
</arguments>
8282
<amOnPage url="{{AdminProductAttributeNewPage.url}}" stepKey="goToNewProductAttributePage"/>
83+
<waitForPageLoad stepKey="waitForProductAttributeNewPageLoad"/>
8384
<fillField selector="{{AttributePropertiesSection.defaultLabel}}" userInput="{{attributeCode}}" stepKey="fillDefaultLabel"/>
8485
<selectOption selector="{{AttributePropertiesSection.inputType}}" userInput="{{attributeType}}" stepKey="selectInputType"/>
8586
<waitForElementVisible selector="{{AdminNewAttributePanelSection.addOption}}" stepKey="waitForElementVisible"/>
8687
</actionGroup>
88+
<actionGroup name="AdminFillProductAttributePropertiesActionGroup" extends="StartCreateProductAttribute">
89+
<remove keyForRemoval="waitForElementVisible"/>
90+
</actionGroup>
8791
<actionGroup name="AddOptionToProductAttribute">
8892
<arguments>
8993
<argument name="optionName" type="string"/>

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,25 @@
7777
<entity name="ProductAttributeText" extends="productAttributeWithTwoOptions">
7878
<data key="frontend_input">text</data>
7979
</entity>
80+
<entity name="productVisualSwatchAttribute" type="ProductAttribute">
81+
<data key="attribute_code" unique="suffix">attribute</data>
82+
<data key="frontend_input">swatch_visual</data>
83+
<data key="scope">global</data>
84+
<data key="is_required">false</data>
85+
<data key="is_unique">false</data>
86+
<data key="is_searchable">true</data>
87+
<data key="is_visible">true</data>
88+
<data key="is_visible_in_advanced_search">true</data>
89+
<data key="is_visible_on_front">true</data>
90+
<data key="is_filterable">true</data>
91+
<data key="is_filterable_in_search">true</data>
92+
<data key="used_in_product_listing">true</data>
93+
<data key="is_used_for_promo_rules">true</data>
94+
<data key="is_comparable">true</data>
95+
<data key="is_used_in_grid">true</data>
96+
<data key="is_visible_in_grid">true</data>
97+
<data key="is_filterable_in_grid">true</data>
98+
<data key="used_for_sort_by">true</data>
99+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
100+
</entity>
80101
</entities>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
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>

app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@
2626
<element name="skuValidationMessage" type="text" selector="input[name='configurable-matrix[{{index}}][sku]'] + label" parameterized="true"/>
2727
<element name="stepsWizardTitle" type="text" selector="div.content:not([style='display: none;']) .steps-wizard-title"/>
2828
<element name="attributeEntityByName" type="text" selector="//div[@class='attribute-entity']//div[normalize-space(.)='{{attributeLabel}}']" parameterized="true"/>
29+
<element name="fileUploaderInput" type="file" selector="//input[@type='file' and @class='file-uploader-input']"/>
2930
</section>
3031
</sections>

app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridTableSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@
2222
<element name="rowEditAction" type="button" selector="[data-role='grid'] tbody tr .action-select-wrap._active [data-action='item-edit']" timeout="30"/>
2323
<element name="dataGridEmpty" type="block" selector=".data-grid-tr-no-data td"/>
2424
<element name="dataGridWrap" type="block" selector=".admin__data-grid-wrap"/>
25+
<element name="rowTemplate" type="block" selector="//tbody/tr[td[*[contains(.,normalize-space('{{text}}'))]]]" parameterized="true" />
2526
</section>
2627
</sections>

0 commit comments

Comments
 (0)