Skip to content

Commit 5821d6d

Browse files
committed
MC-4416: Convert CreateProductAttributeEntityTest to MFTF
- Editing selectors slightly to make them more stable. - Adding Logout AG to the "after" block.
1 parent 74e632e commit 5821d6d

File tree

4 files changed

+25
-6
lines changed

4 files changed

+25
-6
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/>
2020
<waitForPageLoad stepKey="waitForPageLoad2" />
2121
</actionGroup>
22+
2223
<actionGroup name="navigateToEditProductAttribute">
2324
<arguments>
2425
<argument name="ProductAttribute" type="string"/>
@@ -30,6 +31,7 @@
3031
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="navigateToAttributeEditPage3" />
3132
<waitForPageLoad stepKey="waitForPageLoad3" />
3233
</actionGroup>
34+
3335
<actionGroup name="changeUseForPromoRuleConditionsProductAttribute">
3436
<arguments>
3537
<argument name="option" type="string"/>
@@ -40,13 +42,15 @@
4042
<click selector="{{AttributePropertiesSection.Save}}" stepKey="saveAttribute"/>
4143
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product attribute." stepKey="successMessage"/>
4244
</actionGroup>
45+
4346
<actionGroup name="deleteProductAttribute" extends="navigateToCreatedProductAttribute">
4447
<click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/>
4548
<click selector="{{ModalConfirmationSection.OkButton}}" stepKey="ClickOnDeleteButton"/>
4649
<waitForPageLoad stepKey="waitForPageLoad"/>
4750
<seeElement selector="{{AdminProductMessagesSection.successMessage}}"
4851
stepKey="waitForSuccessMessage"/>
4952
</actionGroup>
53+
5054
<!--Clicks Add Attribute and adds the given attribute-->
5155
<actionGroup name="addProductAttributeInProductModal">
5256
<arguments>
@@ -61,6 +65,7 @@
6165
<checkOption selector="{{AdminProductAddAttributeModalSection.firstRowCheckBox}}" stepKey="checkAttribute"/>
6266
<click stepKey="addSelected" selector="{{AdminProductAddAttributeModalSection.addSelected}}"/>
6367
</actionGroup>
68+
6469
<!--Clicks createNewAttribute and fills out form-->
6570
<actionGroup name="createProductAttribute">
6671
<arguments>
@@ -72,12 +77,14 @@
7277
<selectOption selector="{{AttributePropertiesSection.ValueRequired}}" stepKey="checkRequired" userInput="{{attribute.is_required_admin}}"/>
7378
<click stepKey="saveAttribute" selector="{{AttributePropertiesSection.Save}}"/>
7479
</actionGroup>
80+
7581
<!-- Inputs text default value and attribute code-->
7682
<actionGroup name="createProductAttributeWithTextField" extends="createProductAttribute" insertAfter="checkRequired">
7783
<click stepKey="openAdvancedProperties" selector="{{AdvancedAttributePropertiesSection.AdvancedAttributePropertiesSectionToggle}}"/>
7884
<fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/>
7985
<fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueText}}" userInput="{{attribute.default_value}}"/>
8086
</actionGroup>
87+
8188
<!-- Inputs date default value and attribute code-->
8289
<actionGroup name="createProductAttributeWithDateField" extends="createProductAttribute" insertAfter="checkRequired">
8390
<arguments>
@@ -87,6 +94,7 @@
8794
<fillField stepKey="fillCode" selector="{{AdvancedAttributePropertiesSection.AttributeCode}}" userInput="{{attribute.attribute_code}}"/>
8895
<fillField stepKey="fillDefaultValue" selector="{{AdvancedAttributePropertiesSection.DefaultValueDate}}" userInput="{{date}}"/>
8996
</actionGroup>
97+
9098
<!-- Creates dropdown option at row without saving-->
9199
<actionGroup name="createAttributeDropdownNthOption">
92100
<arguments>
@@ -99,6 +107,7 @@
99107
<fillField stepKey="fillAdmin" selector="{{AttributePropertiesSection.dropdownNthOptionAdmin(row)}}" userInput="{{adminName}}"/>
100108
<fillField stepKey="fillStoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView(row)}}" userInput="{{frontName}}"/>
101109
</actionGroup>
110+
102111
<!-- Creates dropdown option at row as default-->
103112
<actionGroup name="createAttributeDropdownNthOptionAsDefault" extends="createAttributeDropdownNthOption">
104113
<checkOption selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault(row)}}" stepKey="setAsDefault" after="fillStoreView"/>

app/code/Magento/Catalog/Test/Mftf/Section/AdminCreateProductAttributeSection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
<element name="dropdownNthOptionDelete" type="button" selector="tbody[data-role='options-container'] tr:nth-child({{var}}) button[title='Delete']" parameterized="true"/>
3232
</section>
3333
<section name="AttributeDeleteModalSection">
34-
<element name="confirm" type="button" selector=".modal-popup.confirm button.action-accept"/>
35-
<element name="cancel" type="button" selector=".modal-popup.confirm button.action-dismiss"/>
34+
<element name="confirm" type="button" selector=".modal-popup.confirm .action-accept"/>
35+
<element name="cancel" type="button" selector=".modal-popup.confirm .action-dismiss"/>
3636
</section>
3737
<section name="AttributeManageSwatchSection">
3838
<element name="swatchField" type="input" selector="//th[contains(@class, 'col-swatch')]/span[contains(text(), '{{arg}}')]/ancestor::thead/following-sibling::tbody//input[@placeholder='Swatch']" parameterized="true"/>

