Skip to content

MFTF: Extract Action Groups to separate files - magento/module-catalog-import-export #25846

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="DeleteAllExportedFilesActionGroup">
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
<executeInSelenium
function="
function ($webdriver) use ($I) {
$buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button'));
while(!empty($buttons)) {
$buttons[0]->click();
$I->waitForElementVisible('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']', 10);
$deleteButton = $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']'));
$deleteButton->click();
$I->waitForElementVisible('.modal-popup.confirm button.action-accept', 10);
$I->click('.modal-popup.confirm button.action-accept');
$I->waitForPageLoad(60);
$buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button'));
}
}"
stepKey="deleteAllExportedFilesOneByOne"/>
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="DeleteExportedFileActionGroup">
<annotations>
<description>Deletes the provided Grid Index on the Exports grid page.</description>
</annotations>
<arguments>
<argument name="rowIndex" type="string"/>
</arguments>

<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
<waitForPageLoad time="30" stepKey="waitFormReload"/>
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
<click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.delete(rowIndex)}}" after="clickSelectBtn"/>
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmDelete"/>
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="DownloadFileByRowIndexActionGroup">
<annotations>
<description>Downloads the provided Grid Index on the Exports grid page.</description>
</annotations>
<arguments>
<argument name="rowIndex" type="string"/>
</arguments>

<reloadPage stepKey="refreshPage"/>
<waitForPageLoad stepKey="waitFormReload"/>
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
<click stepKey="clickOnDownload" selector="{{AdminExportAttributeSection.download(rowIndex)}}" after="clickSelectBtn"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="ExportAllProductsActionGroup">
<annotations>
<description>Exports the unfiltered Products list. Validates that the Success Message is present.</description>
</annotations>

<selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/>
<waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible" time="5"/>
<scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/>
<wait stepKey="waitForScroll" time="5"/>
<click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/>
<wait stepKey="waitForClick" time="5"/>
<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"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<!-- Export products using filtering by attribute -->
<actionGroup name="ExportProductsFilterByAttributeActionGroup">
<annotations>
<description>Filters Products by the provided Attribute. Exports the filtered Products list. Validates that the Success Message is present.</description>
</annotations>
<arguments>
<argument name="attribute" type="string"/>
<argument name="attributeData" type="string"/>
</arguments>

<selectOption selector="{{AdminExportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/>
<waitForElementVisible selector="{{AdminExportMainSection.entityAttributes}}" stepKey="waitForElementVisible"/>
<scrollTo selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="scrollToAttribute"/>
<checkOption selector="{{AdminExportAttributeSection.chooseAttribute('attribute')}}" stepKey="selectAttribute"/>
<fillField selector="{{AdminExportAttributeSection.fillFilter('attribute')}}" userInput="{{attributeData}}" stepKey="setDataInField"/>
<waitForPageLoad stepKey="waitForUserInput"/>
<scrollTo selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="scrollToContinue"/>
<click selector="{{AdminExportAttributeSection.continueBtn}}" stepKey="clickContinueButton"/>
<see selector="{{AdminMessagesSection.success}}" userInput="Message is added to queue, wait to get your file soon" stepKey="seeSuccessMessage"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
<actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/>
</before>
<after>
<!-- Delete products creations -->
Expand All @@ -102,7 +102,7 @@
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>

<!-- Delete exported file -->
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
<argument name="rowIndex" value="0"/>
</actionGroup>
<!-- Log out -->
Expand All @@ -113,14 +113,14 @@
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>

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

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

<!-- Download product -->
<actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts">
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
<argument name="rowIndex" value="0"/>
</actionGroup>
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
<actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/>
</before>
<after>
<!-- Deleted created products -->
Expand All @@ -66,7 +66,7 @@
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>

<!-- Delete exported file -->
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
<actionGroup ref="DeleteExportedFileActionGroup" stepKey="deleteExportedFile">
<argument name="rowIndex" value="0"/>
</actionGroup>
<!-- Log out -->
Expand All @@ -78,14 +78,14 @@
<waitForPageLoad stepKey="waitForExportIndexPageLoad"/>

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

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

<!-- Download product -->
<actionGroup ref="downloadFileByRowIndex" stepKey="downloadCreatedProducts">
<actionGroup ref="DownloadFileByRowIndexActionGroup" stepKey="downloadCreatedProducts">
<argument name="rowIndex" value="0"/>
</actionGroup>
</test>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@

<!-- Login as admin -->
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
<actionGroup ref="DeleteAllExportedFilesActionGroup" stepKey="clearExportedFilesList"/>
</before>
<after>
<!-- Remove downloadable domains -->
Expand Down Expand Up @@ -159,7 +159,7 @@
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>

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

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

Expand Down
Loading