Skip to content

Commit 0d69b03

Browse files
committed
MC-228: Customer should be able to sort bundle products by price when viewing products list
1 parent 566e9ea commit 0d69b03

File tree

3 files changed

+37
-20
lines changed

3 files changed

+37
-20
lines changed

app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@
8080
<createData entity="ApiBundleProductPriceViewRange" stepKey="createThirdBundleProduct">
8181
<requiredEntity createDataKey="createCategory"/>
8282
</createData>
83-
<createData entity="DropDownBundleOption" stepKey="thirdProductBundleOption">
83+
<createData entity="DropDownBundleOption" stepKey="createThirdProductBundleOption">
8484
<requiredEntity createDataKey="createThirdBundleProduct"/>
8585
</createData>
8686
<createData entity="ApiBundleLink" stepKey="createBundleFirstLink">
8787
<requiredEntity createDataKey="createThirdBundleProduct"/>
88-
<requiredEntity createDataKey="thirdProductBundleOption"/>
88+
<requiredEntity createDataKey="createThirdProductBundleOption"/>
8989
<requiredEntity createDataKey="createFirstProductForBundle"/>
9090
</createData>
9191
<createData entity="ApiBundleLink" stepKey="createBundleSecondLink">
9292
<requiredEntity createDataKey="createThirdBundleProduct"/>
93-
<requiredEntity createDataKey="thirdProductBundleOption"/>
93+
<requiredEntity createDataKey="createThirdProductBundleOption"/>
9494
<requiredEntity createDataKey="createSecondProductForBundle"/>
9595
</createData>
9696

@@ -116,8 +116,10 @@
116116
<argument name="categoryName" value="$$createCategory.name$$"/>
117117
</actionGroup>
118118

119-
<!-- Asset first bundle products in category product grid -->
120-
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createFirstBundleProduct.name$$)}}" stepKey="assertFirstBundleProduct"/>
119+
<!-- Assert first bundle products in category product grid -->
120+
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertFirstBundleProduct">
121+
<argument name="product" value="$$createFirstBundleProduct$$"/>
122+
</actionGroup>
121123
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForFirstBundleProduct">
122124
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createFirstBundleProduct.id$$)}}"/>
123125
<argument name="userInput" value="From $100.00"/>
@@ -127,8 +129,10 @@
127129
<argument name="userInput" value="To $123.00"/>
128130
</actionGroup>
129131

130-
<!-- Asset second bundle products in category product grid -->
131-
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSecondBundleProduct.name$$)}}" stepKey="assertSecondBundleProduct"/>
132+
<!-- Assert second bundle products in category product grid -->
133+
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertSecondBundleProduct">
134+
<argument name="product" value="$$createSecondBundleProduct$$"/>
135+
</actionGroup>
132136
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForSecondBundleProduct">
133137
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createSecondBundleProduct.id$$)}}"/>
134138
<argument name="userInput" value="From $10.00"/>
@@ -138,8 +142,10 @@
138142
<argument name="userInput" value="To $123.00"/>
139143
</actionGroup>
140144

141-
<!-- Asset third bundle products in category product grid -->
142-
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createThirdBundleProduct.name$$)}}" stepKey="assertThirdBundleProduct"/>
145+
<!-- Assert third bundle products in category product grid -->
146+
<actionGroup ref="AssertProductOnCategoryPageActionGroup" stepKey="assertThirdBundleProduct">
147+
<argument name="product" value="$$createThirdBundleProduct$$"/>
148+
</actionGroup>
143149
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForThirdBundleProduct">
144150
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createThirdBundleProduct.id$$)}}"/>
145151
<argument name="userInput" value="From $123.00"/>
@@ -155,9 +161,7 @@
155161
<!-- Sort products By Price -->
156162
<actionGroup ref="StorefrontCategoryPageSortProductActionGroup" stepKey="sortProductByPrice"/>
157163
<!-- Set Ascending Direction -->
158-
<actionGroup ref="StorefrontCategoryPageSortDirectionActionGroup" stepKey="setAscendingDirection">
159-
<argument name="directionSelector" value="{{StorefrontCategoryTopToolbarSection.sortDirectionAsc}}"/>
160-
</actionGroup>
164+
<actionGroup ref="StorefrontCategoryPageSortAscendingActionGroup" stepKey="setAscendingDirection"/>
161165

162166
<!-- Assert new products positions -->
163167
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductFirstPosition">
@@ -174,9 +178,7 @@
174178
</actionGroup>
175179

176180
<!-- Set Descending Direction -->
177-
<actionGroup ref="StorefrontCategoryPageSortDirectionActionGroup" stepKey="setDescendingDirection">
178-
<argument name="directionSelector" value="{{StorefrontCategoryTopToolbarSection.sortDirectionDesc}}"/>
179-
</actionGroup>
181+
<actionGroup ref="StorefrontCategoryPageSortDescendingActionGroup" stepKey="setDescendingDirection"/>
180182

181183
<!-- Assert new products positions -->
182184
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewFirstPosition">

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@
7878
<seeElement selector="{{StorefrontCategoryProductSection.ProductAddToCartByName(product.name)}}" stepKey="AssertAddToCart"/>
7979
</actionGroup>
8080

81+
<actionGroup name="AssertProductOnCategoryPageActionGroup" extends="StorefrontCheckCategorySimpleProduct">
82+
<remove keyForRemoval="AssertProductPrice"/>
83+
<remove keyForRemoval="moveMouseOverProduct"/>
84+
<remove keyForRemoval="AssertAddToCart"/>
85+
</actionGroup>
86+
8187
<actionGroup name="StorefrontCheckAddToCartButtonAbsence">
8288
<arguments>
8389
<argument name="product" defaultValue="_defaultProduct"/>

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,24 @@
99
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
1111
<actionGroup name="StorefrontCategoryPageSortProductActionGroup">
12+
<annotations>
13+
<description>Select "Sort by" parameter for sorting Products on Category page</description>
14+
</annotations>
1215
<arguments>
1316
<argument name="sortBy" type="string" defaultValue="Price"/>
1417
</arguments>
1518
<selectOption selector="{{StorefrontCategoryTopToolbarSection.sortByDropdown}}" userInput="{{sortBy}}" stepKey="selectSortByParameter"/>
1619
</actionGroup>
17-
<actionGroup name="StorefrontCategoryPageSortDirectionActionGroup">
18-
<arguments>
19-
<argument name="directionSelector" type="string"/>
20-
</arguments>
21-
<click selector="{{directionSelector}}" stepKey="setDirection"/>
20+
<actionGroup name="StorefrontCategoryPageSortAscendingActionGroup">
21+
<annotations>
22+
<description>Set Ascending Direction for sorting Products on Category page</description>
23+
</annotations>
24+
<click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionAsc}}" stepKey="setAscendingDirection"/>
25+
</actionGroup>
26+
<actionGroup name="StorefrontCategoryPageSortDescendingActionGroup">
27+
<annotations>
28+
<description>Set Descending Direction for sorting Products on Category page</description>
29+
</annotations>
30+
<click selector="{{StorefrontCategoryTopToolbarSection.sortDirectionDesc}}" stepKey="setDescendingDirection"/>
2231
</actionGroup>
2332
</actionGroups>

0 commit comments

Comments
 (0)