Skip to content

Commit 70798ca

Browse files
committed
MC-249: Guest customer should be able to search configurable product by attributes of child products
- Add different attributes for different children products
1 parent a9ae886 commit 70798ca

File tree

5 files changed

+112
-7
lines changed

5 files changed

+112
-7
lines changed

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductAttributeData.xml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
7575
</entity>
7676
<entity name="productAttributeWithDropdownTwoOptions" type="ProductAttribute">
77-
<data key="attribute_code">testattribute</data>
77+
<data key="attribute_code" unique="suffix">testattribute</data>
7878
<data key="frontend_input">select</data>
7979
<data key="scope">global</data>
8080
<data key="is_required">false</data>
@@ -94,4 +94,25 @@
9494
<data key="used_for_sort_by">true</data>
9595
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
9696
</entity>
97+
<entity name="productAttributeMultiselectTwoOptions" type="ProductAttribute">
98+
<data key="attribute_code" unique="suffix">attribute</data>
99+
<data key="frontend_input">multiselect</data>
100+
<data key="scope">global</data>
101+
<data key="is_required">false</data>
102+
<data key="is_unique">false</data>
103+
<data key="is_searchable">true</data>
104+
<data key="is_visible">true</data>
105+
<data key="is_visible_in_advanced_search">true</data>
106+
<data key="is_visible_on_front">true</data>
107+
<data key="is_filterable">true</data>
108+
<data key="is_filterable_in_search">true</data>
109+
<data key="used_in_product_listing">true</data>
110+
<data key="is_used_for_promo_rules">true</data>
111+
<data key="is_comparable">true</data>
112+
<data key="is_used_in_grid">true</data>
113+
<data key="is_visible_in_grid">true</data>
114+
<data key="is_filterable_in_grid">true</data>
115+
<data key="used_for_sort_by">true</data>
116+
<requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity>
117+
</entity>
97118
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductAttributeOptionData.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,38 @@
2424
<requiredEntity type="StoreLabel">Option2Store0</requiredEntity>
2525
<requiredEntity type="StoreLabel">Option2Store1</requiredEntity>
2626
</entity>
27+
<entity name="productAttributeOption3" type="ProductAttributeOption">
28+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
29+
<data key="label" unique="suffix">option3</data>
30+
<data key="is_default">false</data>
31+
<data key="sort_order">2</data>
32+
<requiredEntity type="StoreLabel">Option3Store0</requiredEntity>
33+
<requiredEntity type="StoreLabel">Option3Store1</requiredEntity>
34+
</entity>
35+
<entity name="productAttributeOption4" type="ProductAttributeOption">
36+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
37+
<data key="label" unique="suffix">option4</data>
38+
<data key="is_default">false</data>
39+
<data key="sort_order">3</data>
40+
<requiredEntity type="StoreLabel">Option4Store0</requiredEntity>
41+
<requiredEntity type="StoreLabel">Option4Store1</requiredEntity>
42+
</entity>
43+
<entity name="productAttributeOption5" type="ProductAttributeOption">
44+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
45+
<data key="label" unique="suffix">option5</data>
46+
<data key="is_default">false</data>
47+
<data key="sort_order">4</data>
48+
<requiredEntity type="StoreLabel">Option5Store0</requiredEntity>
49+
<requiredEntity type="StoreLabel">Option5Store1</requiredEntity>
50+
</entity>
51+
<entity name="productAttributeOption6" type="ProductAttributeOption">
52+
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
53+
<data key="label" unique="suffix">option6</data>
54+
<data key="is_default">false</data>
55+
<data key="sort_order">5</data>
56+
<requiredEntity type="StoreLabel">Option6Store0</requiredEntity>
57+
<requiredEntity type="StoreLabel">Option6Store1</requiredEntity>
58+
</entity>
2759
<entity name="ProductAttributeOptionGetter" type="ProductAttributeOption">
2860
<var key="attribute_code" entityKey="attribute_code" entityType="ProductAttribute"/>
2961
</entity>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/ProductData.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
<data key="quantity">100</data>
132132
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
133133
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
134+
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
134135
</entity>
135136
<entity name="ApiSimpleTwo" type="product2">
136137
<data key="sku" unique="suffix">api-simple-product-two</data>
@@ -157,6 +158,7 @@
157158
<data key="quantity">100</data>
158159
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
159160
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
161+
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
160162
</entity>
161163
<entity name="VirtualProduct" type="product">
162164
<data key="sku" unique="suffix">virtualproduct</data>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/Catalog/Data/StoreLabelData.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,36 @@
2424
<data key="store_id">1</data>
2525
<data key="label">option2</data>
2626
</entity>
27+
<entity name="Option3Store0" type="StoreLabel">
28+
<data key="store_id">0</data>
29+
<data key="label">option3</data>
30+
</entity>
31+
<entity name="Option3Store1" type="StoreLabel">
32+
<data key="store_id">1</data>
33+
<data key="label">option3</data>
34+
</entity>
35+
<entity name="Option4Store0" type="StoreLabel">
36+
<data key="store_id">0</data>
37+
<data key="label">option4</data>
38+
</entity>
39+
<entity name="Option4Store1" type="StoreLabel">
40+
<data key="store_id">1</data>
41+
<data key="label">option4</data>
42+
</entity>
43+
<entity name="Option5Store0" type="StoreLabel">
44+
<data key="store_id">0</data>
45+
<data key="label">option5</data>
46+
</entity>
47+
<entity name="Option5Store1" type="StoreLabel">
48+
<data key="store_id">1</data>
49+
<data key="label">option5</data>
50+
</entity>
51+
<entity name="Option6Store0" type="StoreLabel">
52+
<data key="store_id">0</data>
53+
<data key="label">option6</data>
54+
</entity>
55+
<entity name="Option6Store1" type="StoreLabel">
56+
<data key="store_id">1</data>
57+
<data key="label">option6</data>
58+
</entity>
2759
</entities>

