Skip to content

Commit deeba7d

Browse files
Sahil.kumarManjusha.S
authored andcommitted
MC-26654: Added all the required files to complete the code
1 parent 9b7477b commit deeba7d

File tree

4 files changed

+75
-39
lines changed

4 files changed

+75
-39
lines changed

app/code/Magento/Catalog/Test/Mftf/ActionGroup/CheckAdminProductGridColumnOptionActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
</arguments>
1818

1919
<checkOption selector="{{AdminProductGridFilterSection.viewColumnOption(optionName)}}" stepKey="checkColumn"/>
20+
<wait stepKey="waitPostClickingCheck" time="5"/>
2021
</actionGroup>
2122
</actionGroups>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,7 @@
7979
<element name="newCategoryButton" type="button" selector="button[data-index='create_category_button']" timeout="30"/>
8080
<element name="footerBlock" type="block" selector="//footer"/>
8181
<element name="categories" type="text" selector="//*[@class='admin__action-multiselect-crumb']/span[contains(text(), '{{categoryName}}')]" parameterized="true"/>
82+
<element name="attributeRequiredLabelText" type="text" selector="//*[@class='admin__field-label']//span[text()='{{attributeLabel}}']" parameterized="true"/>
83+
<element name="newAddedAttributeValue" type="text" selector="//option[contains(@data-title,'{{attributeValue}}')]" parameterized="true"/>
8284
</section>
8385
</sections>

app/code/Magento/Catalog/Test/Mftf/Test/AddNewProductAttributeInProductPageTest.xml

Lines changed: 66 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727

2828
</before>
2929
<after>
30-
<!--Delete created entity
31-
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/> -->
32-
33-
<!-- <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute">
34-
<argument name="ProductAttribute" value="newProductAttribute"/>
35-
</actionGroup> -->
30+
<!-- delete category -->
31+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
32+
<!-- delete created product attribute -->
33+
<actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute">
34+
<argument name="ProductAttribute" value="newProductAttribute"/>
35+
</actionGroup>
3636

3737
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
3838
</after>
@@ -48,72 +48,100 @@
4848
<argument name="categoryName" value="$createCategory.name$"/>
4949
</actionGroup>
5050

51-
<!-- Step 6 -->
52-
<click selector="{{AdminProductFormSection.addAttributeBtn}}" stepKey="clickOnAddAttribute"/>
53-
<waitForPageLoad stepKey="waitForAttributePageToLoad"/>
54-
<click selector="{{AdminProductFormSection.createNewAttributeBtn}}" stepKey="clickCreateNewAttributeButton"/>
55-
<waitForPageLoad stepKey="waitForNewAttributePageToLoad"/>
56-
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" stepKey="waitForDefaultLabelToBeVisible"/>
57-
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="fillAttributeLabel"/>
58-
<selectOption selector="{{AdminCreateNewProductAttributeSection.inputType}}" userInput="Dropdown" stepKey="selectInputType"/>
59-
<checkOption selector="{{AdminCreateNewProductAttributeSection.isRequired}}" stepKey="enableIsRequiredOption"/>
51+
<!-- Create New Product Attribute -->
52+
<actionGroup ref="AdminStartCreateProductAttributeOnProductPageActionGroup" stepKey="createDropdownAttribute">
53+
<argument name="attributeCode" value="{{newProductAttribute.attribute_code}}" />
54+
<argument name="attributeLabel" value="{{ProductAttributeFrontendLabel.label}}" />
55+
<argument name="inputType" value="Dropdown" />
56+
</actionGroup>
6057

58+
59+
<checkOption selector="{{AdminCreateNewProductAttributeSection.isRequired}}" stepKey="enableIsRequiredOption"/>
6160
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible"/>
6261
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton"/>
62+
63+
<!-- Adding the values in the grid -->
6364
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" stepKey="waitForDefaultStoreViewToVisible"/>
6465
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('0')}}" userInput="value 1" stepKey="fillDefaultStoreView"/>
6566
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('0')}}" userInput="value 1 admin" stepKey="fillAdminField"/>
6667
<checkOption selector="{{AdminCreateNewProductAttributeSection.defaultRadioButton('1')}}" stepKey="selectRadioButton"/>
67-
6868
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="waitForAddValueButtonToVisible2"/>
6969
<click selector="{{AdminCreateNewProductAttributeSection.addValue}}" stepKey="clickOnAddValueButton2"/>
7070
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" stepKey="waitForDefaultStoreViewToVisible2"/>
7171
<fillField selector="{{AdminCreateNewProductAttributeSection.defaultStoreView('1')}}" userInput="value 2" stepKey="fillDefaultStoreView2"/>
7272
<fillField selector="{{AdminCreateNewProductAttributeSection.adminOption('1')}}" userInput="value 2 admin" stepKey="fillAdminField2"/>
7373

