/
AdminConfigurableProductUpdateAttributeTest.xml
278 lines (238 loc) · 16.8 KB
/
AdminConfigurableProductUpdateAttributeTest.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminConfigurableProductUpdateAttributeTest">
<annotations>
<features value="ConfigurableProduct"/>
<stories value="Edit a configurable product in admin"/>
<title value="Admin should be able to update existing attributes of a configurable product"/>
<description value="Admin should be able to update existing attributes of a configurable product"/>
<severity value="AVERAGE"/>
<testCaseId value="MC-179"/>
<group value="ConfigurableProduct"/>
</annotations>
<before>
<!-- Create the attribute we will be modifying -->
<createData entity="productAttributeWithTwoOptions" stepKey="createModifiableProductAttribute"/>
<!-- Create the two attributes the product will have -->
<createData entity="productAttributeOption1" stepKey="createModifiableProductAttributeOption1">
<requiredEntity createDataKey="createModifiableProductAttribute"/>
</createData>
<createData entity="productAttributeOption2" stepKey="createModifiableProductAttributeOption2">
<requiredEntity createDataKey="createModifiableProductAttribute"/>
</createData>
<!-- Add the product to the default set -->
<createData entity="AddToDefaultSet" stepKey="createModifiableAddToAttributeSet">
<requiredEntity createDataKey="createModifiableProductAttribute"/>
</createData>
<!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. -->
<!-- Create the category the product will be a part of -->
<createData entity="ApiCategory" stepKey="createCategory"/>
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
<!-- Create the two attributes the product will have -->
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<!-- Add the product to the default set -->
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<!-- Get the two attributes -->
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>
<!-- Create the two children product -->
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
</createData>
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption2"/>
</createData>
<!-- Create the two configurable product with both children -->
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
<requiredEntity createDataKey="getConfigAttributeOption2"/>
</createData>
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct1"/>
</createData>
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct2"/>
</createData>
<!-- login -->
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
</before>
<after>
<actionGroup ref="logout" stepKey="adminLogout"/>
<!-- Delete everything that was created in the before block -->
<deleteData createDataKey="createCategory" stepKey="deleteCatagory" />
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
<deleteData createDataKey="createModifiableProductAttribute" stepKey="deleteModifiableProductAttribute"/>
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/>
</after>
<!-- Get the current option of the attribute before it was changed -->
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/>
<waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/>
<grabTextFrom stepKey="getBeforeOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}"/>
<!-- Find the product that we just created using the product grid -->
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
<waitForPageLoad stepKey="waitForAdminProductPageLoad"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
<actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct">
<argument name="product" value="ApiConfigurableProduct"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductFilterLoad"/>
<click selector="{{AdminProductGridSection.firstRow}}" stepKey="clickOnProductPage"/>
<waitForPageLoad stepKey="waitForProductPageLoad"/>
<!-- change the option on the first attribute -->
<selectOption stepKey="clickFirstAttribute" selector="{{ModifyAttributes.nthExistingAttribute($$createModifiableProductAttribute.default_frontend_label$$)}}" userInput="option1"/>
<!-- Save the product -->
<click stepKey="saveProductAttribute" selector="{{AdminProductFormActionSection.saveButton}}"/>
<see stepKey="assertSuccess" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."/>
<!-- Go back to the configurable product page and check to see if it has changed -->
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage2"/>
<waitForPageLoad stepKey="waitForStoreFrontProductPageLoad2"/>
<grabTextFrom stepKey="getCurrentOption" selector="{{StorefrontProductInfoMainSection.nthAttributeOnPage('1')}}"/>
<assertNotEquals expected="{$getBeforeOption}" expectedType="string" actual="{$getCurrentOption}" actualType="string" stepKey="assertNotEquals"/>
</test>
<test name="AdminConfigurableProductUpdateChildAttributeTest">
<annotations>
<features value="ConfigurableProduct"/>
<stories value="Edit a configurable product in admin"/>
<title value="Admin should be able to update existing attributes of child products of a configurable product"/>
<description value="Admin should be able to update existing attributes of child products of a configurable product"/>
<severity value="AVERAGE"/>
<testCaseId value="MC-288"/>
<group value="ConfigurableProduct"/>
</annotations>
<before>
<!-- TODO: This should be converted to an actionGroup once MQE-993 is fixed. -->
<!-- Create the category the product will be a part of -->
<createData entity="ApiCategory" stepKey="createCategory"/>
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
<requiredEntity createDataKey="createCategory"/>
</createData>
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
<!-- Create the two attributes the product will have -->
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<createData entity="productAttributeOption2" stepKey="createConfigProductAttributeOption2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<!-- Add the product to the default set -->
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</createData>
<!-- Get the two attributes -->
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
</getData>
<!-- Create the two children product -->
<createData entity="ApiSimpleOne" stepKey="createConfigChildProduct1">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
</createData>
<createData entity="ApiSimpleTwo" stepKey="createConfigChildProduct2">
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption2"/>
</createData>
<!-- Create the two configurable product with both children -->
<createData entity="ConfigurableProductTwoOptions" stepKey="createConfigProductOption">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigProductAttribute"/>
<requiredEntity createDataKey="getConfigAttributeOption1"/>
<requiredEntity createDataKey="getConfigAttributeOption2"/>
</createData>
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild1">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct1"/>
</createData>
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
<requiredEntity createDataKey="createConfigProduct"/>
<requiredEntity createDataKey="createConfigChildProduct2"/>
</createData>
<!-- login -->
<actionGroup ref="LoginAsAdmin" stepKey="login"/>
</before>
<after>
<actionGroup ref="logout" stepKey="adminLogout"/>
<!-- Delete everything that was created in the before block -->
<deleteData createDataKey="createCategory" stepKey="deleteCatagory" />
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
<!-- Reindex invalidated indices after product attribute has been created/deleted -->
<actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/>
</after>
<!-- Find the product that we just created using the product grid -->
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
<waitForPageLoad stepKey="waitForAdminProductPageLoad"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
<actionGroup ref="filterProductGridBySku" stepKey="findCreatedProduct">
<argument name="product" value="$$createConfigProduct$$"/>
</actionGroup>
<waitForPageLoad stepKey="waitForProductFilterLoad"/>
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openProduct">
<argument name="product" value="$$createConfigProduct$$" />
</actionGroup>
<!-- Open the wizard for editing configurations and fill out a new attribute -->
<click stepKey="clickEditConfig" selector="{{AdminProductFormConfigurationsSection.createConfigurations}}"/>
<waitForPageLoad stepKey="waitForEditConfig"/>
<click stepKey="clickNextWizard" selector="{{AdminCreateProductConfigurationsPanel.next}}"/>
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}" stepKey="waitCreateNewValueAppears"/>
<click stepKey="createNewValue" selector="{{AdminCreateProductConfigurationsPanel.createNewValue}}"/>
<fillField stepKey="fillNewAttribute" selector="{{AdminCreateProductConfigurationsPanel.attributeName}}" userInput="simple"/>
<click stepKey="confirmNewAttribute" selector="{{AdminCreateProductConfigurationsPanel.saveAttribute}}"/>
<click stepKey="clickNextWizard2" selector="{{AdminCreateProductConfigurationsPanel.next}}"/>
<!-- Give the product a price and quantity -->
<click stepKey="click" selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}"/>
<fillField stepKey="fillProductQuantity" selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="{{_defaultProduct.quantity}}"/>
<click stepKey="clickNextWizard3" selector="{{AdminCreateProductConfigurationsPanel.next}}"/>
<click stepKey="clickGenerateProducts" selector="{{AdminCreateProductConfigurationsPanel.next}}"/>
<!-- Save the product -->
<waitForPageLoad stepKey="waitForGeneration"/>
<click stepKey="saveProductAttribute" selector="{{AdminProductFormActionSection.saveButton}}"/>
<see stepKey="assertSuccess" selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the product."/>
<!-- Check to make sure the created product has appeared on the configurable product storefront -->
<amOnPage url="/{{ApiConfigurableProduct.urlKey}}2.html" stepKey="goToConfigProductPage"/>
<waitForPageLoad stepKey="waitForStorefront"/>
<selectOption stepKey="clickFirstAttribute" selector="{{ModifyAttributes.nthExistingAttribute($$createConfigProductAttribute.default_frontend_label$$)}}" userInput="simple"/>
<waitForPageLoad stepKey="waitForPageExecution"/>
<see stepKey="checkPrice" selector="{{StorefrontProductInfoMainSection.productPrice}}" userInput="0.00"/>
<waitForPageLoad stepKey="waitForStoreFrontProductPageLoad"/>
<!-- Find the simple product that we just created using the product grid and delete it -->
<actionGroup ref="deleteProductBySku" stepKey="findCreatedProduct2">
<argument name="sku" value="{{ApiConfigurableProduct.sku}}2-simple"/>
</actionGroup>
</test>
</tests>