dev/tests/acceptance/tests/functional/Magento/FunctionalTest/ConfigurableProduct/Test/StorefrontConfigurableProductChildSearchTest.xml

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

31-
<!-- Create an attribute with two options -->
31+
<!-- Create an attribute with two options to be used in the first child product -->
3232
<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttribute"/>
3333
<createData entity="productAttributeOption1" stepKey="createConfigProductAttributeOption1">
3434
<requiredEntity createDataKey="createConfigProductAttribute"/>
@@ -37,19 +37,33 @@
3737
<requiredEntity createDataKey="createConfigProductAttribute"/>
3838
</createData>
3939

40+
<!-- Create an attribute with two options to be used in the second child product -->
41+
<createData entity="productAttributeMultiselectTwoOptions" stepKey="createConfigProductAttributeMultiSelect"/>
42+
<createData entity="productAttributeOption3" stepKey="createConfigProductAttributeOption1Multiselect">
43+
<requiredEntity createDataKey="createConfigProductAttributeMultiSelect"/>
44+
</createData>
45+
<createData entity="productAttributeOption4" stepKey="createConfigProductAttributeOption2Multiselect">
46+
<requiredEntity createDataKey="createConfigProductAttributeMultiSelect"/>
47+
</createData>
48+
4049
<!-- Add the attribute we just created to default attribute set -->
4150
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet">
4251
<requiredEntity createDataKey="createConfigProductAttribute"/>
4352
</createData>
4453

54+
<!-- Add the third attribute we just created to default attribute set -->
55+
<createData entity="AddToDefaultSet" stepKey="createConfigAddToAttributeSet2">
56+
<requiredEntity createDataKey="createConfigProductAttributeMultiSelect"/>
57+
</createData>
58+
4559
<!-- Get the first option of the attribute we created -->
4660
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption1">
4761
<requiredEntity createDataKey="createConfigProductAttribute"/>
4862
</getData>
4963

50-
<!-- Get the second option of the attribute we created -->
51-
<getData entity="ProductAttributeOptionGetter" index="2" stepKey="getConfigAttributeOption2">
52-
<requiredEntity createDataKey="createConfigProductAttribute"/>
64+
<!-- Get the first option of the second attribute we created -->
65+
<getData entity="ProductAttributeOptionGetter" index="1" stepKey="getConfigAttributeOption2">
66+
<requiredEntity createDataKey="createConfigProductAttributeMultiSelect"/>
5367
</getData>
5468

5569
<!-- Create a simple product and give it the attribute with the first option -->
@@ -60,7 +74,7 @@
6074

6175
<!-- Create a simple product and give it the attribute with the second option -->
6276
<createData entity="ApiSimpleTwoHidden" stepKey="createConfigChildProduct2">
63-
<requiredEntity createDataKey="createConfigProductAttribute"/>
77+
<requiredEntity createDataKey="createConfigProductAttributeMultiSelect"/>
6478
<requiredEntity createDataKey="getConfigAttributeOption2"/>
6579
</createData>
6680

@@ -93,6 +107,8 @@
93107
<deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/>
94108
<deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/>
95109
<deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/>
110+
<deleteData createDataKey="createConfigProductAttributeMultiSelect" stepKey="deleteConfigProductAttributeMultiSelect"/>
111+
<deleteData createDataKey="createConfigProductAttributeSelect" stepKey="deleteConfigProductAttributeSelect"/>
96112
<deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/>
97113
</after>
98114

@@ -107,6 +123,8 @@
107123
<argument name="description" value="sampleShortDescription"/>
108124
</actionGroup>
109125

126+
<pauseExecution stepKey="pause"/>
127+
110128
<!-- Quick search the storefront for the first attribute option -->
111129
<amOnPage stepKey="goToStoreFront" url="{{StorefrontHomePage.url}}"/>
112130
<waitForPageLoad stepKey="waitForStorefront"/>
@@ -115,7 +133,7 @@
115133
<seeElement stepKey="seeProduct1" selector="{{StorefrontCategoryProductSection.ProductTitleByName('$$createConfigProduct.name$$')}}"/>
116134

117135
<!-- Quick search the storefront for the second attribute option -->
118-
<fillField stepKey="searchStorefront2" selector="{{StorefrontPanelHeaderSection.search}}" userInput="$$createConfigProductAttributeOption2.option[store_labels][0][label]$$"/>
136+
<fillField stepKey="searchStorefront2" selector="{{StorefrontPanelHeaderSection.search}}" userInput="$$createConfigProductAttributeOption1Multiselect.option[store_labels][0][label]$$"/>
119137
<click stepKey="clickSearch2" selector="{{StorefrontPanelHeaderSection.searchButton}}"/>
120138
<seeElement stepKey="seeProduct2" selector="{{StorefrontCategoryProductSection.ProductTitleByName('$$createConfigProduct.name$$')}}"/>
121139

0 commit comments

Comments
 (0)