74-
75-
76-
<click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties"/>
77-
<waitForElementVisible selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="waitForAttributeCodeToVisible"/>
78-
<scrollTo selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" stepKey="scrollToAttributeCode"/>
79-
<fillField selector="{{AdminCreateNewProductAttributeSection.attributeCode}}" userInput="{{newProductAttribute.attribute_code}}" stepKey="fillAttributeCode"/>
80-
81-
<scrollTo selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="scrollToAdvancedAttributeProperties"/>
82-
<click selector="{{AdminCreateNewProductAttributeSection.advancedAttributeProperties}}" stepKey="clickOnAdvancedAttributeProperties1"/>
74+
<!-- Adding the values to the storefront properties -->
8375
<scrollTo selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="scrollToStorefrontProperties"/>
8476
<click selector="{{AdminCreateNewProductAttributeSection.storefrontProperties}}" stepKey="clickOnStorefrontProperties"/>
8577
<waitForPageLoad stepKey="waitForStoreFrontToLoad"/>
86-
87-
8878
<scrollTo stepKey="scroll1" selector="{{AdminCreateNewProductAttributeSection.sortProductListing}}" x="0" y="-80"/>
8979
<checkOption selector="{{AdminCreateNewProductAttributeSection.inSearch}}" stepKey="enableInSearchOption"/>
9080
<checkOption selector="{{AdminCreateNewProductAttributeSection.advancedSearch}}" stepKey="enableAdvancedSearch"/>
9181
<checkOption selector="{{AdminCreateNewProductAttributeSection.isComparable}}" stepKey="enableIsUComparableption"/>
9282

93-
<!-- Step 7 -->
83+
<!-- Save created Attribute -->
9484
<click selector="{{AdminCreateNewProductAttributeSection.saveAttribute}}" stepKey="clickOnSaveAttribute"/>
9585
<waitForPageLoad stepKey="waitForAttributeToSave"/>
9686

97-
98-
<!--Step 8: Verify product attribute added in product form -->
99-
<!-- <actionGroup ref="AdminAssertProductAttributeOnProductEditPageActionGroup" stepKey="adminProductAssertAttribute">
100-
<argument name="attributeLabel" value="{{ProductAttributeFrontendLabel.label}}"/>
101-
<argument name="attributeCode" value="{{newProductAttribute.attribute_code}}"/>
102-
</actionGroup> -->
103-
104-
87+
<!-- Verify product attribute added in product form -->
10588
<scrollTo selector="{{AdminProductFormSection.contentTab}}" stepKey="scrollToContentTab"/>
10689
<waitForElementVisible selector="{{AdminProductFormSection.attributeTab}}" stepKey="waitForAttributeToVisible"/>
10790
<click selector="{{AdminProductFormSection.attributeTab}}" stepKey="clickOnAttribute"/>
108-
<seeElement selector="{{AdminProductFormSection.attributeLabelByText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/>
109-
<seeElement selector="{{AdminProductFormSection.newAddedAttribute(newProductAttribute.attribute_code)}}" stepKey="seeAttributeCodeInProductForm"/>
91+
<seeElement selector="{{AdminProductFormSection.attributeRequiredLabelText(ProductAttributeFrontendLabel.label)}}" stepKey="seeAttributeLabelInProductForm"/>
92+
<seeElement selector="{{AdminProductFormSection.newAddedAttributeValue('value 1 admin')}}" stepKey="seeAttributeValue"/>
11093

94+
<!-- Save a Product -->
11195
<actionGroup ref="AdminProductFormSaveButtonClickActionGroup" stepKey="saveTheProduct"/>
11296
<see selector="{{AdminCategoryMessagesSection.SuccessMessage}}" userInput="You saved the product." stepKey="messageYouSavedTheProductIsShown"/>
11397

98+
<!--Click on Go Back button -->
99+
<click selector="{{AdminProductFormActionSection.backButton}}" stepKey="clickBackToGridSimple"/>
114100

101+
<!-- Select created attribute as an column -->
102+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="openColumnsDropdown"/>
103+
<actionGroup ref="CheckAdminProductGridColumnOptionActionGroup" stepKey="checkCreatedAttributeColumn">
104+
<argument name="optionName" value="{{ProductAttributeFrontendLabel.label}}"/>
105+
</actionGroup>
106+
<actionGroup ref="ToggleAdminProductGridColumnsDropdownActionGroup" stepKey="closeColumnsDropdown"/>
107+
108+
<!-- Asserting the value of the created column -->
109+
<actionGroup ref="AssertAdminProductGridCellActionGroup" stepKey="seeCreatedAttributeColumn">
110+
<argument name="row" value="1"/>
111+
<argument name="column" value="{{ProductAttributeFrontendLabel.label}}"/>
112+
<argument name="value" value="value 1 admin"/>
113+
</actionGroup>
115114

