Skip to content

Commit 37160a9

Browse files
committed
MQE-1993: Refactor MFTF tests/actionGroups using <executeInSelenium>
Fixed downloadable tests to make it data agnostic
1 parent 5ce5139 commit 37160a9

10 files changed

+79
-53
lines changed

app/code/Magento/CatalogImportExport/Test/Mftf/ActionGroup/DeleteExportedFileActionGroup.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="DeleteExportedFileActionGroup">
1212
<annotations>
13-
<description>Deletes the provided Grid Index on the Exports grid page.</description>
13+
<description>Deletes the exported file on the Exports grid page.</description>
1414
</annotations>
1515
<arguments>
16-
<argument name="rowIndex" type="string"/>
16+
<argument name="fileName" type="string"/>
1717
</arguments>
1818

1919
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
2020
<waitForPageLoad time="30" stepKey="waitFormReload"/>
21-
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
22-
<click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.delete(rowIndex)}}" after="clickSelectBtn"/>
21+
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByFileName(fileName)}}"/>
22+
<click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.deleteByFileName(fileName)}}" after="clickSelectBtn"/>
2323
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
2424
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmDelete"/>
25-
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
26-
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
25+
<waitForPageLoad time="30" stepKey="waitFormReload2"/>
26+
<dontSeeElement selector="{{AdminExportAttributeSection.fileName(fileName)}}" stepKey="assertDontSeeFile"/>
2727
</actionGroup>
2828
</actionGroups>
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88

99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11-
<actionGroup name="DownloadFileByRowIndexActionGroup">
11+
<actionGroup name="DownloadFileActionGroup">
1212
<annotations>
13-
<description>Downloads the provided Grid Index on the Exports grid page.</description>
13+
<description>Downloads the provided fileName on the Exports grid page.</description>
1414
</annotations>
1515
<arguments>
16-
<argument name="rowIndex" type="string"/>
16+
<argument name="fileName" type="string"/>
1717
</arguments>
1818

1919
<reloadPage stepKey="refreshPage"/>
2020
<waitForPageLoad stepKey="waitFormReload"/>
21-
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
22-
<click stepKey="clickOnDownload" selector="{{AdminExportAttributeSection.download(rowIndex)}}" after="clickSelectBtn"/>
21+
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByFileName(fileName)}}"/>
22+
<click stepKey="clickOnDownload" selector="{{AdminExportAttributeSection.downloadByFileName(fileName)}}" after="clickSelectBtn"/>
2323
</actionGroup>
2424
</actionGroups>

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,6 @@
8888
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
8989
</before>
9090
<after>
91-
<!-- Delete exported file -->
92-
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
93-
<argument name="rowIndex" value="0"/>
94-
</actionGroup>
95-
9691
<!-- Delete products creations -->
9792
<deleteData createDataKey="createDynamicBundleProduct" stepKey="deleteDynamicBundleProduct"/>
9893
<deleteData createDataKey="firstSimpleProductForDynamic" stepKey="deleteFirstSimpleProductForDynamic"/>
@@ -122,9 +117,16 @@
122117
<magentoCLI command="cron:run" stepKey="runCron3"/>
123118
<magentoCLI command="cron:run" stepKey="runCron4"/>
124119

120+
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
121+
125122
<!-- Download product -->
126-
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
127-
<argument name="rowIndex" value="0"/>
123+
<actionGroup ref="DownloadFileActionGroup" stepKey="downloadCreatedProducts">
124+
<argument name="fileName" value="{$grabNameFile}"/>
125+
</actionGroup>
126+
127+
<!-- Delete exported file -->
128+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
129+
<argument name="fileName" value="{$grabNameFile}"/>
128130
</actionGroup>
129131
</test>
130132
</tests>

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@
5656
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
5757
</before>
5858
<after>
59-
<!-- Delete exported file -->
60-
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
61-
<argument name="rowIndex" value="0"/>
62-
</actionGroup>
63-
6459
<!-- Deleted created products -->
6560
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
6661
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
@@ -84,9 +79,16 @@
8479
<magentoCLI command="cron:run" stepKey="runCron3"/>
8580
<magentoCLI command="cron:run" stepKey="runCron4"/>
8681

82+
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
83+
8784
<!-- Download product -->
88-
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
89-
<argument name="rowIndex" value="0"/>
85+
<actionGroup ref="DownloadFileActionGroup" stepKey="downloadCreatedProducts">
86+
<argument name="fileName" value="{$grabNameFile}"/>
87+
</actionGroup>
88+
89+
<!-- Delete exported file -->
90+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
91+
<argument name="fileName" value="{$grabNameFile}"/>
9092
</actionGroup>
9193
</test>
9294
</tests>

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@
130130
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
131131
</before>
132132
<after>
133-
<!-- Delete exported file -->
134-
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
135-
<argument name="rowIndex" value="0"/>
136-
</actionGroup>
137-
138133
<!-- Remove downloadable domains -->
139134
<magentoCLI stepKey="removeDownloadableDomain" command="downloadable:domains:remove example.com static.magento.com"/>
140135

@@ -174,9 +169,11 @@
174169
<magentoCLI command="cron:run" stepKey="runCronFirstTime"/>
175170
<magentoCLI command="cron:run" stepKey="runCronSecondTime"/>
176171

172+
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
173+
177174
<!-- Save exported file: file successfully downloaded -->
178-
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
179-
<argument name="rowIndex" value="0"/>
175+
<actionGroup ref="DownloadFileActionGroup" stepKey="downloadCreatedProducts">
176+
<argument name="fileName" value="{$grabNameFile}"/>
180177
</actionGroup>
181178

