Skip to content

Commit f77e404

Browse files
committed
MC-4416: Convert CreateProductAttributeEntityTest to MFTF
- Added 2 variations
1 parent a51df0a commit f77e404

File tree

2 files changed

+169
-0
lines changed

2 files changed

+169
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,22 @@
139139
<data key="option3_admin" unique="suffix">opt3Admin</data>
140140
<data key="option3_frontend" unique="suffix">opt3Front</data>
141141
</entity>
142+
<entity name="multiselectProductAttribute" extends="productAttributeWysiwyg" type="ProductAttribute">
143+
<data key="frontend_input">multiselect</data>
144+
<data key="frontend_input_admin">Multiple Select</data>
145+
<data key="is_required_admin">No</data>
146+
<data key="option1_admin" unique="suffix">opt1Admin</data>
147+
<data key="option1_frontend" unique="suffix">opt1Front</data>
148+
<data key="option2_admin" unique="suffix">opt2Admin</data>
149+
<data key="option2_frontend" unique="suffix">opt2Front</data>
150+
<data key="option3_admin" unique="suffix">opt3Admin</data>
151+
<data key="option3_frontend" unique="suffix">opt3Front</data>
152+
</entity>
153+
<entity name="dropdownProductAttributeWithQuote" extends="productAttributeWysiwyg" type="ProductAttribute">
154+
<data key="frontend_input">select</data>
155+
<data key="frontend_input_admin">Dropdown</data>
156+
<data key="is_required_admin">No</data>
157+
<data key="option1_admin" unique="suffix">opt1'Admin</data>
158+
<data key="option1_frontend" unique="suffix">opt1'Front</data>
159+
</entity>
142160
</entities>

