Skip to content

Commit 4f0fa48

Browse files
Pradyumna BhatPradyumna Bhat
authored andcommitted
ACQE-7462: Display images for a configurable product on store front
Created a new automation test to verify unique images for configurable product on storefront
1 parent 01ac66b commit 4f0fa48

8 files changed

+317
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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="AdminAddOptionsToColorAttributeActionGroup">
12+
<annotations>
13+
<description>Add options for color attribute</description>
14+
</annotations>
15+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickOnAddOption1"/>
16+
<waitForElementVisible selector="{{AdminNewAttributePanel.optionAdminValue('0')}}" stepKey="waitForAdminLabel1"/>
17+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('0')}}" userInput="{{ConfigurableProduct1.color_option1}}" stepKey="fillAdminLabel1"/>
18+
<click selector="{{AdminNewAttributePanel.addOption}}" stepKey="clickOnAddOption2"/>
19+
<waitForElementVisible selector="{{AdminNewAttributePanel.optionAdminValue('1')}}" stepKey="waitForAdminLabel2"/>
20+
<fillField selector="{{AdminNewAttributePanel.optionAdminValue('1')}}" userInput="{{ConfigurableProduct1.color_option2}}" stepKey="fillAdminLabel2"/>
21+
<!-- Save attribute -->
22+
<click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/>
23+
<waitForPageLoad time="30" stepKey="waitForSaveAttribute"/>
24+
<switchToIFrame stepKey="switchOutOfIFrame"/>
25+
</actionGroup>
26+
</actionGroups>
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="AdminRemoveOptionsFromColorAttributeActionGroup">
12+
<annotations>
13+
<description>Remove options from color attribute</description>
14+
</annotations>
15+
<click stepKey="deleteOption1" selector="{{AdminNewAttributePanel.deleteOptionByName('black')}}"/>
16+
<click stepKey="deleteOption2" selector="{{AdminNewAttributePanel.deleteOptionByName('red')}}"/>
17+
<!-- Save attribute -->
18+
<click selector="{{AdminNewAttributePanel.saveAttribute}}" stepKey="clickOnNewAttributePanel"/>
19+
<waitForPageLoad time="30" stepKey="waitForSaveAttribute"/>
20+
<switchToIFrame stepKey="switchOutOfIFrame"/>
21+
</actionGroup>
22+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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="AdminUnassignAttributeFromDefaultSetActionGroup">
12+
<annotations>
13+
<description>Unassign given attribute from default attribute set</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="ProductAttributeCode" type="string"/>
17+
</arguments>
18+
<amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetPage"/>
19+
<click selector="{{AdminProductAttributeSetGridSection.resetFilter}}" stepKey="clickResetButton"/>
20+
<fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="Default" stepKey="filterByName"/>
21+
<click selector="{{AdminProductAttributeSetGridSection.searchBtn}}" stepKey="clickSearchBtn"/>
22+
<click selector="{{AdminProductAttributeSetGridSection.nthRow('1')}}" stepKey="clickFirstRow"/>
23+
<waitForPageLoad stepKey="waitForSelectCustomGroup"/>
24+
<dragAndDrop selector1="{{AdminProductAttributeSetSection.attribute(ProductAttributeCode)}}" selector2="{{AdminProductAttributeSetSection.attribute('manufacturer')}}" stepKey="unassignAttributeFromDefaultAttributeSet"/>
25+
<click selector="{{AdminProductAttributeSetSection.saveBtn}}" stepKey="clickSaveDefaultAttributeSet"/>
26+
</actionGroup>
27+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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="CreateCustomAttributeActionGroup">
12+
<arguments>
13+
<argument name="attributeScope" type="string" defaultValue="Store View"/>
14+
</arguments>
15+
<selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="{{attributeScope}}" stepKey="selectAttributeScopeDropdown" after="fillAttributeCode"/>
16+
</actionGroup>
17+
</actionGroups>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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="StorefrontVerifyConfigurableProductImagesActionGroup">
12+
<annotations>
13+
<description>Verify unique image visibility for configurable product option on storefront</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attributeOption1" type="string"/>
17+
<argument name="attributeOption2" type="string"/>
18+
</arguments>
19+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect(attributeOption1)}}" userInput="{{ConfigurableProduct1.color_option1}}" stepKey="fillColorDownAttributeOption1"/>
20+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect(attributeOption2)}}" userInput="{{ConfigurableProduct1.size_option1}}" stepKey="fillSizeAttributeOption1"/>
21+
<waitForPageLoad time="30" stepKey="waitForPreviewLoadForOptionBlack"/>
22+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageActive(TestImageNew.filename)}}" time="30" stepKey="waitImageToBeLoadedForColorOptionBlack"/>
23+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect(attributeOption1)}}" userInput="{{ConfigurableProduct1.color_option2}}" stepKey="fillColorDownAttributeOption2"/>
24+
<selectOption selector="{{StorefrontProductInfoMainSection.productOptionSelect(attributeOption2)}}" userInput="{{ConfigurableProduct1.size_option2}}" stepKey="fillSizeAttributeOption2"/>
25+
<waitForPageLoad time="30" stepKey="waitForPreviewLoadForOptionRed"/>
26+
<waitForElementVisible selector="{{StorefrontProductMediaSection.productImageActive(MagentoLogo.filename)}}" time="30" stepKey="waitImageToBeLoadedForColorOptionRed"/>
27+
</actionGroup>
28+
</actionGroups>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
10+
<entity name="CategoryNew1" type="category">
11+
<data key="name" unique="suffix">new1</data>
12+
<data key="name_lwr" unique="suffix">new1</data>
13+
<data key="urlKey" unique="suffix">new1</data>
14+
</entity>
15+
</entities>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
9+
<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
11+
<entity name="ConfigurableProduct1" type="product">
12+
<data key="name" unique="suffix">conf1</data>
13+
<data key="sku" unique="suffix">conf1</data>
14+
<data key="type_id">configurable</data>
15+
<data key="attribute_set_id">4</data>
16+
<data key="status">1</data>
17+
<data key="quantity">10000</data>
18+
<data key="price">10</data>
19+
<data key="color_label">Color</data>
20+
<data key="size_label">Size</data>
21+
<data key="color_option1">black</data>
22+
<data key="color_option2">red</data>
23+
<data key="size_option1">8</data>
24+
<data key="size_option2">10</data>
25+
</entity>
26+
</entities>
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
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="ConfigurableProductUniqueImageDisplayTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<stories value="Display unique images for a configurable product on storefront"/>
15+
<title value="Unique images should be displayed on storefront correctly for Configurable product"/>
16+
<description value="Admin should be able to add images for configurable products and unique images should display on storefront correctly based configurable attribute options"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="MC-27546"/>
19+
<group value="catalog"/>
20+
</annotations>
21+
<before>
22+
<!-- Admin Login -->
23+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
24+
25+
<!-- Goto, Stores > Attributes > Product > Filter by attribute label 'Color' > Edit-->
26+
<actionGroup ref="AdminNavigateToProductAttributeEditPageActionGroup" stepKey="navigateToColorProductAttribute1">
27+
<argument name="ProductAttributeLabel" value="Color"/>
28+
</actionGroup>
29+
30+
<!-- Use action group to add options for color attribute-->
31+
<actionGroup ref="AdminAddOptionsToColorAttributeActionGroup" stepKey="addOptionsForColorAttribute"/>
32+
33+
<!-- Create new attribute 'Size'-->
34+
<actionGroup ref="CreateCustomAttributeActionGroup" stepKey="createCustomProductAttributeSize">
35+
<argument name="attributeLabel" value="Size"/>
36+
<argument name="attributeCode" value="size"/>
37+
<argument name="valueRequired" value="No"/>
38+
<argument name="adminOption1" value="{{ConfigurableProduct1.size_option1}}"/>
39+
<argument name="adminOption1Value" value="{{ConfigurableProduct1.size_option1}}"/>
40+
<argument name="adminOption2" value="{{ConfigurableProduct1.size_option2}}"/>
41+
<argument name="adminOption2Value" value="{{ConfigurableProduct1.size_option2}}"/>
42+
<argument name="attributeScope" value="Global"/>
43+
</actionGroup>
44+
45+
<!--Crete new category-->
46+
<actionGroup ref="AdminOpenCategoryPageActionGroup" stepKey="goToCategoryPage"/>
47+
<actionGroup ref="CreateCategoryActionGroup" stepKey="createNewSubcategory">
48+
<argument name="categoryEntity" value="CategoryNew1"/>
49+
</actionGroup>
50+
</before>
51+
<after>
52+
<!--Delete category-->
53+
<actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteSubcategory">
54+
<argument name="categoryEntity" value="CategoryNew1"/>
55+
</actionGroup>
56+
57+
<!-- Delete product -->
58+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteConfigurableProduct">
59+
<argument name="sku" value="{{ConfigurableProduct1.sku}}"/>
60+
</actionGroup>
61+
62+
<!-- Goto, Stores > Attributes > Product > Filter by attribute label 'Color' > Edit-->
63+
<actionGroup ref="AdminNavigateToProductAttributeEditPageActionGroup" stepKey="navigateToColorProductAttribute2">
64+
<argument name="ProductAttributeLabel" value="{{ConfigurableProduct1.color_label}}"/>
65+
</actionGroup>
66+
<!-- Remove color attribute options -->
67+
<actionGroup ref="AdminRemoveOptionsFromColorAttributeActionGroup" stepKey="removeOptionsFromColorAttribute"/>
68+
69+
<!-- Goto, Stores > Attributes > Product > Filter by attribute label 'Size' > Edit and Perform attribute deletion-->
70+
<actionGroup ref="AdminNavigateToProductAttributeEditPageActionGroup" stepKey="navigateToSizeProductAttribute">
71+
<argument name="ProductAttributeLabel" value="Size"/>
72+
</actionGroup>
73+
<!-- Delete attribute - Size -->
74+
<actionGroup ref="DeleteProductAttributeByAttributeCodeActionGroup" stepKey="deleteProductAttributeSize" />
75+
76+
<!-- Unassign product attribute from Default attribute set -->
77+
<actionGroup ref="AdminUnassignAttributeFromDefaultSetActionGroup" stepKey="unassignColorAttributeFromDefaultAttributeSet">
78+
<argument name="ProductAttributeCode" value="color"/>
79+
</actionGroup>
80+
81+
<!-- Admin Logout -->
82+
<actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/>
83+
</after>
84+
85+
<!--Create a configurable product-->
86+
<actionGroup ref="AdminOpenNewProductFormPageActionGroup" stepKey="goToProductCreatePage">
87+
<argument name="attributeSetId" value="{{AddToDefaultSet.attributeSetId}}"/>
88+
<argument name="productType" value="configurable"/>
89+
</actionGroup>
90+
<fillField selector="{{AdminProductFormSection.productName}}" userInput="{{ConfigurableProduct1.name}}" stepKey="fillProductName"/>
91+
<fillField selector="{{AdminProductFormSection.productSku}}" userInput="{{ConfigurableProduct1.sku}}" stepKey="fillProductSku"/>
92+
<fillField selector="{{AdminProductFormSection.productPrice}}" userInput="{{ConfigurableProduct1.price}}" stepKey="fillProductPrice"/>
93+
<searchAndMultiSelectOption selector="{{AdminProductFormSection.categoriesDropdown}}" parameterArray="[{{CategoryNew1.name}}]" stepKey="selectCategory"/>
94+
<!-- Setup configurations-->
95+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
96+
<waitForElementVisible selector="{{AdminCreateProductConfigurationsPanel.createNewAttribute}}" time="30" stepKey="waitForConfigurationModalOpen" after="clickCreateConfigurations"/>
97+
<!--Add attributes and select all options -->
98+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeRowByAttributeCode('color')}}" stepKey="clickOnColorAttributeCheckbox"/>
99+
<click selector="{{AdminCreateProductConfigurationsPanel.attributeRowByAttributeCode('size')}}" stepKey="clickOnSizeAttributeCheckbox"/>
100+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/>
101+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute('Color')}}" stepKey="clickOnSelectAllInColorAttribute"/>
102+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAllByAttribute('Size')}}" stepKey="clickOnSelectAllInSizeAttribute"/>
103+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/>
104+
<!-- Add unique images to product attribute options -->
105+
<actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOption1">
106+
<argument name="image" value="TestImageNew"/>
107+
<argument name="frontend_label" value="{{ConfigurableProduct1.color_label}}"/>
108+
<argument name="label" value="{{ConfigurableProduct1.color_option1}}"/>
109+
</actionGroup>
110+
<actionGroup ref="AddUniqueImageToConfigurableProductOptionActionGroup" stepKey="addImageToConfigurableProductOption2">
111+
<argument name="image" value="MagentoLogo"/>
112+
<argument name="frontend_label" value="{{ConfigurableProduct1.color_label}}"/>
113+
<argument name="label" value="{{ConfigurableProduct1.color_option2}}"/>
114+
</actionGroup>
115+
<!-- Add unique price to product attribute options -->
116+
<actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceToConfigurableProductOption1">
117+
<argument name="frontend_label" value="Size"/>
118+
<argument name="label" value="{{ConfigurableProduct1.size_option1}}"/>
119+
<argument name="price" value="4"/>
120+
</actionGroup>
121+
<actionGroup ref="AddUniquePriceToConfigurableProductOptionActionGroup" stepKey="addPriceToConfigurableProductOption2">
122+
<argument name="frontend_label" value="Size"/>
123+
<argument name="label" value="{{ConfigurableProduct1.size_option2}}"/>
124+
<argument name="price" value="6"/>
125+
</actionGroup>
126+
<!-- Add quantity to product attribute options -->
127+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
128+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="10000" stepKey="enterAttributeQuantity"/>
129+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
130+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
131+
<!-- Save product -->
132+
<actionGroup ref="SaveConfigurableProductAddToCurrentAttributeSetActionGroup" stepKey="saveProduct"/>
133+
134+
<!-- Reindex invalidated indices for the product to be visible in Storefront -->
135+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindexInvalidatedIndicesPostChangingConfigurationSettings">
136+
<argument name="indices" value=""/>
137+
</actionGroup>
138+
139+
<!-- Verify on storefront that category and product is visible -->
140+
<actionGroup ref="StorefrontNavigateToCategoryUrlActionGroup" stepKey="goToCategoryStorefrontPage">
141+
<argument name="categoryUrl" value="{{CategoryNew1.urlKey}}"/>
142+
</actionGroup>
143+
<waitForText userInput="{{CategoryNew1.name}}" selector="{{StorefrontCategoryMainSection.CategoryTitle}}" stepKey="assertCategoryNameOnStorefront"/>
144+
<waitForText userInput="{{ConfigurableProduct1.name}}" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="assertProductVisibleInStorefront"/>
145+
146+
<!-- Navigate to Product Page -->
147+
<click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openConfigurableProduct"/>
148+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
149+
150+
<!-- Select configurable product option on Storefront and Verify that unique images are visible for different color options -->
151+
<actionGroup ref="StorefrontVerifyConfigurableProductImagesActionGroup" stepKey="storefrontVerifyUniqueImagesForConfigurableProductOption">
152+
<argument name="attributeOption1" value="{{ConfigurableProduct1.color_label}}"/>
153+
<argument name="attributeOption2" value="{{ConfigurableProduct1.size_label}}"/>
154+
</actionGroup>
155+
</test>
156+
</tests>

0 commit comments

Comments
 (0)