Skip to content

Commit 4fe6715

Browse files
ENGCOM-6398: MFTF: Extract Action Groups to separate files - magento/module-catalog-import-export #25846
2 parents 042890b + a206600 commit 4fe6715

13 files changed

+166
-129
lines changed

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

Lines changed: 0 additions & 102 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="DeleteAllExportedFilesActionGroup">
12+
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
13+
<executeInSelenium
14+
function="
15+
function ($webdriver) use ($I) {
16+
$buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button'));
17+
while(!empty($buttons)) {
18+
$buttons[0]->click();
19+
$I->waitForElementVisible('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']', 10);
20+
$deleteButton = $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']'));
21+
$deleteButton->click();
22+
$I->waitForElementVisible('.modal-popup.confirm button.action-accept', 10);
23+
$I->click('.modal-popup.confirm button.action-accept');
24+
$I->waitForPageLoad(60);
25+
$buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button'));
26+
}
27+
}"
28+
stepKey="deleteAllExportedFilesOneByOne"/>
29+
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
30+
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
31+
</actionGroup>
32+
</actionGroups>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="DeleteExportedFileActionGroup">
12+
<annotations>
13+
<description>Deletes the provided Grid Index on the Exports grid page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="rowIndex" type="string"/>
17+
</arguments>
18+
19+
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
20+
<waitForPageLoad time="30" stepKey="waitFormReload"/>
21+
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
22+
<click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.delete(rowIndex)}}" after="clickSelectBtn"/>
23+
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
24+
<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"/>
27+
</actionGroup>
28+
</actionGroups>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="DownloadFileByRowIndexActionGroup">
12+
<annotations>
13+
<description>Downloads the provided Grid Index on the Exports grid page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="rowIndex" type="string"/>
17+
</arguments>
18+
19+
<reloadPage stepKey="refreshPage"/>
20+
<waitForPageLoad stepKey="waitFormReload"/>
21+
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
22+
<click stepKey="clickOnDownload" selector="{{AdminExportAttributeSection.download(rowIndex)}}" after="clickSelectBtn"/>
23+
</actionGroup>
24+
</actionGroups>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="ExportAllProductsActionGroup">
12+
<annotations>
13+
<description>Exports the unfiltered Products list. Validates that the Success Message is present.</description>
14+
</annotations>
15+
16+
<selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/>
17+
<waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible" time="5"/>
18+
<scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/>
19+
<wait stepKey="waitForScroll" time="5"/>
20+
<click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/>
21+
<wait stepKey="waitForClick" time="5"/>
22+
<see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue, wait to get your file soon. Make sure your cron job is running to export the file" stepKey="seeSuccessMessage"/>
23+
</actionGroup>
24+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<!-- Export products using filtering by attribute -->
12+
<actionGroup name="ExportProductsFilterByAttributeActionGroup">
13+
<annotations>
14+
<description>Filters Products by the provided Attribute. Exports the filtered Products list. Validates that the Success Message is present.</description>
15+
</annotations>
16+
<arguments>
17+
<argument name="attribute" type="string"/>
18+
<argument name="attributeData" type="string"/>
19+
</arguments>
20+
21+
<selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/>
22+
<waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible"/>
23+
<scrollTo selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="scrollToAttribute"/>
24+
<checkOption selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="selectAttribute"/>
25+
<fillField selector="{{AdminExportAttributeSection.fillFilter('attribute')}}" userInput="{{attributeData}}" stepKey="setDataInField"/>
26+
<waitForPageLoad stepKey="waitForUserInput"/>
27+
<scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/>
28+
<click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/>
29+
<see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue, wait to get your file soon" stepKey="seeSuccessMessage"/>
30+
</actionGroup>
31+
</actionGroups>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
<!-- Login as admin -->
8888
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
89-
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
89+
<actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/>
9090
</before>
9191
<after>
9292
<!-- Delete products creations -->
@@ -102,7 +102,7 @@
102102
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
103103

104104
<!-- Delete exported file -->
105-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
105+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
106106
<argument name="rowIndex" value="0"/>
107107
</actionGroup>
108108
<!-- Log out -->
@@ -113,14 +113,14 @@
113113
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
114114

115115
<!-- Export created below products -->
116-
<actionGroup ref="exportAllProducts" stepKey="exportCreatedProducts"/>
116+
<actionGroup ref="ExportAllProductsActionGroup" stepKey="exportCreatedProducts"/>
117117

118118
<!-- Run cron -->
119119
<magentoCLI command="cron:run" stepKey="runCron3"/>
120120
<magentoCLI command="cron:run" stepKey="runCron4"/>
121121

122122
<!-- Download product -->
123-
<actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts">
123+
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
124124
<argument name="rowIndex" value="0"/>
125125
</actionGroup>
126126
</test>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454

5555
<!-- Login as admin -->
5656
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
57-
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
57+
<actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/>
5858
</before>
5959
<after>
6060
<!-- Deleted created products -->
@@ -66,7 +66,7 @@
6666
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
6767

6868
<!-- Delete exported file -->
69-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
69+
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
7070
<argument name="rowIndex" value="0"/>
7171
</actionGroup>
7272
<!-- Log out -->
@@ -78,14 +78,14 @@
7878
<waitForPageLoad stepKey="waitForExportIndexPageLoad"/>
7979

8080
<!-- Export created below products -->
81-
<actionGroup ref="exportAllProducts" stepKey="exportCreatedProducts"/>
81+
<actionGroup ref="ExportAllProductsActionGroup" stepKey="exportCreatedProducts"/>
8282

8383
<!-- Run cron -->
8484
<magentoCLI command="cron:run" stepKey="runCron3"/>
8585
<magentoCLI command="cron:run" stepKey="runCron4"/>
8686

8787
<!-- Download product -->
88-
<actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts">
88+
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
8989
<argument name="rowIndex" value="0"/>
9090
</actionGroup>
9191
</test>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128

129129
<!-- Login as admin -->
130130
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
131-
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
131+
<actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/>
132132
</before>
133133
<after>
134134
<!-- Remove downloadable domains -->
@@ -159,7 +159,7 @@
159159
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
160160

161161
<!-- Set Export Settings: Entity Type > Products, SKU > ConfProd's sku and press "Continue" -->
162-
<actionGroup ref="exportProductsFilterByAttribute" stepKey="exportProductBySku">
162+
<actionGroup ref="ExportProductsFilterByAttributeActionGroup" stepKey="exportProductBySku">
163163
<argument name="attribute" value="sku"/>
164164
<argument name="attributeData" value="$$createExportImportConfigurableProduct.sku$$"/>
165165
</actionGroup>
@@ -169,7 +169,7 @@
169169
<magentoCLI command="cron:run" stepKey="runCronSecondTime"/>
170170

171171
<!-- Save exported file: file successfully downloaded -->
172-
<actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts">
172+
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
173173
<argument name="rowIndex" value="0"/>
174174
</actionGroup>
175175

0 commit comments

Comments
 (0)