Skip to content

Commit 166954e

Browse files
committed
MC-15934: [FT] [MFTF] AdminExportSimpleProductWithCustomAttributeTest fails because of bad design
1 parent 28757e4 commit 166954e

7 files changed

+93
-51
lines changed

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

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,55 @@
5353
<arguments>
5454
<argument name="rowIndex" type="string"/>
5555
</arguments>
56-
<reloadPage stepKey="refreshPage"/>
57-
<waitForPageLoad stepKey="waitFormReload"/>
56+
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
5857
<click stepKey="clickSelectBtn" selector="{{AdminExportAttributeSection.selectByIndex(rowIndex)}}"/>
5958
<click stepKey="clickOnDelete" selector="{{AdminExportAttributeSection.delete(rowIndex)}}" after="clickSelectBtn"/>
6059
<waitForElementVisible selector="{{AdminProductGridConfirmActionSection.title}}" stepKey="waitForConfirmModal"/>
6160
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmDelete"/>
62-
<waitForPageLoad stepKey="waitForExportDataDeleted" />
61+
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
62+
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
63+
</actionGroup>
64+
65+
<actionGroup name="deleteAllExportedFiles">
66+
<amOnPage url="{{AdminExportIndexPage.url}}" stepKey="goToExportIndexPage"/>
67+
68+
<!-- This is better one sive it use selectors substitutions. But for now we cant use it because of bug in MFTF.-->
69+
<!-- It makes double quotes escaping and brake code. I will provide fix for this in nearest future.-->
70+
<!-- <executeInSelenium-->
71+
<!-- function="-->
72+
<!-- function ($webdriver) use ($I) {-->
73+
<!-- $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath(&quot;{{AdminExportAttributeSection.selectByIndex('0')}}&quot;));-->
74+
<!-- while(!empty($buttons)) {-->
75+
<!-- $buttons[0]->click();-->
76+
<!-- $I->waitForElementVisible(&quot;{{AdminExportAttributeSection.delete('0')}}&quot;, 10);-->
77+
<!-- $deleteButton = $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath(&quot;{{AdminExportAttributeSection.delete('0')}}&quot;));-->
78+
<!-- $deleteButton->click();-->
79+
<!-- $I->waitForElementVisible(&quot;{{AdminProductGridConfirmActionSection.ok}}&quot;, 10);-->
80+
<!-- $I->click(&quot;{{AdminProductGridConfirmActionSection.ok}}&quot;);-->
81+
<!-- $I->waitForPageLoad(60);-->
82+
<!-- $buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath(&quot;{{AdminExportAttributeSection.selectByIndex('0')}}&quot;));-->
83+
<!-- }-->
84+
<!-- }"-->
85+
<!-- stepKey="deleteAllExportedFilesOneByOne"/>-->
86+
87+
<executeInSelenium
88+
function="
89+
function ($webdriver) use ($I) {
90+
$buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button'));
91+
while(!empty($buttons)) {
92+
$buttons[0]->click();
93+
$I->waitForElementVisible('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']', 10);
94+
$deleteButton = $webdriver->findElement(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//a[text()=\'Delete\']'));
95+
$deleteButton->click();
96+
$I->waitForElementVisible('.modal-popup.confirm button.action-accept', 10);
97+
$I->click('.modal-popup.confirm button.action-accept');
98+
$I->waitForPageLoad(60);
99+
$buttons = $webdriver->findElements(\Facebook\WebDriver\WebDriverBy::xpath('//tr[@data-repeat-index=\'0\']//button'));
100+
}
101+
}"
102+
stepKey="deleteAllExportedFilesOneByOne"/>
103+
104+
<waitForElementVisible selector="{{AdminDataGridTableSection.dataGridEmpty}}" stepKey="waitDataGridEmptyMessageAppears"/>
63105
<see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="assertDataGridEmptyMessage"/>
64106
</actionGroup>
65107
</actionGroups>

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,15 @@
8080
<requiredEntity createDataKey="secondSimpleProductForFixedWithAttribute"/>
8181
</createData>
8282

83-
<!-- Login as admin -->
84-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
85-
8683
<!-- Run cron twice -->
8784
<magentoCLI command="cron:run" stepKey="runCron1"/>
8885
<magentoCLI command="cron:run" stepKey="runCron2"/>
86+
87+
<!-- Login as admin -->
88+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
89+
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
8990
</before>
9091
<after>
91-
<!-- Delete exported file -->
92-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
93-
<argument name="rowIndex" value="0"/>
94-
</actionGroup>
95-
9692
<!-- Delete products creations -->
9793
<deleteData createDataKey="createDynamicBundleProduct" stepKey="deleteDynamicBundleProduct"/>
9894
<deleteData createDataKey="firstSimpleProductForDynamic" stepKey="deleteFirstSimpleProductForDynamic"/>
@@ -105,6 +101,10 @@
105101
<deleteData createDataKey="secondSimpleProductForFixedWithAttribute" stepKey="deleteSecondSimpleProductForFixedWithAttribute"/>
106102
<deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/>
107103

104+
<!-- Delete exported file -->
105+
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
106+
<argument name="rowIndex" value="0"/>
107+
</actionGroup>
108108
<!-- Log out -->
109109
<actionGroup ref="logout" stepKey="logout"/>
110110
</after>

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,15 @@
4848
<requiredEntity createDataKey="createSecondSimpleProduct"/>
4949
</updateData>
5050

51-
<!-- Login as admin -->
52-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
53-
5451
<!-- Run cron twice -->
5552
<magentoCLI command="cron:run" stepKey="runCron1"/>
5653
<magentoCLI command="cron:run" stepKey="runCron2"/>
54+
55+
<!-- Login as admin -->
56+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
57+
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
5758
</before>
5859
<after>
59-
<!-- Delete exported file -->
60-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
61-
<argument name="rowIndex" value="0"/>
62-
</actionGroup>
63-
6460
<!-- Deleted created products -->
6561
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
6662
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
@@ -69,6 +65,10 @@
6965
<!-- Delete category -->
7066
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
7167

68+
<!-- Delete exported file -->
69+
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
70+
<argument name="rowIndex" value="0"/>
71+
</actionGroup>
7272
<!-- Log out -->
7373
<actionGroup ref="logout" stepKey="logout"/>
7474
</after>

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,26 +73,26 @@
7373
<requiredEntity createDataKey="createConfigSecondChildProduct"/>
7474
</createData>
7575

76-
<!-- Login as admin -->
77-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
78-
7976
<!-- Run cron twice -->
8077
<magentoCLI command="cron:run" stepKey="runCron1"/>
8178
<magentoCLI command="cron:run" stepKey="runCron2"/>
79+
80+
<!-- Login as admin -->
81+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
82+
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
8283
</before>
8384
<after>
84-
<!-- Delete exported file -->
85-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
86-
<argument name="rowIndex" value="0"/>
87-
</actionGroup>
88-
8985
<!-- Delete configurable product creation -->
9086
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
9187
<deleteData createDataKey="createConfigFirstChildProduct" stepKey="deleteConfigFirstChildProduct"/>
9288
<deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteConfigSecondChildProduct"/>
9389
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
9490
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
9591

92+
<!-- Delete exported file -->
93+
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
94+
<argument name="rowIndex" value="0"/>
95+
</actionGroup>
9696
<!-- Log out -->
9797
<actionGroup ref="logout" stepKey="logout"/>
9898
</after>

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,26 +89,26 @@
8989
<requiredEntity createDataKey="createConfigProduct"/>
9090
</createData>
9191

92-
<!-- Login as admin -->
93-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
94-
9592
<!-- Run cron twice -->
9693
<magentoCLI command="cron:run" stepKey="runCron1"/>
9794
<magentoCLI command="cron:run" stepKey="runCron2"/>
95+
96+
<!-- Login as admin -->
97+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
98+
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
9899
</before>
99100
<after>
100-
<!-- Delete exported file -->
101-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
102-
<argument name="rowIndex" value="0"/>
103-
</actionGroup>
104-
105101
<!-- Delete configurable product creation -->
106102
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
107103
<deleteData createDataKey="createConfigFirstChildProduct" stepKey="deleteConfigFirstChildProduct"/>
108104
<deleteData createDataKey="createConfigSecondChildProduct" stepKey="deleteConfigSecondChildProduct"/>
109105
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
110106
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
111107

108+
<!-- Delete exported file -->
109+
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
110+
<argument name="rowIndex" value="0"/>
111+
</actionGroup>
112112
<!-- Log out -->
113113
<actionGroup ref="logout" stepKey="logout"/>
114114
</after>

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,15 @@
7171
<requiredEntity createDataKey="createConfigSecondChildProduct"/>
7272
</createData>
7373

74-
<!-- Login as admin -->
75-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
76-
7774
<!-- Run cron twice -->
7875
<magentoCLI command="cron:run" stepKey="runCron1"/>
7976
<magentoCLI command="cron:run" stepKey="runCron2"/>
77+
78+
<!-- Login as admin -->
79+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
80+
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
8081
</before>
8182
<after>
82-
<!-- Delete exported file -->
83-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
84-
<argument name="rowIndex" value="0"/>
85-
</actionGroup>
86-
8783
<!-- Delete simple product -->
8884
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
8985

@@ -94,6 +90,10 @@
9490
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
9591
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
9692

93+
<!-- Delete exported file -->
94+
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
95+
<argument name="rowIndex" value="0"/>
96+
</actionGroup>
9797
<!-- Log out -->
9898
<actionGroup ref="logout" stepKey="logout"/>
9999
</after>

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@
2828
<requiredEntity createDataKey="createAttributeSet"/>
2929
</createData>
3030

31-
<!-- Login as admin -->
32-
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
33-
3431
<!-- Run cron twice -->
3532
<magentoCLI command="cron:run" stepKey="runCron1"/>
3633
<magentoCLI command="cron:run" stepKey="runCron2"/>
34+
35+
<!-- Login as admin -->
36+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
37+
<actionGroup ref="deleteAllExportedFiles" stepKey="clearExportedFilesList"/>
3738
</before>
3839
<after>
39-
<!-- Delete exported file -->
40-
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
41-
<argument name="rowIndex" value="0"/>
42-
</actionGroup>
43-
4440
<!-- Delete product creations -->
4541
<deleteData createDataKey="createSimpleProductWithCustomAttributeSet" stepKey="deleteSimpleProductWithCustomAttributeSet"/>
4642
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>
4743
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
4844

45+
<!-- Delete exported file -->
46+
<actionGroup ref="deleteExportedFile" stepKey="deleteExportedFile">
47+
<argument name="rowIndex" value="0"/>
48+
</actionGroup>
4949
<!-- Log out -->
5050
<actionGroup ref="logout" stepKey="logout"/>
5151
</after>

0 commit comments

Comments
 (0)