182179
<!-- Go to Catalog > Products. Find ConfProd and delete it -->
@@ -224,5 +221,10 @@
224221
<argument name="image" value="MagentoLogo"/>
225222
</actionGroup>
226223
<closeTab stepKey="closeConfigChildProductPage"/>
224+
225+
<!-- Delete exported file -->
226+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
227+
<argument name="fileName" value="{$grabNameFile}"/>
228+
</actionGroup>
227229
</test>
228230
</tests>

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@
8181
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
8282
</before>
8383
<after>
84-
<!-- Delete exported file -->
85-
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
86-
<argument name="rowIndex" value="0"/>
87-
</actionGroup>
8884
<!-- Delete configurable product creation -->
8985
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
9086
<deleteData createDataKey="createConfigFirstChildProduct" stepKey="deleteConfigFirstChildProduct"/>
@@ -113,9 +109,16 @@
113109
<magentoCLI command="cron:run" stepKey="runCron3"/>
114110
<magentoCLI command="cron:run" stepKey="runCron4"/>
115111

112+
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
113+
116114
<!-- Download product -->
117-
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
118-
<argument name="rowIndex" value="0"/>
115+
<actionGroup ref="DownloadFileActionGroup" stepKey="downloadCreatedProducts">
116+
<argument name="fileName" value="{$grabNameFile}"/>
117+
</actionGroup>
118+
119+
<!-- Delete exported file -->
120+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
121+
<argument name="fileName" value="{$grabNameFile}"/>
119122
</actionGroup>
120123
</test>
121124
</tests>

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,16 @@
129129
<magentoCLI command="cron:run" stepKey="runCron3"/>
130130
<magentoCLI command="cron:run" stepKey="runCron4"/>
131131

132+
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
133+
132134
<!-- Download product -->
133-
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
134-
<argument name="rowIndex" value="0"/>
135+
<actionGroup ref="DownloadFileActionGroup" stepKey="downloadCreatedProducts">
136+
<argument name="fileName" value="{$grabNameFile}"/>
137+
</actionGroup>
138+
139+
<!-- Delete exported file -->
140+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
141+
<argument name="fileName" value="{$grabNameFile}"/>
135142
</actionGroup>
136143
</test>
137144
</tests>

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@
7979
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
8080
</before>
8181
<after>
82-
<!-- Delete exported file -->
83-
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
84-
<argument name="rowIndex" value="0"/>
85-
</actionGroup>
8682

8783
<!-- Delete simple product -->
8884
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
@@ -112,9 +108,16 @@
112108
<magentoCLI command="cron:run" stepKey="runCron3"/>
113109
<magentoCLI command="cron:run" stepKey="runCron4"/>
114110

111+
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
112+
115113
<!-- Download product -->
116-
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
117-
<argument name="rowIndex" value="0"/>
114+
<actionGroup ref="DownloadFileActionGroup" stepKey="downloadCreatedProducts">
115+
<argument name="fileName" value="{$grabNameFile}"/>
116+
</actionGroup>
117+
118+
<!-- Delete exported file -->
119+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
120+
<argument name="fileName" value="{$grabNameFile}"/>
118121
</actionGroup>
119122
</test>
120123
</tests>

app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
3737
</before>
3838
<after>
39-
<!-- Delete exported file -->
40-
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
41-
<argument name="rowIndex" value="0"/>
42-
</actionGroup>
43-
4439
<!-- Delete product creations -->
4540
<deleteData createDataKey="createSimpleProductWithCustomAttributeSet" stepKey="deleteSimpleProductWithCustomAttributeSet"/>
4641
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>
@@ -61,9 +56,17 @@
6156
<magentoCLI command="cron:run" stepKey="runCron3"/>
6257
<magentoCLI command="cron:run" stepKey="runCron4"/>
6358

59+
<grabTextFrom selector="{{AdminExportAttributeSection.exportFileNameByPosition('0')}}" stepKey="grabNameFile"/>
60+
6461
<!-- Download product -->
65-
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
66-
<argument name="rowIndex" value="0"/>
62+
<actionGroup ref="DownloadFileActionGroup" stepKey="downloadCreatedProducts">
63+
<argument name="fileName" value="{$grabNameFile}"/>
6764
</actionGroup>
65+
66+
<!-- Delete exported file -->
67+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
68+
<argument name="fileName" value="{$grabNameFile}"/>
69+
</actionGroup>
70+
6871
</test>
6972
</tests>

app/code/Magento/ImportExport/Test/Mftf/Section/AdminExportAttributeSection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,9 @@
1818
<element name="download" type="button" selector="//tr[@data-repeat-index='{{var}}']//a[text()='Download']" parameterized="true" timeout="30"/>
1919
<element name="delete" type="button" selector="//tr[@data-repeat-index='{{var}}']//a[text()='Delete']" parameterized="true" timeout="30"/>
2020
<element name="exportFileNameByPosition" type="text" selector="[data-role='grid'] tr[data-repeat-index='{{position}}'] div.data-grid-cell-content" parameterized="true"/>
21+
<element name="fileName" type="text" selector="//div[@class='data-grid-cell-content'][text()='{{fileName}}']" parameterized="true"/>
22+
<element name="selectByFileName" type="button" selector="//div[@class='data-grid-cell-content'][text()='{{fileName}}']/../..//button[@class='action-select']" parameterized="true"/>
23+
<element name="downloadByFileName" type="button" selector="//div[@class='data-grid-cell-content'][text()='{{fileName}}']/../..//a[text()='Download']" parameterized="true" timeout="30"/>
24+
<element name="deleteByFileName" type="button" selector="//div[@class='data-grid-cell-content'][text()='{{fileName}}']/../..//a[text()='Delete']" parameterized="true" timeout="30"/>
2125
</section>
2226
</sections>

0 commit comments

Comments
 (0)