app/code/Magento/Catalog/Test/Mftf/Section/AdminProductAddAttributeModalSection.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminProductAddAttributeModalSection">
12-
<element name="addSelected" type="button" selector=".product_form_product_form_add_attribute_modal .page-main-actions button.action-primary" timeout="30"/>
12+
<element name="addSelected" type="button" selector=".product_form_product_form_add_attribute_modal .page-main-actions .action-primary" timeout="30"/>
1313
<element name="filters" type="button" selector=".product_form_product_form_add_attribute_modal button[data-action='grid-filter-expand']" timeout="30"/>
1414
<element name="attributeCodeFilter" type="textarea" selector=".product_form_product_form_add_attribute_modal input[name='attribute_code']"/>
15-
<element name="clearFilters" type="button" selector=".product_form_product_form_add_attribute_modal button.action-clear" timeout="30"/>
15+
<element name="clearFilters" type="button" selector=".product_form_product_form_add_attribute_modal .action-clear" timeout="30"/>
1616
<element name="firstRowCheckBox" type="input" selector=".product_form_product_form_add_attribute_modal .data-grid-checkbox-cell input"/>
17-
<element name="applyFilters" type="button" selector=".product_form_product_form_add_attribute_modal .admin__data-grid-filters-footer button.action-secondary" timeout="30"/>
17+
<element name="applyFilters" type="button" selector=".product_form_product_form_add_attribute_modal .admin__data-grid-filters-footer .action-secondary" timeout="30"/>
1818
</section>
1919
</sections>

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<testCaseId value="MC-10894"/>
1919
<group value="Catalog"/>
2020
</annotations>
21+
2122
<before>
2223
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
2324
</before>
@@ -28,6 +29,7 @@
2829
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
2930
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
3031
<waitForPageLoad stepKey="waitForDeletion"/>
32+
<actionGroup ref="logout" stepKey="logout"/>
3133
</after>
3234

3335
<!--Navigate to Stores > Attributes > Product.-->
@@ -74,6 +76,7 @@
7476
<issueId value="MC-13817"/>
7577
</skip>
7678
</annotations>
79+
7780
<before>
7881
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
7982
</before>
@@ -84,6 +87,7 @@
8487
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
8588
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
8689
<waitForPageLoad stepKey="waitForDeletion"/>
90+
<actionGroup ref="logout" stepKey="logout"/>
8791
</after>
8892

8993
<!--Generate date for use as default value, needs to be MM/d/YYYY -->
@@ -131,6 +135,7 @@
131135
<testCaseId value="MC-10897"/>
132136
<group value="Catalog"/>
133137
</annotations>
138+
134139
<before>
135140
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
136141
</before>
@@ -141,6 +146,7 @@
141146
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
142147
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
143148
<waitForPageLoad stepKey="waitForDeletion"/>
149+
<actionGroup ref="logout" stepKey="logout"/>
144150
</after>
145151

146152
<!--Navigate to Stores > Attributes > Product.-->
@@ -182,6 +188,7 @@
182188
<testCaseId value="MC-10896"/>
183189
<group value="Catalog"/>
184190
</annotations>
191+
185192
<before>
186193
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
187194
</before>
@@ -192,6 +199,7 @@
192199
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
193200
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
194201
<waitForPageLoad stepKey="waitForDeletion"/>
202+
<actionGroup ref="logout" stepKey="logout"/>
195203
</after>
196204

197205
<!--Navigate to Stores > Attributes > Product.-->
@@ -266,6 +274,7 @@
266274
<testCaseId value="MC-10898"/>
267275
<group value="Catalog"/>
268276
</annotations>
277+
269278
<before>
270279
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
271280
</before>
@@ -276,6 +285,7 @@
276285
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
277286
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
278287
<waitForPageLoad stepKey="waitForDeletion"/>
288+
<actionGroup ref="logout" stepKey="logout"/>
279289
</after>
280290

281291
<!--Navigate to Stores > Attributes > Product.-->
@@ -311,7 +321,6 @@
311321
<seeInField stepKey="seeOption1StoreView" selector="{{AttributePropertiesSection.dropdownNthOptionDefaultStoreView('1')}}" userInput="{{dropdownProductAttributeWithQuote.option1_frontend}}"/>
312322
<seeCheckboxIsChecked stepKey="seeOption1Default" selector="{{AttributePropertiesSection.dropdownNthOptionIsDefault('1')}}"/>
313323

314-
315324
<!--Go to New Product page, add Attribute and check dropdown values-->
316325
<amOnPage url="{{AdminProductCreatePage.url('4', 'simple')}}" stepKey="goToCreateSimpleProductPage"/>
317326
<actionGroup ref="addProductAttributeInProductModal" stepKey="addAttributeToProduct">
@@ -343,6 +352,7 @@
343352
<click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/>
344353
<click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/>
345354
<waitForPageLoad stepKey="waitForDeletion"/>
355+
<actionGroup ref="logout" stepKey="logout"/>
346356
</after>
347357

348358
<!--Navigate to Stores > Attributes > Product.-->

0 commit comments

Comments
 (0)