Skip to content

Commit b75c282

Browse files
committed
MC-35892: Automate MC-35954 tests
1 parent c6f5b12 commit b75c282

File tree

8 files changed

+199
-4
lines changed

8 files changed

+199
-4
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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="AdminProductAttributeSaveActionGroup">
12+
<annotations>
13+
<description>Clicks on Save button to save the attribute and check success message.</description>
14+
</annotations>
15+
16+
<scrollToTopOfPage stepKey="scrollToTopOfThePage"/>
17+
<waitForElementVisible selector="{{AdminMainActionsSection.save}}" stepKey="waitForSaveButton"/>
18+
<click selector="{{AdminMainActionsSection.save}}" stepKey="clickSaveButton"/>
19+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessage"/>
20+
<see selector="{{AdminMessagesSection.success}}" userInput="You saved the product attribute." stepKey="seeSuccessMessage"/>
21+
</actionGroup>
22+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSaveProductAttributeActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="AdminSaveProductAttributeActionGroup">
1212
<annotations>
13-
<description>Clicks on Save button to save the attribute.</description>
13+
<description>DEPRECATED. Use AdminProductAttributeSaveActionGroup instead. Clicks on Save button to save the attribute.</description>
1414
</annotations>
1515

1616
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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="AdminSetProductAttributeUseInLayeredNavigationOptionActionGroup">
12+
<arguments>
13+
<argument name="useInLayeredNavigationValue" type="string" defaultValue="Filterable (with results)"/>
14+
</arguments>
15+
<conditionalClick selector="{{StorefrontPropertiesSection.StoreFrontPropertiesTab}}" dependentSelector="{{AttributePropertiesSection.useInLayeredNavigation}}" visible="false" stepKey="clickStoreFrontTab"/>
16+
<waitForElementVisible selector="{{AttributePropertiesSection.useInLayeredNavigation}}" stepKey="waitForStorefrontTabLoad"/>
17+
<selectOption selector="{{AttributePropertiesSection.useInLayeredNavigation}}" userInput="{{useInLayeredNavigationValue}}" stepKey="selectUseInLayeredNavigationOption"/>
18+
</actionGroup>
19+
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="SaveProductAttributeActionGroup">
1212
<annotations>
13-
<description>Clicks on Save. Validates that the Success Message is present.</description>
13+
<description>DEPRECATED. Use AdminProductAttributeSaveActionGroup instead. Clicks on Save. Validates that the Success Message is present.</description>
1414
</annotations>
1515

1616
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveProductAttributeInUseActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="SaveProductAttributeInUseActionGroup">
1212
<annotations>
13-
<description>Clicks on Save. Validates that the Success Message is present.</description>
13+
<description>DEPRECATED. Use AdminProductAttributeSaveActionGroup instead. Clicks on Save. Validates that the Success Message is present.</description>
1414
</annotations>
1515

