Skip to content

Commit 7145da8

Browse files
author
Davit_Zakharyan
committed
MC-5906: The order of product SKU is not respected
- Added automated test script
1 parent 5674592 commit 7145da8

File tree

7 files changed

+177
-0
lines changed

7 files changed

+177
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
11+
<actionGroup name="CompareTwoProductsOrder">
12+
<arguments>
13+
<argument name="product_1"/>
14+
<argument name="product_2"/>
15+
</arguments>
16+
<amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/>
17+
<waitForPageLoad stepKey="waitForPageLoad5"/>
18+
<grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByNumber('1')}}" userInput="alt" stepKey="grabFirstProductName1_1"/>
19+
<assertEquals expected="{{product_1.name}}" actual="($grabFirstProductName1_1)" message="notExpectedOrder" stepKey="compare1"/>
20+
<grabAttributeFrom selector="{{StorefrontCategoryProductSection.ProductImageByNumber('2')}}" userInput="alt" stepKey="grabFirstProductName2_2"/>
21+
<assertEquals expected="{{product_2.name}}" actual="($grabFirstProductName2_2)" message="notExpectedOrder" stepKey="compare2"/>
22+
</actionGroup>
23+
</actionGroups>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<element name="ProductInfoByNumber" type="text" selector="//main//li[{{var1}}]//div[@class='product-item-info']" parameterized="true"/>
1717
<element name="ProductAddToCompareByNumber" type="text" selector="//main//li[{{var1}}]//a[contains(@class, 'tocompare')]" parameterized="true"/>
1818
<element name="listedProduct" type="block" selector="ol li:nth-child({{productPositionInList}}) img" parameterized="true"/>
19+
<element name="ProductImageByNumber" type="button" selector="//main//li[{{var1}}]//img" parameterized="true"/>
1920
<element name="categoryListView" type="button" selector="a[title='List']" timeout="30"/>
2021

