|
16 | 16 | <testCaseId value="AC-8423"/> |
17 | 17 | <severity value="MAJOR"/> |
18 | 18 | <group value="Catalog"/> |
19 | | - <group value="ConfigurableProduct"/> |
20 | 19 | </annotations> |
21 | 20 | <before> |
22 | 21 | <!-- Step-1: Login to admin --> |
23 | 22 | <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> |
24 | 23 | <!-- Create category for products --> |
25 | 24 | <createData entity="_defaultCategory" stepKey="createCategory"/> |
26 | | - <!-- Step-2: Create a dropdown product attribute with three options --> |
27 | | - <actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="goToNewProductAttributePage"/> |
28 | | - <actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillAttributeProperties"> |
29 | | - <argument name="attributeName" value="{{DropdownSizeAttributeData.frontend_label}}"/> |
30 | | - <argument name="attributeType" value="{{DropdownSizeAttributeData.attribute_type}}"/> |
31 | | - </actionGroup> |
32 | | - <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="clickAdvancedProperties"/> |
33 | | - <fillField selector="{{AttributePropertiesSection.AttributeCode}}" userInput="{{DropdownSizeAttributeData.attribute_code}}" stepKey="fillAttributeCode"/> |
34 | | - <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="{{DropdownSizeAttributeData.scope}}" stepKey="selectGlobalScope"/> |
35 | | - <click selector="{{AttributePropertiesSection.dropdownAddOptions}}" stepKey="clickAddOption1"/> |
36 | | - <fillField selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('1')}}" userInput="{{AttributeOptionSmall.value}}" stepKey="fillOption1Admin"/> |
37 | | - <click selector="{{AttributePropertiesSection.dropdownAddOptions}}" stepKey="clickAddOption2"/> |
38 | | - <fillField selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('2')}}" userInput="{{AttributeOptionMedium.value}}" stepKey="fillOption2Admin"/> |
39 | | - <click selector="{{AttributePropertiesSection.dropdownAddOptions}}" stepKey="clickAddOption3"/> |
40 | | - <fillField selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('3')}}" userInput="{{AttributeOptionLarge.value}}" stepKey="fillOption3Admin"/> |
41 | | - <actionGroup ref="AdminProductAttributeSaveActionGroup" stepKey="saveDropdownAttribute"/> |
42 | | - <!-- Step-3: Create a text swatch product attribute with three options --> |
43 | | - <actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="goToNewProductAttributePageForSwatch"/> |
44 | | - <actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillSwatchAttributeProperties"> |
45 | | - <argument name="attributeName" value="{{TextSwatchColorAttributeData.frontend_label}}"/> |
46 | | - <argument name="attributeType" value="{{TextSwatchColorAttributeData.attribute_type}}"/> |
47 | | - </actionGroup> |
48 | | - <click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="clickAdvancedPropertiesForSwatch"/> |
49 | | - <fillField selector="{{AttributePropertiesSection.AttributeCode}}" userInput="{{TextSwatchColorAttributeData.attribute_code}}" stepKey="fillSwatchAttributeCode"/> |
50 | | - <selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="{{TextSwatchColorAttributeData.scope}}" stepKey="selectGlobalScopeForSwatch"/> |
51 | | - <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatchOption1"/> |
52 | | - <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('0')}}" userInput="{{AttributeOptionBlack.value}}" stepKey="fillSwatchOption1"/> |
53 | | - <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('0')}}" userInput="{{AttributeOptionBlack.value}}" stepKey="fillSwatchOption1Description"/> |
54 | | - <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatchOption2"/> |
55 | | - <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('1')}}" userInput="{{AttributeOptionWhite.value}}" stepKey="fillSwatchOption2"/> |
56 | | - <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('1')}}" userInput="{{AttributeOptionWhite.value}}" stepKey="fillSwatchOption2Description"/> |
57 | | - <click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatchOption3"/> |
58 | | - <fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('2')}}" userInput="{{AttributeOptionBlue.value}}" stepKey="fillSwatchOption3"/> |
59 | | - <fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('2')}}" userInput="{{AttributeOptionBlue.value}}" stepKey="fillSwatchOption3Description"/> |
60 | | - <actionGroup ref="AdminProductAttributeSaveActionGroup" stepKey="saveTextSwatchAttribute"/> |
61 | | - <!-- Create configurable products via API --> |
| 25 | + <!-- Step-2: Create a dropdown product attribute with two options --> |
| 26 | + <createData entity="DropdownSizeAttributeData" stepKey="createDropdownAttribute"/> |
| 27 | + <createData entity="DropdownSizeOptionSmall" stepKey="createAttributeOptionSmall"> |
| 28 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 29 | + </createData> |
| 30 | + <createData entity="DropdownSizeOptionLarge" stepKey="createAttributeOptionLarge"> |
| 31 | + <requiredEntity createDataKey="createDropdownAttribute"/> |
| 32 | + </createData> |
| 33 | + <!-- Step-3: Create a text swatch product attribute with two options --> |
| 34 | + <createData entity="TextSwatchColorAttributeData" stepKey="createTextSwatchAttribute"/> |
| 35 | + <createData entity="TextSwatchOptionBlack" stepKey="createAttributeOptionBlack"> |
| 36 | + <requiredEntity createDataKey="createTextSwatchAttribute"/> |
| 37 | + </createData> |
| 38 | + <createData entity="TextSwatchOptionWhite" stepKey="createAttributeOptionWhite"> |
| 39 | + <requiredEntity createDataKey="createTextSwatchAttribute"/> |
| 40 | + </createData> |
| 41 | + <!-- Create configurable products --> |
62 | 42 | <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct1"> |
63 | 43 | <requiredEntity createDataKey="createCategory"/> |
64 | | - <field key="name">Conf 1</field> |
65 | | - <field key="sku">conf-1</field> |
66 | | - <field key="price">100</field> |
| 44 | + <field key="name">{{ConfigurableProduct1.name}}</field> |
| 45 | + <field key="sku">{{ConfigurableProduct1.sku}}</field> |
| 46 | + <field key="price">{{ConfigurableProduct1.price}}</field> |
67 | 47 | </createData> |
68 | 48 | <createData entity="ApiConfigurableProduct" stepKey="createConfigProduct2"> |
69 | 49 | <requiredEntity createDataKey="createCategory"/> |
70 | | - <field key="name">Conf 2</field> |
71 | | - <field key="sku">conf-2</field> |
72 | | - <field key="price">200</field> |
| 50 | + <field key="name">{{ConfigurableProduct2.name}}</field> |
| 51 | + <field key="sku">{{ConfigurableProduct2.sku}}</field> |
| 52 | + <field key="price">{{ConfigurableProduct2.price}}</field> |
73 | 53 | </createData> |
74 | 54 | </before> |
75 | 55 | <after> |
76 | 56 | <!-- Delete category --> |
77 | 57 | <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> |
78 | | - <!-- Delete created products --> |
79 | | - <actionGroup ref="DeleteAllProductsUsingProductGridActionGroup" stepKey="deleteAllProducts"/> |
| 58 | + <!-- Delete configurable product & its variants via API using ProductApiHelper --> |
| 59 | + <helper class="Magento\Catalog\Test\Mftf\Helper\ProductApiHelper" method="deleteAllProductsApi" stepKey="deleteAllProductsViaApi"/> |
80 | 60 | <!-- Delete widget --> |
81 | 61 | <actionGroup ref="AdminDeleteWidgetActionGroup" stepKey="deleteWidget"> |
82 | 62 | <argument name="widget" value="SampleCatalogProductsListWidget"/> |
83 | 63 | </actionGroup> |
84 | 64 | <!-- Delete dropdown attribute --> |
85 | | - <actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteDropdownAttribute"> |
86 | | - <argument name="attribute_code" value="{{DropdownSizeAttributeData.attribute_code}}"/> |
87 | | - </actionGroup> |
| 65 | + <deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/> |
88 | 66 | <!-- Delete text swatch attribute --> |
89 | | - <actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteSwatchAttribute"> |
90 | | - <argument name="attribute_code" value="{{TextSwatchColorAttributeData.attribute_code}}"/> |
91 | | - </actionGroup> |
| 67 | + <deleteData createDataKey="createTextSwatchAttribute" stepKey="deleteSwatchAttribute"/> |
92 | 68 | <!-- Logout --> |
93 | 69 | <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> |
94 | 70 | </after> |
|
99 | 75 | <waitForPageLoad stepKey="waitForConfigProduct1PageLoad"/> |
100 | 76 | <!-- Create configurations for Conf 1 with my_size attribute --> |
101 | 77 | <actionGroup ref="GenerateConfigurationsByAttributeCodeActionGroup" stepKey="createConfigurationsForConf1"> |
102 | | - <argument name="attributeCode" value="{{DropdownSizeAttributeData.attribute_code}}"/> |
| 78 | + <argument name="attributeCode" value="$createDropdownAttribute.attribute_code$"/> |
103 | 79 | </actionGroup> |
104 | 80 | <!-- Set custom prices for Small and Large variants --> |
105 | 81 | <actionGroup ref="ChangeConfigurableProductChildProductPriceActionGroup" stepKey="changePriceForSmall"> |
|
121 | 97 | <click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurationsForConf2"/> |
122 | 98 | <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" stepKey="waitForConfigurationModalOpen"/> |
123 | 99 | <!-- Select both my_size and color_swatch attributes --> |
124 | | - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(DropdownSizeAttributeData.attribute_code)}}" stepKey="selectSizeAttribute"/> |
125 | | - <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox(TextSwatchColorAttributeData.attribute_code)}}" stepKey="selectColorAttribute"/> |
| 100 | + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox($createDropdownAttribute.attribute_code$)}}" stepKey="selectSizeAttribute"/> |
| 101 | + <click selector="{{AdminCreateProductConfigurationsPanel.attributeCheckbox($createTextSwatchAttribute.attribute_code$)}}" stepKey="selectColorAttribute"/> |
126 | 102 | <click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1ForConf2"/> |
127 | 103 | <!-- Select only Small and Large for my_size, and Black and White for color_swatch --> |
128 | 104 | <waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.attributeCheckboxByName(AttributeOptionSmall.value)}}" stepKey="waitForOptionsForConf2"/> |
|
164 | 140 | <actionGroup ref="AdminSaveAndContinueWidgetActionGroup" stepKey="saveWidget"/> |
165 | 141 | <!-- Step-7: Open Conf 1 product page on storefront and validate price changes --> |
166 | 142 | <actionGroup ref="StorefrontOpenProductPageActionGroup" stepKey="openConf1ProductPage"> |
167 | | - <argument name="productUrl" value="conf-1"/> |
| 143 | + <argument name="productUrl" value="{{ConfigurableProduct1.sku}}"/> |
168 | 144 | </actionGroup> |
169 | 145 | <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productName}}" stepKey="waitForProductName"/> |
170 | | - <waitForText selector="{{StorefrontProductInfoMainSection.productName}}" userInput="Conf 1" stepKey="verifyProductName"/> |
| 146 | + <waitForText selector="{{StorefrontProductInfoMainSection.productName}}" userInput="{{ConfigurableProduct1.name}}" stepKey="verifyProductName"/> |
171 | 147 | <!-- Verify default price before selection --> |
172 | 148 | <waitForElementVisible selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="waitForDefaultPrice"/> |
173 | 149 | <!-- Select Small option and verify price --> |
|
0 commit comments