Skip to content

Commit 1e7a99f

Browse files
Merge remote-tracking branch 'remotes/github/MC-18821' into EPAM-PR-80
2 parents 96055b2 + c031f08 commit 1e7a99f

File tree

15 files changed

+709
-32
lines changed

15 files changed

+709
-32
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<element name="filterOptions" type="text" selector=".filter-options-content .items"/>
1313
<element name="filterOption" type="text" selector=".filter-options-content .item"/>
1414
<element name="optionQty" type="text" selector=".filter-options-content .item .count"/>
15+
<element name="filterOptionByLabel" type="button" selector=" div.filter-options-item div[option-label='{{optionLabel}}']" parameterized="true"/>
16+
<element name="removeFilter" type="button" selector="div.filter-current .remove"/>
1517
</section>
1618
<section name="StorefrontCategorySidebarMobileSection">
1719
<element name="shopByButton" type="button" selector="//div[contains(@class, 'filter-title')]/strong[contains(text(), 'Shop By')]"/>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
<suites xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Suite/etc/suiteSchema.xsd">
9+
<suite name="MagentoDeveloperModeTestSuite">
10+
<before>
11+
<magentoCLI command="deploy:mode:set developer" stepKey="enableDeveloperMode"/>
12+
</before>
13+
<after>
14+
<magentoCLI command="deploy:mode:set production" stepKey="enableProductionMode"/>
15+
</after>
16+
<include>
17+
<group name="developer_mode_only"/>
18+
</include>
19+
</suite>
20+
</suites>

app/code/Magento/Swatches/Test/Mftf/ActionGroup/AddSwatchToProductActionGroup.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@
8585
<selectOption selector="{{AdminNewAttributePanel.useInProductListing}}" stepKey="switchOnUsedInProductListing" userInput="Yes" after="switchOnVisibleOnCatalogPagesOnStorefront"/>
8686
</actionGroup>
8787

88+
<actionGroup name="AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup" extends="AddVisualSwatchToProductActionGroup">
89+
<selectOption selector="{{AdminNewAttributePanel.updateProductPreviewImage}}" userInput="Yes" stepKey="selectUpdatePreviewImage" after="selectInputType"/>
90+
<click selector="{{AdminNewAttributePanel.storefrontPropertiesTab}}" stepKey="goToStorefrontPropertiesTab" after="fillDefaultStoreLabel2"/>
91+
<waitForElementVisible selector="{{AdminNewAttributePanel.storefrontPropertiesTitle}}" after="goToStorefrontPropertiesTab" stepKey="waitTabLoad"/>
92+
<selectOption selector="{{AdminNewAttributePanel.useInLayeredNavigation}}" userInput="Filterable (with results)" stepKey="selectUseInLayer" after="waitTabLoad"/>
93+
<selectOption selector="{{AdminNewAttributePanel.useInProductListing}}" userInput="Yes" stepKey="switchOnUsedInProductListing" after="selectUseInLayer"/>
94+
<selectOption selector="{{AdminNewAttributePanel.usedForStoringInProductListing}}" userInput="Yes" stepKey="switchOnUsedForStoringInProductListing" after="switchOnUsedInProductListing"/>
95+
</actionGroup>
96+
8897
<actionGroup name="AddTextSwatchToProductActionGroup">
8998
<annotations>
9099
<description>Add text swatch property attribute.</description>

app/code/Magento/Swatches/Test/Mftf/ActionGroup/AdminEditPropertiesTabForSwatchProductAtributeActionGroup.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
<fillField selector="{{AdminNewAttributePanel.lastVisualSwatchOptionAdminValue}}" userInput="{{swatchOption.admin_label}}" stepKey="fillAdminLabel"/>
2121
<fillField selector="{{AdminNewAttributePanel.lastVisualSwatchOptionDefaultStoreValue}}" userInput="{{swatchOption.default_label}}" stepKey="fillDefaultStoreLabel"/>
2222
</actionGroup>
23+
<actionGroup name="AdminAddPreviewImageSwatchOption">
24+
<arguments>
25+
<argument name="image" type="entity" defaultValue="MagentoLogo"/>
26+
<argument name="index" type="string" defaultValue="1"/>
27+
</arguments>
28+
<click selector="{{AdminManageSwatchSection.nthUploadFile(index)}}" stepKey="clickUploadFile"/>
29+
<attachFile selector="{{AdminManageSwatchSection.file}}" userInput="{{image.file}}" stepKey="attachFile"/>
30+
</actionGroup>
2331