2122
<element name="ProductTitleByName" type="button" selector="//main//li//a[contains(text(), '{{var1}}')]" parameterized="true"/>
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="CheckOrderOfProdsInWidgetOnCMSPageTest">
12+
<annotations>
13+
<features value="Catalog"/>
14+
<title value="Checking order of products in a widget on a CMS page - SKU condition"/>
15+
<description value="Checking order of products in a widget on a CMS page - SKU condition"/>
16+
<severity value="CRITICAL"/>
17+
<testCaseId value="MC-13718"/>
18+
<useCaseId value="MC-5906"/>
19+
<group value="Catalog"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
23+
<actionGroup ref="EnabledWYSIWYGEditor" stepKey="enableWYSIWYG"/>
24+
<actionGroup ref="SwitchToVersion4ActionGroup" stepKey="enableTinyMCE4"/>
25+
<waitForPageLoad stepKey="waitConfigToSave"/>
26+
<createData entity="ApiCategory" stepKey="createFirstCategory"/>
27+
<createData entity="ApiSimpleProduct" stepKey="product1">
28+
<requiredEntity createDataKey="createFirstCategory"/>
29+
</createData>
30+
<createData entity="ApiSimpleProduct" stepKey="product2">
31+
<requiredEntity createDataKey="createFirstCategory"/>
32+
</createData>
33+
<amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/>
34+
<waitForPageLoad stepKey="waitEditHomePagePageToLoad"/>
35+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" />
36+
<waitForElementNotVisible selector="{{CmsWYSIWYGSection.CheckIfTabExpand}}" stepKey="waitForTabExpand"/>
37+
<click selector="{{CmsNewPagePageActionsSection.showHideEditor}}" stepKey="showHiddenButtons"/>
38+
<seeElement selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="seeWidgetButton" />
39+
<click selector="{{TinyMCESection.InsertWidgetBtn}}" stepKey="clickInsertWidgetButton" />
40+
<waitForPageLoad stepKey="waitForPageLoad1" />
41+
<see userInput="Inserting a widget does not create a widget instance." stepKey="seeMessage" />
42+
<see selector="{{WidgetSection.InsertWidgetBtnDisabled}}" userInput="Insert Widget" stepKey="seeInsertWidgetDisabled" />
43+
<see selector="{{WidgetSection.CancelBtnEnabled}}" userInput="Cancel" stepKey="seeCancelBtnEnabled" />
44+
<selectOption selector="{{WidgetSection.WidgetType}}" userInput="Catalog Products List" stepKey="selectCatalogProductsList" />
45+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear" />
46+
<click selector="{{WidgetSection.AddParam}}" stepKey="clickAddParamBtn" />
47+
<waitForElementVisible selector="{{WidgetSection.ConditionsDropdown}}" stepKey="waitForDropdownVisible"/>
48+
<selectOption selector="{{WidgetSection.ConditionsDropdown}}" userInput="SKU" stepKey="selectCategoryCondition" />
49+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear2" />
50+
<click selector="{{WidgetSection.RuleParam1('3')}}" stepKey="clickOnRuleParam1"/>
51+
<waitForElementVisible selector="{{AdminTargetRuleProductsToMatchSection.newConditionOperator}}" stepKey="waitDropdownToAppear"/>
52+
<selectOption selector="{{AdminTargetRuleProductsToMatchSection.newConditionOperator}}" userInput="is one of" stepKey="selectOption"/>
53+
<click selector="{{WidgetSection.RuleParam}}" stepKey="clickOnRuleParam"/>
54+
<waitForElementVisible selector="{{WidgetSection.Chooser}}" stepKey="waitForElement" />
55+
<click selector="{{WidgetSection.Chooser}}" stepKey="clickChooser" />
56+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear3" />
57+
<click selector="{{WidgetSection.PreCreateProduct('$$product1.name$$')}}" stepKey="selectproduct1" />
58+
<click selector="{{WidgetSection.PreCreateProduct('$$product2.name$$')}}" stepKey="selectproduct2" />
59+
<click selector="{{AdminNewWidgetSection.applyParameter}}" stepKey="applyProducts"/>
60+
<click selector="{{WidgetSection.InsertWidget}}" stepKey="clickOnInsertWidgetButton"/>
61+
<waitForLoadingMaskToDisappear stepKey="waitSaveButtonToBeClickable"/>
62+
<click selector="{{InsertWidgetSection.save}}" stepKey="saveWidget"/>
63+
<waitForPageLoad stepKey="waitForSaveComplete"/>
64+
</before>
65+
<after>
66+
<actionGroup ref="ClearWidgetsFromCMSContent" stepKey="removeWidgets"/>
67+
<deleteData createDataKey="createFirstCategory" stepKey="deleteCategory"/>
68+
<deleteData createDataKey="product1" stepKey="deleteproduct1"/>
69+
<deleteData createDataKey="product2" stepKey="deleteproduct2"/>
70+
<actionGroup ref="logout" stepKey="logoutOfAdmin"/>
71+
</after>
72+
<actionGroup ref="CompareTwoProductsOrder" stepKey="compareProductOrders1">
73+
<argument name="product_1" value="$$product1$$"/>
74+
<argument name="product_2" value="$$product2$$"/>
75+
</actionGroup>
76+
77+
<amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/>
78+
<waitForPageLoad stepKey="waitEditHomePagePageToLoad"/>
79+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" />
80+
<waitForElementNotVisible selector="{{CmsWYSIWYGSection.CheckIfTabExpand}}" stepKey="waitForTabExpand"/>
81+
<executeJS function="jQuery('[id=\'cms_page_form_content_ifr\']').attr('name', 'preview-iframe')" stepKey="setPreviewFrameName"/>
82+
<switchToIFrame selector="preview-iframe" stepKey="switchToIframe"/>
83+
<doubleClick selector="{{TinyMCESection.WidgetButton}}" stepKey="clickToEditWidget"/>
84+
<switchToIFrame stepKey="switchOutFromIframe"/>
85+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask"/>
86+
<wait time="2" stepKey="waitOptionsToLoadProperly"/>
87+
<click selector="{{WidgetSection.RuleParam1('4')}}" stepKey="openProductsList"/>
88+
<waitForElementVisible selector="{{WidgetSection.Chooser}}" stepKey="waitForElement2"/>
89+
<click selector="{{WidgetSection.Chooser}}" stepKey="clickChooser2" />
90+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear4" />
91+
<click selector="{{WidgetSection.PreCreateProduct('$$product1.name$$')}}" stepKey="selectproduct1_1" />
92+
<click selector="{{WidgetSection.PreCreateProduct('$$product1.name$$')}}" stepKey="selectproduct2_2" />
93+
<click selector="{{AdminNewWidgetSection.applyParameter}}" stepKey="applyProducts1"/>
94+
<click selector="{{WidgetSection.InsertWidget}}" stepKey="clickOnInsertWidgetButton1"/>
95+
<waitForLoadingMaskToDisappear stepKey="waitSaveButtonToBeClickable1"/>
96+
<click selector="{{InsertWidgetSection.save}}" stepKey="saveWidget1"/>
97+
<waitForPageLoad stepKey="waitForSaveComplete1"/>
98+
99+
<actionGroup ref="CompareTwoProductsOrder" stepKey="compareProductOrders2">
100+
<argument name="product_1" value="$$product2$$"/>
101+
<argument name="product_2" value="$$product1$$"/>
102+
</actionGroup>
103+
</test>
104+
</tests>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="ClearWidgetsFromCMSContent">
11+
<amOnPage url="{{CmsPageEditPage.url('2')}}" stepKey="navigateToEditHomePagePage"/>
12+
<waitForPageLoad stepKey="waitEditHomePagePageToLoad"/>
13+
<click selector="{{CmsNewPagePageContentSection.header}}" stepKey="clickContentTab" />
14+
<waitForElementNotVisible selector="{{CmsWYSIWYGSection.CheckIfTabExpand}}" stepKey="waitForTabExpand"/>
15+
<executeJS function="tinyMCE.activeEditor.setContent('Hello TinyMCE4!');" stepKey="executeJSFillContent1"/>
16+
<click selector="{{InsertWidgetSection.save}}" stepKey="saveWidget"/>
17+
<waitForPageLoad stepKey="waitSaveToBeApplied"/>
18+
<see selector="{{AdminProductMessagesSection.successMessage}}" userInput="You saved the page." stepKey="seeSaveSuccess"/>
19+
</actionGroup>
20+
</actionGroups>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
10+
<page name="CmsPageEditPage" area="admin" url="admin/cms_page/edit/page_id/{{var}}" parameterized="true">
11+
<section name="CmsNewPagePageActionsSection"/>
12+
<section name="CmsNewPagePageBasicFieldsSection"/>
13+
<section name="CmsNewPagePageContentSection"/>
14+
<section name="CmsNewPagePageSeoSection"/>
15+
</page>
16+
</pages>