app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,4 +255,155 @@
255255
<see stepKey="seeOption2Available" selector="{{AdminProductAttributesSection.attributeDropdownByCode(dropdownProductAttribute.attribute_code)}}" userInput="{{dropdownProductAttribute.option2_frontend}}"/>
256256
<see stepKey="seeOption3Available" selector="{{AdminProductAttributesSection.attributeDropdownByCode(dropdownProductAttribute.attribute_code)}}" userInput="{{dropdownProductAttribute.option3_frontend}}"/>
257257
</test>
258+
259+
<test name="CreateProductAttributeEntityDropdownWithSingleQuoteTest">
260+
<annotations>
261+
<features value="Catalog"/>
262+
<stories value="Create Product Attributes"/>
263+
<title value="Admin should be able to create a Dropdown product attribute containing a single quote"/>
264+
<description value="Admin should be able to create a Dropdown product attribute containing a single quote"/>
265+
<severity value="CRITICAL"/>
266+
<testCaseId value="MC-10898"/>
267+
<group value="Catalog"/>
268+
</annotations>
269+
<before>
270+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
271+
</before>
272+
<after>
273+
<actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage">
274+
<argument name="ProductAttribute" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/>
275+
</actionGroup>
276+
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
277+
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
278+
<waitForPageLoad stepKey="waitForDeletion"/>
279+
</after>
280+
281+
<!--Navigate to Stores > Attributes > Product.-->
282+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/>
283+
284+
<!--Create new Product Attribute as TextField, with code and default value.-->
285+
<actionGroup ref="createProductAttribute" stepKey="createAttribute">
286+
<argument name="attribute" value="dropdownProductAttributeWithQuote"/>
287+
</actionGroup>
288+
289+
<!--Navigate to Product Attribute, add Product Option and Save - 1-->
290+
<actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage1">
291+
<argument name="ProductAttribute" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/>
292+
</actionGroup>
293+
<actionGroup ref="createAttributeDropdownNthOptionAsDefault" stepKey="createOption1">
294+
<argument name="adminName" value="{{dropdownProductAttributeWithQuote.option1_admin}}"/>
295+
<argument name="frontName" value="{{dropdownProductAttributeWithQuote.option1_frontend}}"/>
296+
<argument name="row" value="1"/>
297+
</actionGroup>
298+
<click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/>
299+
300+
<!--Perform appropriate assertions against dropdownProductAttribute entity-->
301+
<actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPageForAssertions">
302+
<argument name="ProductAttribute" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/>
303+
</actionGroup>
304+
<seeInField stepKey="assertLabel" selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{dropdownProductAttributeWithQuote.attribute_code}}"/>
305+
<seeOptionIsSelected stepKey="assertInputType" selector="{{AttributePropertiesSection.InputType}}" userInput="{{dropdownProductAttributeWithQuote.frontend_input_admin}}"/>
306+
<seeOptionIsSelected stepKey="assertRequired" selector="{{AttributePropertiesSection.ValueRequired}}" userInput="{{dropdownProductAttributeWithQuote.is_required_admin}}"/>
307+
<seeInField stepKey="assertAttrCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{dropdownProductAttributeWithQuote.attribute_code}}"/>
308+
309+
<!--Assert options are in order and with correct attributes-->
310+
<seeInField stepKey="seeOption1Admin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('1')}}" userInput="{{dropdownProductAttributeWithQuote.option1_admin}}"/>
311+
<seeInField stepKey="seeOption1StoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('1')}}" userInput="{{dropdownProductAttributeWithQuote.option1_frontend}}"/>
312+
<seeCheckboxIsChecked stepKey="seeOption1Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('1')}}"/>
313+
314+
315+
<!--Go to New Product page, add Attribute and check dropdown values-->
316+
<amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/>
317+
<actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct">
318+
<argument name="attributeCode" value="{{dropdownProductAttributeWithQuote.attribute_code}}"/>
319+
</actionGroup>
320+
<click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/>
321+
<waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(dropdownProductAttributeWithQuote.attribute_code)}}" stepKey="waitforLabel"/>
322+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(dropdownProductAttributeWithQuote.attribute_code)}}" userInput="{{dropdownProductAttributeWithQuote.option1_frontend}}" stepKey="seeDefaultIsCorrect"/>
323+
<see stepKey="seeOption1Available" selector="{{AdminProductAttributesSection.attributeDropdownByCode(dropdownProductAttributeWithQuote.attribute_code)}}" userInput="{{dropdownProductAttributeWithQuote.option1_frontend}}"/>
324+
</test>
325+
326+
<test name="CreateProductAttributeEntityMultiSelectTest">
327+
<annotations>
328+
<features value="Catalog"/>
329+
<stories value="Create Product Attributes"/>
330+
<title value="Admin should be able to create a MultiSelect product attribute"/>
331+
<description value="Admin should be able to create a MultiSelect product attribute"/>
332+
<severity value="CRITICAL"/>
333+
<testCaseId value="MC-10888"/>
334+
<group value="Catalog"/>
335+
</annotations>
336+
<before>
337+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
338+
</before>
339+
<after>
340+
<actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage">
341+
<argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/>
342+
</actionGroup>
343+
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
344+
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
345+
<waitForPageLoad stepKey="waitForDeletion"/>
346+
</after>
347+
348+
<!--Navigate to Stores > Attributes > Product.-->
349+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/>
350+
351+
<!--Create new Product Attribute as TextField, with code and default value.-->
352+
<actionGroup ref="createProductAttribute" stepKey="createAttribute">
353+
<argument name="attribute" value="multiselectProductAttribute"/>
354+
</actionGroup>
355+
356+
<!--Navigate to Product Attribute, add Product Options and Save - 1-->
357+
<actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPage1">
358+
<argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/>
359+
</actionGroup>
360+
<actionGroup ref="createAttributeDropdownNthOption" stepKey="createOption1">
361+
<argument name="adminName" value="{{multiselectProductAttribute.option1_admin}}"/>
362+
<argument name="frontName" value="{{multiselectProductAttribute.option1_frontend}}"/>
363+
<argument name="row" value="1"/>
364+
</actionGroup>
365+
<actionGroup ref="createAttributeDropdownNthOption" stepKey="createOption2">
366+
<argument name="adminName" value="{{multiselectProductAttribute.option2_admin}}"/>
367+
<argument name="frontName" value="{{multiselectProductAttribute.option2_frontend}}"/>
368+
<argument name="row" value="2"/>
369+
</actionGroup>
370+
<actionGroup ref="createAttributeDropdownNthOptionAsDefault" stepKey="createOption3">
371+
<argument name="adminName" value="{{multiselectProductAttribute.option3_admin}}"/>
372+
<argument name="frontName" value="{{multiselectProductAttribute.option3_frontend}}"/>
373+
<argument name="row" value="3"/>
374+
</actionGroup>
375+
<click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/>
376+
377+
<!--Perform appropriate assertions against multiselectProductAttribute entity-->
378+
<actionGroup ref="navigateToEditProductAttribute" stepKey="goToEditPageForAssertions">
379+
<argument name="ProductAttribute" value="{{multiselectProductAttribute.attribute_code}}"/>
380+
</actionGroup>
381+
<seeInField stepKey="assertLabel" selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{multiselectProductAttribute.attribute_code}}"/>
382+
<seeOptionIsSelected stepKey="assertInputType" selector="{{AttributePropertiesSection.InputType}}" userInput="{{multiselectProductAttribute.frontend_input_admin}}"/>
383+
<seeOptionIsSelected stepKey="assertRequired" selector="{{AttributePropertiesSection.ValueRequired}}" userInput="{{multiselectProductAttribute.is_required_admin}}"/>
384+
<seeInField stepKey="assertAttrCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{multiselectProductAttribute.attribute_code}}"/>
385+
386+
<!--Assert options are in order and with correct attributes-->
387+
<seeInField stepKey="seeOption1Admin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('1')}}" userInput="{{multiselectProductAttribute.option1_admin}}"/>
388+
<seeInField stepKey="seeOption1StoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('1')}}" userInput="{{multiselectProductAttribute.option1_frontend}}"/>
389+
<dontSeeCheckboxIsChecked stepKey="dontSeeOption1Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('1')}}"/>
390+
<seeInField stepKey="seeOption2Admin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('2')}}" userInput="{{multiselectProductAttribute.option2_admin}}"/>
391+
<seeInField stepKey="seeOption2StoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('2')}}" userInput="{{multiselectProductAttribute.option2_frontend}}"/>
392+
<dontSeeCheckboxIsChecked stepKey="dontSeeOption2Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('2')}}"/>
393+
<seeInField stepKey="seeOption3Admin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin('3')}}" userInput="{{multiselectProductAttribute.option3_admin}}"/>
394+
<seeInField stepKey="seeOption3StoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('3')}}" userInput="{{multiselectProductAttribute.option3_frontend}}"/>
395+
<seeCheckboxIsChecked stepKey="seeOption3Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('3')}}"/>
396+
397+
<!--Go to New Product page, add Attribute and check multiselect values-->
398+
<amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/>
399+
<actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct">
400+
<argument name="attributeCode" value="{{multiselectProductAttribute.attribute_code}}"/>
401+
</actionGroup>
402+
<click stepKey="openAttributes" selector="{{AdminProductAttributesSection.sectionHeader}}"/>
403+
<waitForElementVisible selector="{{AdminProductAttributesSection.attributeDropdownByCode(multiselectProductAttribute.attribute_code)}}" stepKey="waitforLabel"/>
404+
<seeOptionIsSelected selector="{{AdminProductAttributesSection.attributeDropdownByCode(multiselectProductAttribute.attribute_code)}}" userInput="{{multiselectProductAttribute.option3_frontend}}" stepKey="seeDefaultIsCorrect"/>
405+
<see stepKey="seeOption1Available" selector="{{AdminProductAttributesSection.attributeDropdownByCode(multiselectProductAttribute.attribute_code)}}" userInput="{{multiselectProductAttribute.option1_frontend}}"/>
406+
<see stepKey="seeOption2Available" selector="{{AdminProductAttributesSection.attributeDropdownByCode(multiselectProductAttribute.attribute_code)}}" userInput="{{multiselectProductAttribute.option2_frontend}}"/>
407+
<see stepKey="seeOption3Available" selector="{{AdminProductAttributesSection.attributeDropdownByCode(multiselectProductAttribute.attribute_code)}}" userInput="{{multiselectProductAttribute.option3_frontend}}"/>
408+
</test>
258409
</tests>

0 commit comments

Comments
 (0)