115+
<!--Verify Product Attribute is present in Category Store Front Page -->
116+
<amOnPage url="$$createCategory.custom_attributes[url_key]$$.html" stepKey="goToStorefrontPage"/>
117+
<waitForPageLoad stepKey="waitForProductFrontPageToLoad"/>
118+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategory"/>
119+
<waitForPageLoad stepKey="waitForCategoryPageToLoad"/>
120+
<click selector="{{StorefrontCategoryMainSection.productLink}}" stepKey="openSearchedProduct"/>
121+
<waitForPageLoad stepKey="waitForProductToLoad1"/>
122+
<scrollTo selector="{{StorefrontProductMoreInformationSection.moreInformationTextArea}}" stepKey="scrollToMoreInformation"/>
123+
<see selector="{{StorefrontProductMoreInformationSection.attributeLabel}}" userInput="{{ProductAttributeFrontendLabel.label}}" stepKey="seeAttributeLabel"/>
124+
<see selector="{{StorefrontProductMoreInformationSection.attributeValue}}" userInput="value 1" stepKey="seeAttributeValueOnStorefront"/>
125+
126+
<!-- Return to catgeory page to assert the layered navigation -->
127+
<click selector="{{StorefrontHeaderSection.NavigationCategoryByName(SimpleSubCategory.name)}}" stepKey="clickOnCategoryAgain"/>
128+
<waitForPageLoad stepKey="waitForCategoryPageToLoad2"/>
129+
<fillField selector="{{StorefrontQuickSearchResultsSection.searchTextBox}}" userInput="{{SimpleProduct.name}}" stepKey="fillProductName"/>
130+
<waitForPageLoad stepKey="waitForSearchButtonEnabled"/>
131+
<click selector="{{StorefrontQuickSearchResultsSection.searchTextBoxButton}}" stepKey="clickSearchTextBoxButton"/>
132+
133+
<!-- Assert that attribute values present in layered navigation -->
134+
<actionGroup ref="AssertStorefrontAttributeOptionPresentInLayeredNavigationActionGroup" stepKey="assertAttributeWithOptionInLayeredNavigation">
135+
<argument name="attributeLabel" value="{{ProductAttributeFrontendLabel.label}}"/>
136+
<argument name="attributeOptionLabel" value="value 11"/>
137+
</actionGroup>
116138

139+
<!-- Click on the attribute -->
140+
<click selector="{{StorefrontLayeredNavigationSection.shoppingOptionsExpanded('value 1')}}" stepKey="clickOnAttributeValue"/>
141+
<seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingBy}}" stepKey="seeNowShoppingBy"/>
142+
<seeElement selector="{{StorefrontLayeredNavigationSection.actionRemove}}" stepKey="seeX"/>
143+
<seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingByAttribute(ProductAttributeFrontendLabel.label)}}" stepKey="seeNowShoppingByAttribute"/>
144+
<seeElement selector="{{StorefrontLayeredNavigationSection.nowShoppingByAttributeValue('value 1')}}" stepKey="seeNowShoppingByAttributeValue"/>
117145

118146
</test>
119147
</tests>

app/code/Magento/LayeredNavigation/Test/Mftf/Section/LayeredNavigationSection/StorefrontLayeredNavigationSection.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@
66
*/
77
-->
88
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9-
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
1010
<section name="StorefrontLayeredNavigationSection">
1111
<element name="shoppingOptionsByName" type="button" selector="//*[text()='Shopping Options']/..//*[contains(text(),'{{arg}}')]" parameterized="true"/>
1212
<element name="appliedFilterLabel" type="text" selector=".filter-current .items > li.item:nth-of-type({{position}}) > span.filter-label" parameterized="true"/>
1313
<element name="appliedFilterValue" type="text" selector=".filter-current .items > li.item:nth-of-type({{position}}) > span.filter-value" parameterized="true"/>
14+
<element name="shoppingOptionsExpanded" type="button" selector="//a[@rel='nofollow' and contains(text(),'{{var}}')]" parameterized="true"/>
15+
<element name="nowShoppingBy" type="text" selector="//strong[@class='block-subtitle filter-current-subtitle']"/>
16+
<element name="actionRemove" type="button" selector="//a[@class='action remove']" />
17+
<element name="nowShoppingByAttribute" type="text" selector="//span[@class='filter-label' and contains(text(),'{{var}}')]" parameterized="true"/>
18+
<element name="nowShoppingByAttributeValue" type="text" selector="//span[@class='filter-value' and contains(text(),'{{var}}')]" parameterized="true"/>
1419
</section>
1520
</sections>

0 commit comments

Comments
 (0)