Skip to content

Commit 557a506

Browse files
Manjusha.SManjusha.S
authored andcommitted
Merge branch 'ACQE-4365' into functional-testing-automation
2 parents 237553e + 5f7c50b commit 557a506

File tree

4 files changed

+178
-0
lines changed

4 files changed

+178
-0
lines changed
Lines changed: 28 additions & 0 deletions
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="DeleteProductAttributeByCodeActionGroup">
12+
<annotations>
13+
<description>Delete a Product Attribute from the Product Attribute creation/edit page by code.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="attribute_code" type="string"/>
17+
</arguments>
18+
<amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttributeGrid"/>
19+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clearExistingFilters"/>
20+
<fillField selector="{{AdminProductAttributeGridSection.FilterByAttributeCode}}" userInput="{{attribute_code}}" stepKey="setAttributeCode"/>
21+
<click selector="{{AdminProductAttributeGridSection.Search}}" stepKey="searchForAttributeFromTheGrid"/>
22+
<click selector="{{AdminProductAttributeGridSection.FirstRow}}" stepKey="clickOnAttributeRow"/>
23+
<waitForPageLoad stepKey="waitForViewAdminProductAttributeLoad" time="30"/>
24+
<click selector="{{AttributePropertiesSection.DeleteAttribute}}" stepKey="deleteAttribute"/>
25+
<click selector="{{ModalConfirmationSection.OkButton}}" stepKey="clickOnConfirmOk"/>
26+
<waitForPageLoad stepKey="waitForViewProductAttributePageLoad"/>
27+
</actionGroup>
28+
</actionGroups>