1616
<waitForElementVisible selector="{{AttributePropertiesSection.Save}}" stepKey="waitForSaveButton"/>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@
1717
<element name="removeFilter" type="button" selector="div.filter-current .remove"/>
1818
<element name="activeFilterOptions" type="text" selector=".filter-options-item.active .items"/>
1919
<element name="activeFilterOptionItemByPosition" type="text" selector=".filter-options-item.active .items li:nth-child({{itemPosition}}) a" parameterized="true"/>
20+
<element name="enabledFilterOptionItemByLabel" type="text" selector="//main//div[@class='filter-options']//li[@class='item']//a[contains(text(), '{{optionLabel}}')]" parameterized="true"/>
21+
<element name="disabledFilterOptionItemByLabel" type="text" selector="//main//div[@class='filter-options']//li[@class='item' and contains(text(), '{{optionLabel}}')]" parameterized="true"/>
2022
</section>
2123
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
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="StorefrontFilterableProductAttributeInLayeredNavigationWithoutReindexTest">
12+
<annotations>
13+
<features value="LayeredNavigation"/>
14+
<stories value="Magento_LayeredNavigation"/>
15+
<title value="Create and add new dropdown product attribute to existing set, assign it to existing product with that set and see it on layered navigation"/>
16+
<description value="Verify that new dropdown attribute in existing attribute set shows on layered navigation on storefront without reindex"/>
17+
<severity value="AVERAGE"/>
18+
<testCaseId value="MC-35954"/>
19+
<group value="layeredNavigation"/>
20+
</annotations>
21+
22+
<before>
23+
<!--Create category, attribute set with multiselect product attribute with two options-->
24+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
25+
<createData entity="CatalogAttributeSet" stepKey="createAttributeSet"/>
26+
<createData entity="multipleSelectProductAttribute" stepKey="createMultiselectAttribute"/>
27+
<createData entity="ProductAttributeOption10" stepKey="firstMultiselectOption">
28+
<requiredEntity createDataKey="createMultiselectAttribute"/>
29+
</createData>
30+
<createData entity="ProductAttributeOption11" stepKey="secondMultiselectOption">
31+
<requiredEntity createDataKey="createMultiselectAttribute"/>
32+
</createData>
33+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getFirstMultiselectOption">
34+
<requiredEntity createDataKey="createMultiselectAttribute"/>
35+
</getData>
36+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getSecondMultiselectOption">
37+
<requiredEntity createDataKey="createMultiselectAttribute"/>
38+
</getData>
39+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
40+
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$createAttributeSet.attribute_set_id$/" stepKey="onAttributeSetEdit"/>
41+
<waitForPageLoad stepKey="waitForAttributeSetPageLoad"/>
42+
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignMultiselectAttributeToGroup">
43+
<argument name="group" value="Product Details"/>
44+
<argument name="attribute" value="$createMultiselectAttribute.attribute_code$"/>
45+
</actionGroup>
46+
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSet"/>
47+
<!--Create configurable product with created attribute set and multiselect attribute-->
48+
<createData entity="SimpleOne" storeCode="all" stepKey="createFirstSimpleProduct">
49+
<field key="attribute_set_id">$createAttributeSet.attribute_set_id$</field>
50+
<requiredEntity createDataKey="createMultiselectAttribute"/>
51+
<requiredEntity createDataKey="getFirstMultiselectOption"/>
52+
</createData>
53+
<createData entity="SimpleOne" storeCode="all" stepKey="createSecondSimpleProduct">
54+
<field key="attribute_set_id">$createAttributeSet.attribute_set_id$</field>
55+
<requiredEntity createDataKey="createMultiselectAttribute"/>
56+
<requiredEntity createDataKey="getSecondMultiselectOption"/>
57+
</createData>
58+
<createData entity="BaseConfigurableProduct" stepKey="createConfigurableProduct">
59+
<field key="attribute_set_id">$createAttributeSet.attribute_set_id$</field>
60+
<requiredEntity createDataKey="createCategory"/>
61+
</createData>
62+
<createData entity="ConfigurableProductOneOption" stepKey="createConfigProductOption">
63+
<requiredEntity createDataKey="createConfigurableProduct"/>
64+
<requiredEntity createDataKey="createMultiselectAttribute"/>
65+
<requiredEntity createDataKey="getFirstMultiselectOption"/>
66+
</createData>
67+
<createData entity="ConfigurableProductOneOption" stepKey="createConfigProductOption2">
68+
<requiredEntity createDataKey="createConfigurableProduct"/>
69+
<requiredEntity createDataKey="createMultiselectAttribute"/>
70+
<requiredEntity createDataKey="getSecondMultiselectOption"/>
71+
</createData>
72+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild">
73+
<requiredEntity createDataKey="createConfigurableProduct"/>
74+
<requiredEntity createDataKey="createFirstSimpleProduct"/>
75+
</createData>
76+
<createData entity="ConfigurableProductAddChild" stepKey="createConfigProductAddChild2">
77+
<requiredEntity createDataKey="createConfigurableProduct"/>
78+
<requiredEntity createDataKey="createSecondSimpleProduct"/>
79+
</createData>
80+
<!--Create new dropdown attribute with two options and set Use in layered navigation "Filterable (no results)"-->
81+
<createData entity="dropdownProductAttribute" stepKey="createDropdownAttribute"/>
82+
<createData entity="ProductAttributeOption10" stepKey="firstDropdownOption">
83+
<requiredEntity createDataKey="createDropdownAttribute"/>
84+
</createData>
85+
<createData entity="ProductAttributeOption11" stepKey="secondDropdownOption">
86+
<requiredEntity createDataKey="createDropdownAttribute"/>
87+
</createData>
88+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getFirstDropdownOption">
89+
<requiredEntity createDataKey="createDropdownAttribute"/>
90+
</getData>
91+
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getSecondDropdownOption">
92+
<requiredEntity createDataKey="createDropdownAttribute"/>
93+
</getData>
94+
<actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="goToDropdownAttributePage">
95+
<argument name="productAttributeCode" value="$createDropdownAttribute.attribute_code$"/>
96+
</actionGroup>
97+
<actionGroup ref="AdminSetProductAttributeUseInLayeredNavigationOptionActionGroup" stepKey="setDropdownUseInLayeredNavigationNoResults">
98+
<argument name="useInLayeredNavigationValue" value="Filterable (no results)"/>
99+
</actionGroup>
100+
<actionGroup ref="AdminProductAttributeSaveActionGroup" stepKey="saveDropdownAttribute"/>
101+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
102+
</before>
103+
104+
<after>
105+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
106+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
107+
<deleteData createDataKey="createConfigurableProduct" stepKey="deleteConfigurableProduct"/>
108+
<deleteData createDataKey="createMultiselectAttribute" stepKey="deleteMultiselectAttribute"/>
109+
<deleteData createDataKey="createDropdownAttribute" stepKey="deleteDropdownAttribute"/>
110+
<deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/>
111+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
112+
<magentoCron groups="index" stepKey="reindexInvalidatedIndices"/>
113+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
114+
</after>
115+
116+
<!--Set attribute option Use in layered navigation to "Filterable(no results)"-->
117+
<actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="goToMultiselectAttributePage">
118+
<argument name="productAttributeCode" value="$createMultiselectAttribute.attribute_code$"/>
119+
</actionGroup>
120+
<actionGroup ref="AdminSetProductAttributeUseInLayeredNavigationOptionActionGroup" stepKey="setMultiselectUseInLayeredNavigationNoResults">
121+
<argument name="useInLayeredNavigationValue" value="Filterable (no results)"/>
122+
</actionGroup>
123+
<actionGroup ref="AdminProductAttributeSaveActionGroup" stepKey="saveMultiselectAttribute"/>
124+
<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="onCategoryPage"/>
125+
<waitForPageLoad stepKey="waitForCategoryPageLoad"/>
126+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionsTitle($createMultiselectAttribute.default_frontend_label$)}}" stepKey="waitForMultiselectAttributeVisible"/>
127+
<conditionalClick selector="{{StorefrontCategorySidebarSection.filterOptionsTitle($createMultiselectAttribute.default_frontend_label$)}}" dependentSelector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" visible="false" stepKey="clickToExpandAttribute"/>
128+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" stepKey="waitForMultiselectAttributeOptionsVisible"/>
129+
<seeElement selector="{{StorefrontCategorySidebarSection.enabledFilterOptionItemByLabel($getFirstMultiselectOption.label$)}}" stepKey="assertMultiselectAttributeFirstOptionInLayeredNavigation"/>
130+
<seeElement selector="{{StorefrontCategorySidebarSection.enabledFilterOptionItemByLabel($getSecondMultiselectOption.label$)}}" stepKey="assertMultiselectAttributeSecondOptionInLayeredNavigation"/>
131+
<amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$createAttributeSet.attribute_set_id$/" stepKey="onAttributeSetEditPage"/>
132+
<waitForPageLoad stepKey="waitForAttributeSetEditPageLoad"/>
133+
<actionGroup ref="AssignAttributeToGroupActionGroup" stepKey="assignDropdownAttributeToGroup">
134+
<argument name="group" value="Product Details"/>
135+
<argument name="attribute" value="$createDropdownAttribute.attribute_code$"/>
136+
</actionGroup>
137+
<actionGroup ref="SaveAttributeSetActionGroup" stepKey="saveAttributeSetWithDropdownAttribute"/>
138+
<!--Assign dropdown attribute to child product of configurable-->
139+
<amOnPage url="{{AdminProductEditPage.url($createFirstSimpleProduct.id$)}}" stepKey="visitAdminEditProductPage"/>
140+
<waitForElementVisible selector="{{AdminProductFormSection.customSelectField('$createDropdownAttribute.attribute_code$')}}" stepKey="waitForDropdownAttributeSelectVisible"/>
141+
<selectOption selector="{{AdminProductFormSection.customSelectField('$createDropdownAttribute.attribute_code$')}}" userInput="$getFirstDropdownOption.label$" stepKey="selectValueOfNewAttribute"/>
142+
<actionGroup ref="SaveProductFormActionGroup" stepKey="saveSimpleProduct"/>
143+
<!--Assert that dropdown attribute is present on layered navigation with both options-->
144+
<amOnPage url="{{StorefrontCategoryPage.url($createCategory.custom_attributes[url_key]$)}}" stepKey="goToCategoryPage"/>
145+
<waitForPageLoad stepKey="waitForCategoryPageLoadWithDropdownAttribute"/>
146+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionsTitle($createDropdownAttribute.default_frontend_label$)}}" stepKey="waitForDropdownAttributeVisible"/>
147+
<conditionalClick selector="{{StorefrontCategorySidebarSection.filterOptionsTitle($createDropdownAttribute.default_frontend_label$)}}" dependentSelector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" visible="false" stepKey="clickToExpandDropdownAttribute"/>
148+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.activeFilterOptions}}" stepKey="waitForDropdownAttributeOptionsVisible"/>
149+
<seeElement selector="{{StorefrontCategorySidebarSection.enabledFilterOptionItemByLabel($getFirstDropdownOption.label$)}}" stepKey="assertDropdownAttributeFirstOptionInLayeredNavigation"/>
150+
<seeElement selector="{{StorefrontCategorySidebarSection.disabledFilterOptionItemByLabel($getSecondDropdownOption.label$)}}" stepKey="assertDropdownAttributeSecondOptionInLayeredNavigation"/>
151+
</test>
152+
</tests>

dev/tests/js/jasmine/tests/lib/mage/apply.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ define([
6464
.toHaveBeenCalledWith(jasmine.any(Object), node);
6565

6666
done();
67-
}, preset.timeout);
67+
}, 100);
6868
});
6969
});
7070
});

0 commit comments

Comments
 (0)