2432
<!--You are on ProductAttributePage-->
2533
<!--Select value for option "Update Product Preview Image"-->

app/code/Magento/Swatches/Test/Mftf/Section/AdminManageSwatchSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<element name="swatchAdminDescriptionByIndex" type="input" selector="input[name='optiontext[value][option_{{index}}][0]']" parameterized="true"/>
2222
<element name="nthChooseColor" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_row_name.colorpicker_handler" parameterized="true"/>
2323
<element name="nthUploadFile" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_row_name.btn_choose_file_upload" parameterized="true"/>
24+
<element name="file" type="input" selector="input[name='datafile']"/>
2425
<element name="nthDelete" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) button.delete-option" parameterized="true"/>
2526
<element name="deleteBtn" type="button" selector="#manage-options-panel:nth-of-type({{var}}) button.delete-option" parameterized="true"/>
2627
</section>

app/code/Magento/Swatches/Test/Mftf/Section/AdminNewAttributePanelSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminNewAttributePanel">
12+
<element name="updateProductPreviewImage" type="select" selector="#update_product_preview_image"/>
1213
<element name="addVisualSwatchOption" type="button" selector="button#add_new_swatch_visual_option_button"/>
1314
<element name="addTextSwatchOption" type="button" selector="button#add_new_swatch_text_option_button"/>
1415
<element name="visualSwatchOptionAdminValue" type="input" selector="[data-role='swatch-visual-options-container'] input[name='optionvisual[value][option_{{row}}][0]']" parameterized="true"/>
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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="AdminSaveConfProductWithCustomProductAttributeTest">
12+
<annotations>
13+
<features value="Swatches"/>
14+
<stories value="Configurable product with swatch attribute"/>
15+
<title value="Saving configurable product with custom product attribute (images as swatches)"/>
16+
<description value="Saving configurable product with custom product attribute (images as swatches)"/>
17+
<severity value="CRITICAL"/>
18+
<testCaseId value="MC-13641"/>
19+
<useCaseId value="MC-10968"/>
20+
<group value="developer_mode_only"/>
21+
<group value="Swatches"/>
22+
</annotations>
23+
<before>
24+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
25+
<!--Create configurable product-->
26+
<createData entity="SimpleSubCategory" stepKey="createCategory"/>
27+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
28+
<requiredEntity createDataKey="createCategory"/>
29+
</createData>
30+
</before>
31+
<after>
32+
<!--Delete created data-->
33+
<deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/>
34+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
35+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/>
36+
<actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/>
37+
<actionGroup ref="deleteProductAttribute" stepKey="deleteAttribute">
38+
<argument name="ProductAttribute" value="VisualSwatchProductAttribute"/>
39+
</actionGroup>
40+
<actionGroup ref="logout" stepKey="logout"/>
41+
</after>
42+
<!--Create Visual swatch with preview image-->
43+
<amOnPage url="{{ProductAttributePage.url}}" stepKey="goToNewProductAttributePage"/>
44+
<actionGroup ref="AdminFillProductAttributePropertiesActionGroup" stepKey="fillProductAttributeProperties">
45+
<argument name="attributeName" value="{{VisualSwatchProductAttribute.attribute_code}}"/>
46+
<argument name="attributeType" value="{{VisualSwatchProductAttribute.frontend_input}}"/>
47+
</actionGroup>
48+
<!--Add first option-->
49+
<actionGroup ref="AdminAddSwatchOptionAndFillFieldsActionGroup" stepKey="addFirstSwatchOptionAndFillFields">
50+
<argument name="swatchOption" value="visualSwatchOption1"/>
51+
</actionGroup>
52+
<actionGroup ref="openSwatchMenuByIndex" stepKey="clickSFirstSwatch">
53+
<argument name="index" value="0"/>
54+
</actionGroup>
55+
<actionGroup ref="AdminAddPreviewImageSwatchOption" stepKey="addFirstOptionImage">
56+
<argument name="image" value="MagentoLogo"/>
57+
<argument name="index" value="1"/>
58+
</actionGroup>
59+
<!--Add second option-->
60+
<actionGroup ref="AdminAddSwatchOptionAndFillFieldsActionGroup" stepKey="addSecondSwatchOptionAndFillFields">
61+
<argument name="swatchOption" value="visualSwatchOption2"/>
62+
</actionGroup>
63+
<actionGroup ref="openSwatchMenuByIndex" stepKey="clickSecondSwatch">
64+
<argument name="index" value="1"/>
65+
</actionGroup>
66+
<actionGroup ref="AdminAddPreviewImageSwatchOption" stepKey="addSecondOptionImage">
67+
<argument name="image" value="MagentoLogo"/>
68+
<argument name="index" value="2"/>
69+
</actionGroup>
70+
<actionGroup ref="AdminSwitchScopeForProductAttributeActionGroup" stepKey="switchScopeForProductAttribute"/>
71+
<actionGroup ref="ClickSaveButtonActionGroup" stepKey="clickSaveAttribute">
72+
<argument name="message" value="You saved the product attribute."/>
73+
</actionGroup>
74+
<!--Create configurations for product-->
75+
<amOnPage url="{{AdminProductEditPage.url($$createConfigProduct.id$$)}}" stepKey="goToProductEditPage"/>
76+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
77+
<actionGroup ref="StartCreateConfigurationsForAttribute" stepKey="createConfigurations">
78+
<argument name="attributeCode" value="{{VisualSwatchProductAttribute.attribute_code}}"/>
79+
</actionGroup>
80+
<actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionOne">
81+
<argument name="image" value="TestImageAdobe"/>
82+
<argument name="frontend_label" value="{{VisualSwatchProductAttribute.attribute_code}}"/>
83+
<argument name="label" value="{{visualSwatchOption1.default_label}}"/>
84+
</actionGroup>
85+
<actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionTwo">
86+
<argument name="image" value="ImageUpload3"/>
87+
<argument name="frontend_label" value="{{VisualSwatchProductAttribute.attribute_code}}"/>
88+
<argument name="label" value="{{visualSwatchOption2.default_label}}"/>
89+
</actionGroup>
90+
<actionGroup ref="GenerateAndSaveConfiguredProductAfterSettingOptions" stepKey="saveProductForm"/>
91+
</test>
92+
</tests>
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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="StorefrontImageColorWhenFilterByColorFilterTest">
12+
<annotations>
13+
<features value="Swatches"/>
14+
<stories value="Color image when filtering by color filter"/>
15+
<title value="Image color when filtering by color filter on the Storefront"/>
16+
<description value="Image color when filtering by color filter on the Storefront"/>
17+
<severity value="MAJOR"/>
18+
<useCaseId value="MC-18821"/>
19+
<testCaseId value="MC-11531"/>
20+
<group value="Swatches"/>
21+
</annotations>
22+
<before>
23+
<!--Create category and configurable product with two options-->
24+
<createData entity="ApiCategory" stepKey="createCategory"/>
25+
<createData entity="ApiConfigurableProduct" stepKey="createConfigProduct">
26+
<requiredEntity createDataKey="createCategory"/>
27+
</createData>
28+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
29+
</before>
30+
<after>
31+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
32+
<deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/>
33+
<actionGroup ref="deleteProductAttributeByLabel" stepKey="deleteAttribute">
34+
<argument name="ProductAttribute" value="visualSwatchAttribute"/>
35+
</actionGroup>
36+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/>
37+
<actionGroup ref="clearFiltersAdminDataGrid" stepKey="clearGridFilter"/>
38+
<actionGroup ref="adminDataGridSelectPerPage" stepKey="selectNumberOfProductsPerPage">
39+
<argument name="perPage" value="100"/>
40+
</actionGroup>
41+
<actionGroup ref="deleteProductsIfTheyExist" stepKey="deleteAllProducts"/>
42+
<actionGroup ref="logout" stepKey="logout"/>
43+
</after>
44+
<amOnPage url="{{AdminProductEditPage.url($$createConfigProduct.id$$)}}" stepKey="navigateToConfigProductPage"/>
45+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
46+
<!--Create visual swatch attribute-->
47+
<actionGroup ref="AddVisualSwatchWithProductWithStorefrontPreviewImageConfigActionGroup" stepKey="addSwatchToProduct">
48+
<argument name="attribute" value="visualSwatchAttribute"/>
49+
<argument name="option1" value="visualSwatchOption1"/>
50+
<argument name="option2" value="visualSwatchOption2"/>
51+
</actionGroup>
52+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickEditConfigurations"/>
53+
<see userInput="Select Attributes" selector="{{AdminProductFormConfigurationsSection.stepsWizardTitle}}" stepKey="seeStepTitle"/>
54+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/>
55+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/>
56+
<!--Add images to product attribute options-->
57+
<actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionOne">
58+
<argument name="image" value="MagentoLogo"/>
59+
<argument name="frontend_label" value="{{visualSwatchAttribute.default_label}}"/>
60+
<argument name="label" value="{{visualSwatchOption1.default_label}}"/>
61+
</actionGroup>
62+
<actionGroup ref="addUniqueImageToConfigurableProductOption" stepKey="addImageToConfigurableProductOptionTwo">
63+
<argument name="image" value="TestImageNew"/>
64+
<argument name="frontend_label" value="{{visualSwatchAttribute.default_label}}"/>
65+
<argument name="label" value="{{visualSwatchOption2.default_label}}"/>
66+
</actionGroup>
67+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton"/>
68+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnGenerateProductsButton"/>
69+
<actionGroup ref="saveProductForm" stepKey="saveProductForm"/>
70+
<!--Select any option in the Layered navigation and verify product image-->
71+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage"/>
72+
<actionGroup ref="SelectStorefrontSideBarAttributeOption" stepKey="selectStorefrontProductAttributeOption">
73+
<argument name="categoryName" value="$$createCategory.name$$"/>
74+
<argument name="attributeDefaultLabel" value="{{visualSwatchAttribute.default_label}}"/>
75+
</actionGroup>
76+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionByLabel(visualSwatchOption1.default_label)}}" stepKey="waitForOption"/>
77+
<click selector="{{StorefrontCategorySidebarSection.filterOptionByLabel(visualSwatchOption1.default_label)}}" stepKey="clickFirstOption"/>
78+
<grabAttributeFrom selector="{{StorefrontCategoryMainSection.productImage}}" userInput="src" stepKey="grabFirstOptionImg"/>
79+
<assertContains expectedType="string" expected="{{MagentoLogo.filename}}" actualType="variable" actual="$grabFirstOptionImg" stepKey="assertProductFirstOptionImage"/>
80+
<click selector="{{StorefrontCategorySidebarSection.removeFilter}}" stepKey="removeSideBarFilter"/>
81+
<actionGroup ref="SelectStorefrontSideBarAttributeOption" stepKey="selectStorefrontProductAttributeForSecondOption">
82+
<argument name="categoryName" value="$$createCategory.name$$"/>
83+
<argument name="attributeDefaultLabel" value="{{visualSwatchAttribute.default_label}}"/>
84+
</actionGroup>
85+
<waitForElementVisible selector="{{StorefrontCategorySidebarSection.filterOptionByLabel(visualSwatchOption2.default_label)}}" stepKey="waitForSecondOption"/>
86+
<click selector="{{StorefrontCategorySidebarSection.filterOptionByLabel(visualSwatchOption2.default_label)}}" stepKey="clickSecondOption"/>
87+
<grabAttributeFrom selector="{{StorefrontCategoryMainSection.productImage}}" userInput="src" stepKey="grabSecondOptionImg"/>
88+
<assertContains expectedType="string" expected="{{TestImageNew.filename}}" actualType="variable" actual="$grabSecondOptionImg" stepKey="assertProductSecondOptionImage"/>
89+
</test>
90+
</tests>

0 commit comments

Comments
 (0)