Skip to content

Commit 9ab3c9c

Browse files
committed
MC-228: Customer should be able to sort bundle products by price when viewing products list
1 parent 70d2287 commit 9ab3c9c

File tree

2 files changed

+218
-0
lines changed

2 files changed

+218
-0
lines changed
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
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="StorefrontSortBundleProductsByPriceTest">
12+
<annotations>
13+
<features value="Bundle"/>
14+
<stories value="Bundle products list on Storefront"/>
15+
<title value="Customer should be able to sort bundle products by price when viewing products list"/>
16+
<description value="Customer should be able to sort bundle products by price when viewing products list"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-228"/>
19+
<group value="bundle"/>
20+
</annotations>
21+
<before>
22+
<!-- Create category -->
23+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
24+
25+
<!-- Create simple products for first bundle product -->
26+
<createData entity="SimpleProduct2" stepKey="createFirstSimpleProduct">
27+
<field key="price">100.00</field>
28+
</createData>
29+
<createData entity="SimpleProduct2" stepKey="createSecondSimpleProduct"/>
30+
31+
<!-- Create first bundle product -->
32+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createFirstBundleProduct">
33+
<requiredEntity createDataKey="createCategory"/>
34+
</createData>
35+
<createData entity="DropDownBundleOption" stepKey="firstProductBundleOption">
36+
<requiredEntity createDataKey="createFirstBundleProduct"/>
37+
</createData>
38+
<createData entity="ApiBundleLink" stepKey="createFirstBundleLink">
39+
<requiredEntity createDataKey="createFirstBundleProduct"/>
40+
<requiredEntity createDataKey="firstProductBundleOption"/>
41+
<requiredEntity createDataKey="createFirstSimpleProduct"/>
42+
</createData>
43+
<createData entity="ApiBundleLink" stepKey="createSecondBundleLink">
44+
<requiredEntity createDataKey="createFirstBundleProduct"/>
45+
<requiredEntity createDataKey="firstProductBundleOption"/>
46+
<requiredEntity createDataKey="createSecondSimpleProduct"/>
47+
</createData>
48+
49+
<!-- Create simple products for second bundle product -->
50+
<createData entity="SimpleProduct2" stepKey="createFirstProduct">
51+
<field key="price">10.00</field>
52+
</createData>
53+
<createData entity="SimpleProduct2" stepKey="createSecondProduct"/>
54+
55+
<!-- Create second bundle product -->
56+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createSecondBundleProduct">
57+
<requiredEntity createDataKey="createCategory"/>
58+
</createData>
59+
<createData entity="DropDownBundleOption" stepKey="secondProductBundleOption">
60+
<requiredEntity createDataKey="createSecondBundleProduct"/>
61+
</createData>
62+
<createData entity="ApiBundleLink" stepKey="createBundleLinkFirst">
63+
<requiredEntity createDataKey="createSecondBundleProduct"/>
64+
<requiredEntity createDataKey="secondProductBundleOption"/>
65+
<requiredEntity createDataKey="createFirstProduct"/>
66+
</createData>
67+
<createData entity="ApiBundleLink" stepKey="createBundleLinkSecond">
68+
<requiredEntity createDataKey="createSecondBundleProduct"/>
69+
<requiredEntity createDataKey="secondProductBundleOption"/>
70+
<requiredEntity createDataKey="createSecondProduct"/>
71+
</createData>
72+
73+
<!-- Create simple products for third bundle product -->
74+
<createData entity="SimpleProduct2" stepKey="createFirstProductForBundle"/>
75+
<createData entity="SimpleProduct2" stepKey="createSecondProductForBundle">
76+
<field key="price">500.00</field>
77+
</createData>
78+
79+
<!-- Create third bundle product -->
80+
<createData entity="ApiBundleProductPriceViewRange" stepKey="createThirdBundleProduct">
81+
<requiredEntity createDataKey="createCategory"/>
82+
</createData>
83+
<createData entity="DropDownBundleOption" stepKey="thirdProductBundleOption">
84+
<requiredEntity createDataKey="createThirdBundleProduct"/>
85+
</createData>
86+
<createData entity="ApiBundleLink" stepKey="createBundleFirstLink">
87+
<requiredEntity createDataKey="createThirdBundleProduct"/>
88+
<requiredEntity createDataKey="thirdProductBundleOption"/>
89+
<requiredEntity createDataKey="createFirstProductForBundle"/>
90+
</createData>
91+
<createData entity="ApiBundleLink" stepKey="createBundleSecondLink">
92+
<requiredEntity createDataKey="createThirdBundleProduct"/>
93+
<requiredEntity createDataKey="thirdProductBundleOption"/>
94+
<requiredEntity createDataKey="createSecondProductForBundle"/>
95+
</createData>
96+
97+
<!-- Perform CLI reindex -->
98+
<magentoCLI command="indexer:reindex" stepKey="reindex"/>
99+
</before>
100+
<after>
101+
<!-- Delete all created data -->
102+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
103+
<deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/>
104+
<deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/>
105+
<deleteData createDataKey="createFirstBundleProduct" stepKey="deleteFirstBundleProduct"/>
106+
<deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/>
107+
<deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/>
108+
<deleteData createDataKey="createSecondBundleProduct" stepKey="deleteSecondBundleProduct"/>
109+
<deleteData createDataKey="createFirstProductForBundle" stepKey="deleteFirstProductForBundle"/>
110+
<deleteData createDataKey="createSecondProductForBundle" stepKey="deleteSecondProductForBundle"/>
111+
<deleteData createDataKey="createThirdBundleProduct" stepKey="deleteThirdBundleProduct"/>
112+
</after>
113+
114+
<!-- Open created category on Storefront -->
115+
<actionGroup ref="StorefrontGoToCategoryPageActionGroup" stepKey="openCategoryPage">
116+
<argument name="categoryName" value="$$createCategory.name$$"/>
117+
</actionGroup>
118+
119+
<!-- Asset first bundle products in category product grid -->
120+
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createFirstBundleProduct.name$$)}}" stepKey="assertFirstBundleProduct"/>
121+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForFirstBundleProduct">
122+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createFirstBundleProduct.id$$)}}"/>
123+
<argument name="userInput" value="From $100.00"/>
124+
</actionGroup>
125+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForFirstBundleProduct">
126+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createFirstBundleProduct.id$$)}}"/>
127+
<argument name="userInput" value="To $123.00"/>
128+
</actionGroup>
129+
130+
<!-- Asset second bundle products in category product grid -->
131+
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createSecondBundleProduct.name$$)}}" stepKey="assertSecondBundleProduct"/>
132+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForSecondBundleProduct">
133+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createSecondBundleProduct.id$$)}}"/>
134+
<argument name="userInput" value="From $10.00"/>
135+
</actionGroup>
136+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForSecondBundleProduct">
137+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createSecondBundleProduct.id$$)}}"/>
138+
<argument name="userInput" value="To $123.00"/>
139+
</actionGroup>
140+
141+
<!-- Asset third bundle products in category product grid -->
142+
<seeElement selector="{{StorefrontCategoryProductSection.ProductTitleByName($$createThirdBundleProduct.name$$)}}" stepKey="assertThirdBundleProduct"/>
143+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeFromForThirdBundleProduct">
144+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceFromByProductId($$createThirdBundleProduct.id$$)}}"/>
145+
<argument name="userInput" value="From $123.00"/>
146+
</actionGroup>
147+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seePriceRangeToForThirdBundleProduct">
148+
<argument name="selector" value="{{StorefrontCategoryProductSection.priceToByProductId($$createThirdBundleProduct.id$$)}}"/>
149+
<argument name="userInput" value="To $500.00"/>
150+
</actionGroup>
151+
152+
<!-- Switch category view to List mode -->
153+
<actionGroup ref="StorefrontSwitchCategoryViewToListMode" stepKey="switchCategoryViewToListMode"/>
154+
155+
<!-- Sort products By Price -->
156+
<actionGroup ref="StorefrontCategoryPageSortProductActionGroup" stepKey="sortProductByPrice"/>
157+
<!-- Set Ascending Direction -->
158+
<actionGroup ref="StorefrontCategoryPageSortDirectionActionGroup" stepKey="setAscendingDirection">
159+
<argument name="directionSelector" value="{{StorefrontCategoryTopToolbarSection.sortDirectionAsc}}"/>
160+
</actionGroup>
161+
162+
<!-- Assert new products positions -->
163+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductFirstPosition">
164+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('1')}}"/>
165+
<argument name="userInput" value="$$createThirdBundleProduct.name$$"/>
166+
</actionGroup>
167+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductSecondPosition">
168+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('2')}}"/>
169+
<argument name="userInput" value="$$createFirstBundleProduct.name$$"/>
170+
</actionGroup>
171+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductThirdPosition">
172+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('3')}}"/>
173+
<argument name="userInput" value="$$createSecondBundleProduct.name$$"/>
174+
</actionGroup>
175+
176+
<!-- Set Descending Direction -->
177+
<actionGroup ref="StorefrontCategoryPageSortDirectionActionGroup" stepKey="setDescendingDirection">
178+
<argument name="directionSelector" value="{{StorefrontCategoryTopToolbarSection.sortDirectionDesc}}"/>
179+
</actionGroup>
180+
181+
<!-- Assert new products positions -->
182+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewFirstPosition">
183+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('1')}}"/>
184+
<argument name="userInput" value="$$createSecondBundleProduct.name$$"/>
185+
</actionGroup>
186+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewSecondPosition">
187+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('2')}}"/>
188+
<argument name="userInput" value="$$createFirstBundleProduct.name$$"/>
189+
</actionGroup>
190+
<actionGroup ref="AssertStorefrontElementVisibleActionGroup" stepKey="seeProductNewThirdPosition">
191+
<argument name="selector" value="{{StorefrontCategoryMainSection.lineProductName('3')}}"/>
192+
<argument name="userInput" value="$$createThirdBundleProduct.name$$"/>
193+
</actionGroup>
194+
</test>
195+
</tests>
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+
9+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
11+
<actionGroup name="StorefrontCategoryPageSortProductActionGroup">
12+
<arguments>
13+
<argument name="sortBy" type="string" defaultValue="Price"/>
14+
</arguments>
15+
<selectOption selector="{{StorefrontCategoryTopToolbarSection.sortByDropdown}}" userInput="{{sortBy}}" stepKey="selectSortByParameter"/>
16+
</actionGroup>
17+
<actionGroup name="StorefrontCategoryPageSortDirectionActionGroup">
18+
<arguments>
19+
<argument name="directionSelector" type="string"/>
20+
</arguments>
21+
<click selector="{{directionSelector}}" stepKey="setDirection"/>
22+
</actionGroup>
23+
</actionGroups>

0 commit comments

Comments
 (0)