app/code/Magento/Cms/Test/Mftf/Section/TinyMCESection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
<element name="InsertImage" type="button" selector=".mce-i-image" />
3232
<element name="InsertTable" type="button" selector=".mce-i-table" />
3333
<element name="SpecialCharacter" type="button" selector=".mce-i-charmap" />
34+
<element name="WidgetButton" type="button" selector="span[class*='magento-widget mceNonEditable']"/>
3435
</section>
3536
<section name="MediaGallerySection">
3637
<element name="Browse" type="button" selector=".mce-i-browse"/>
@@ -99,6 +100,7 @@
99100
<element name="AddParam" type="button" selector=".rule-param-add"/>
100101
<element name="ConditionsDropdown" type="select" selector="#conditions__1__new_child"/>
101102
<element name="RuleParam" type="button" selector="//a[text()='...']"/>
103+
<element name="RuleParam1" type="button" selector="(//span[@class='rule-param']//a)[{{var}}]" parameterized="true"/>
102104
<element name="RuleParamSelect" type="select" selector="//ul[contains(@class,'rule-param-children')]/li[{{arg1}}]//*[contains(@class,'rule-param')][{{arg2}}]//select" parameterized="true"/>
103105
<element name="RuleParamInput" type="input" selector="//ul[contains(@class,'rule-param-children')]/li[{{arg1}}]//*[contains(@class,'rule-param')][{{arg2}}]//input" parameterized="true"/>
104106
<element name="RuleParamLabel" type="input" selector="//ul[contains(@class,'rule-param-children')]/li[{{arg1}}]//*[contains(@class,'rule-param')][{{arg2}}]//a" parameterized="true"/>

app/code/Magento/Config/Test/Mftf/ActionGroup/ConfigWYSIWYGActionGroup.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,15 @@
3838
<click selector="{{ContentManagementSection.Save}}" stepKey="saveConfig" />
3939
<waitForPageLoad stepKey="waitForPageLoad2" />
4040
</actionGroup>
41+
<actionGroup name="EnabledWYSIWYGEditor">
42+
<amOnPage url="{{AdminContentManagementPage.url}}" stepKey="navigateToConfigurationPage"/>
43+
<waitForPageLoad stepKey="waitForPageLoad"/>
44+
<conditionalClick selector="{{ContentManagementSection.WYSIWYGOptions}}" dependentSelector="{{ContentManagementSection.EnableWYSIWYG}}" visible="false" stepKey="expandWYSIWYGOptionsTab"/>
45+
<waitForElementVisible selector="{{ContentManagementSection.EnableWYSIWYG}}" stepKey="waitTabToExpand"/>
46+
<uncheckOption selector="{{ContentManagementSection.EnableSystemValue}}" stepKey="enableEnableSystemValue"/>
47+
<selectOption selector="{{ContentManagementSection.EnableWYSIWYG}}" userInput="Enabled by Default" stepKey="enableWYSIWYG"/>
48+
<click selector="{{ContentManagementSection.WYSIWYGOptions}}" stepKey="collapseWYSIWYGOptionsTab"/>
49+
<click selector="{{ContentManagementSection.Save}}" stepKey="clickSaveConfig" />
50+
<see stepKey="seeSuccess" selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the configuration."/>
51+
</actionGroup>
4152
</actionGroups>

0 commit comments

Comments
 (0)