app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminCreateProductConfigurationsPanelSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,6 @@
6161
<element name="attributeColorCheckbox" type="select" selector="//div[contains(text(),'color') and @class='data-grid-cell-content']/../preceding-sibling::td/label/input"/>
6262
<element name="attributeRowByAttributeCode" type="block" selector="//td[count(../../..//th[./*[.='Attribute Code']]/preceding-sibling::th) + 1][./*[.='{{attribute_code}}']]/../td//input[@data-action='select-row']" parameterized="true"/>
6363
<element name="qtyForColorAttribute" type="text" selector="//span[text()='{{var1}}']/../..//input[@type='text']" parameterized="true"/>
64+
<element name="configProductName" type="text" selector="//table[@class='data-grid data-grid-configurable']//tbody//tr[{{row}}]//td[2]//span" parameterized="true"/>
6465
</section>
6566
</sections>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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="SpecialPriceForConfigurableProductBasedOnVisualSwatchAttributeTest">
12+
<annotations>
13+
<features value="ConfigurableProduct"/>
14+
<stories value="Special price for configurable product based on visual swatch attribute"/>
15+
<title value="Special price for configurable product based on visual swatch attribute"/>
16+
<description value="Special price for configurable product based on visual swatch attribute"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-4385"/>
19+
<group value="catalog"/>
20+
<group value="configurableProduct"/>
21+
<group value="swatch"/>
22+
</annotations>
23+
24+
<before>
25+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
26+
</before>
27+
28+
<after>
29+
<actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProductsWithAllVariations">
30+
<argument name="product" value="BaseConfigurableProduct"/>
31+
</actionGroup>
32+
<!-- Delete attribute -->
33+
34+
<actionGroup ref="DeleteProductAttributeByCodeActionGroup" stepKey="deleteProductAttributeByCode">
35+
<argument name="attribute_code" value="{{ProductAttributeFrontendLabel.label}}"/>
36+
</actionGroup>
37+
<actionGroup ref="CliIndexerReindexActionGroup" stepKey="reindex">
38+
<argument name="indices" value=""/>
39+
</actionGroup>
40+
<actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/>
41+
</after>
42+
43+
<!-- Step1 Create Visual Swatch attribute -->
44+
<actionGroup ref="AdminNavigateToNewProductAttributePageActionGroup" stepKey="goToNewProductAttributePage"/>
45+
<fillField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillDefaultLabel"/>
46+
<selectOption selector="{{AttributePropertiesSection.InputType}}" userInput="swatch_text" stepKey="selectInputType"/>
47+
<click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch0"/>
48+
<fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('0')}}" userInput="red" stepKey="fillSwatch0"/>
49+
<fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('0')}}" userInput="CodeRed" stepKey="fillDescription0"/>
50+
<click selector="{{AdminManageSwatchSection.addSwatchText}}" stepKey="clickAddSwatch1"/>
51+
<fillField selector="{{AdminManageSwatchSection.swatchTextByIndex('1')}}" userInput="green" stepKey="fillSwatch1"/>
52+
<fillField selector="{{AdminManageSwatchSection.swatchAdminDescriptionByIndex('1')}}" userInput="CodeGreen" stepKey="fillDescription1"/>
53+
<click selector="{{AttributePropertiesSection.AdvancedProperties}}" stepKey="expandAdvancedProperties"/>
54+
<selectOption selector="{{AttributePropertiesSection.Scope}}" userInput="1" stepKey="selectGlobalScope"/>
55+
<!-- Save and verify -->
56+
<click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSave"/>
57+
<seeInField selector="{{AttributePropertiesSection.DefaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeDefaultLabel"/>
58+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchText('1')}}" userInput="red" stepKey="seeSwatch0"/>
59+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('1')}}" userInput="CodeRed" stepKey="seeDescription0"/>
60+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchText('2')}}" userInput="green" stepKey="seeSwatch1"/>
61+
<seeInField selector="{{AdminManageSwatchSection.nthSwatchAdminDescription('2')}}" userInput="CodeGreen" stepKey="seeDescription1"/>
62+
63+
<!-- Step 2 Create a configurable product to verify the storefront with -->
64+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="amOnProductGridPage"/>
65+
<actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateConfigurableProduct">
66+
<argument name="product" value="BaseConfigurableProduct"/>
67+
</actionGroup>
68+
<click selector="{{AdminProductSEOSection.sectionHeader}}" stepKey="openSeoSection"/>
69+
<fillField userInput="{{_defaultProduct.urlKey}}" selector="{{AdminProductSEOSection.urlKeyInput}}" stepKey="fillUrlKey"/>
70+
<actionGroup ref="FillMainProductFormActionGroup" stepKey="fillProductForm">
71+
<argument name="product" value="BaseConfigurableProduct"/>
72+
</actionGroup>
73+
74+
<!-- Create configurations based off the Text Swatch we created earlier -->
75+
<click selector="{{AdminProductFormConfigurationsSection.createConfigurations}}" stepKey="clickCreateConfigurations"/>
76+
<click selector="{{AdminCreateProductConfigurationsPanel.filters}}" stepKey="clickFilters"/>
77+
<fillField selector="{{AdminCreateProductConfigurationsPanel.attributeCode}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillFilterAttributeCodeField"/>
78+
<click selector="{{AdminCreateProductConfigurationsPanel.applyFilters}}" stepKey="clickApplyFiltersButton"/>
79+
<click selector="{{AdminCreateProductConfigurationsPanel.firstCheckbox}}" stepKey="clickOnFirstCheckbox"/>
80+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton1"/>
81+
<click selector="{{AdminCreateProductConfigurationsPanel.selectAll}}" stepKey="clickOnSelectAll"/>
82+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton2"/>
83+
<click selector="{{AdminCreateProductConfigurationsPanel.applySingleQuantityToEachSkus}}" stepKey="clickOnApplySingleQuantityToEachSku"/>
84+
<fillField selector="{{AdminCreateProductConfigurationsPanel.quantity}}" userInput="1" stepKey="enterAttributeQuantity"/>
85+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton3"/>
86+
<grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.configProductName('1')}}" stepKey="grabRedConfigProdName"/>
87+
<grabTextFrom selector="{{AdminCreateProductConfigurationsPanel.configProductName('2')}}" stepKey="grabGreenConfigProdName"/>
88+
89+
<click selector="{{AdminCreateProductConfigurationsPanel.next}}" stepKey="clickOnNextButton4"/>
90+
<click selector="{{AdminProductFormActionSection.saveButton}}" stepKey="clickOnSaveButton2"/>
91+
<click selector="{{AdminChooseAffectedAttributeSetPopup.confirm}}" stepKey="clickOnConfirmInPopup"/>
92+
93+
<!-- Step 3 Set the special price here for red product -->
94+
<actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndex"/>
95+
<actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfPresent"/>
96+
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
97+
<fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{$grabRedConfigProdName}" stepKey="fillKeywordSearchField"/>
98+
<click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="clickKeywordSearch"/>
99+
<waitForPageLoad stepKey="waitForProductSearch"/>
100+
<click selector="{{AdminProductGridSection.selectRowBasedOnName({$grabRedConfigProdName})}}" stepKey="selectProductToEditForSpecialPrice"/>
101+
<waitForPageLoad stepKey="waitForProductEditPageToLoad"/>
102+
<actionGroup ref="AddSpecialPriceToProductActionGroup" stepKey="addSpecialPriceTopTheProduct">
103+
<argument name="price" value="10"/>
104+
</actionGroup>
105+
<click selector="{{AdminProductFormAdvancedPricingSection.save}}" stepKey="clickSaveProduct"/>
106+
<waitForPageLoad time='30' stepKey="waitForChildConfigProductToBeSaved"/>
107+
<waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSaveSuccessMessagePostSpecialPrice"/>
108+
109+
<!-- Step 4 Go to the product page and see text swatch options -->
110+
<amOnPage url="{{_defaultProduct.urlKey}}.html" stepKey="amOnProductPage"/>
111+
<waitForPageLoad stepKey="waitForProductPage"/>
112+
<see selector="{{StorefrontProductInfoMainSection.swatchAttributeOptions}}" userInput="red" stepKey="seeRed"/>
113+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOptionText('1')}}" userInput="data-option-label" stepKey="grabRedLabel"/>
114+
<assertEquals stepKey="assertRedLabel">
115+
<expectedResult type="string">CodeRed</expectedResult>
116+
<actualResult type="string">{$grabRedLabel}</actualResult>
117+
</assertEquals>
118+
<see selector="{{StorefrontProductInfoMainSection.swatchAttributeOptions}}" userInput="green" stepKey="seeGreen"/>
119+
<grabAttributeFrom selector="{{StorefrontProductInfoMainSection.nthSwatchOptionText('2')}}" userInput="data-option-label" stepKey="grabGreenLabel"/>
120+
<assertEquals stepKey="assertGreenLabel">
121+
<expectedResult type="string">CodeGreen</expectedResult>
122+
<actualResult type="string">{$grabGreenLabel}</actualResult>
123+
</assertEquals>
124+
125+
<!-- Step 5 Open Configurable product with special price -->
126+
<click selector="{{StorefrontProductInfoMainSection.visualSwatchOptionText('red')}}" stepKey="clickRedProduct"/>
127+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.specialPriceAmount}}" stepKey="specialPriceAmount"/>
128+
<assertEquals stepKey="assertSpecialPriceTextOnProductPage">
129+
<expectedResult type="string">$10.00</expectedResult>
130+
<actualResult type="variable">specialPriceAmount</actualResult>
131+
</assertEquals>
132+
<seeElement selector="{{StorefrontProductInfoMainSection.oldPriceTag}}" stepKey="verifyRegulaPriceTag"/>
133+
<!-- Verify customer see product old price on the storefront page for red product -->
134+
<grabTextFrom selector="{{StorefrontProductInfoMainSection.oldPriceAmount}}" stepKey="oldPriceAmount"/>
135+
<assertEquals stepKey="assertOldPriceTextOnProductPage">
136+
<expectedResult type="string">$123.00</expectedResult>
137+
<actualResult type="variable">oldPriceAmount</actualResult>
138+
</assertEquals>
139+
140+
<!-- Step 6 Open green Configurable product without special price -->
141+
<click selector="{{StorefrontProductInfoMainSection.visualSwatchOptionText('green')}}" stepKey="clickGreenProduct"/>
142+
<see userInput="$123.00" selector="{{StorefrontProductInfoMainSection.productPrice}}" stepKey="assertProductPrice"/>
143+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.oldPriceTag}}" stepKey="verifyRegularPriceTagIsNotPresent"/>
144+
<dontSeeElement selector="{{StorefrontProductInfoMainSection.specialPriceAmount}}" stepKey="verifySpecialPriceIsNotPresent"/>
145+
</test>
146+
</tests>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1111
<section name="AdminManageSwatchSection">
1212
<element name="adminInputByIndex" type="input" selector="optionvisual[value][option_{{var}}][0]" parameterized="true"/>
13+
<element name="adminInputSwatchValues" type="input" selector="optionvisual[value][option_{{row_val}}][{{col_val}}]" parameterized="true"/>
14+
<element name="adminInputSwatchValuesStore" type="input" selector="//td[@class='swatch-col-option_{{row}}'][{{col}}]//input" parameterized="true"/>
15+
<element name="swatchOptionWindow" type="button" selector="//div[@id='swatch_window_option_option_{{row}}']" timeout="30" parameterized="true"/>
1316
<element name="addSwatch" type="button" selector="#add_new_swatch_visual_option_button" timeout="30"/>
1417
<element name="nthSwatch" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_window" parameterized="true"/>
1518
<element name="addSwatchText" type="button" selector="#add_new_swatch_text_option_button"/>

0 commit comments

Comments
 (0)