Skip to content

Commit 01c0041

Browse files
committed
ACQE-8211: Validate admin dashboard for most viewed products and Disabled Charts
- New automation Testfile and Actiongroup are added
1 parent a20a6ff commit 01c0041

File tree

4 files changed

+188
-0
lines changed

4 files changed

+188
-0
lines changed

app/code/Magento/Backend/Test/Mftf/Data/AdminMenuData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<data key="pageTitle">Dashboard</data>
2323
<data key="title">Dashboard</data>
2424
<data key="dataUiId">magento-backend-dashboard</data>
25+
<data key="message">Chart is disabled</data>
2526
</entity>
2627
<entity name="AdminMenuStores">
2728
<data key="pageTitle">Stores</data>

app/code/Magento/Backend/Test/Mftf/Section/AdminDashboardSection.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,14 @@
1919
<element name="dashboardTotals" type="text" selector="//*[@class='dashboard-totals-label' and contains(text(), '{{columnName}}')]/../*[@class='dashboard-totals-value']" parameterized="true"/>
2020
<element name="productInBestsellers" type="text" selector="#productsOrderedGrid_table td.col-product.col-name"/>
2121
<element name="dashboardButtonReloadData" type="button" selector=".action-primary[title='Reload Data'][type='submit']"/>
22+
<element name="productTab" type="button" selector="//*[@class='data-grid-th no-link col-name']" timeout="30"/>
23+
<element name="priceTab" type="button" selector="//*[@class='data-grid-th no-link col-price']" timeout="30"/>
24+
<element name="viewsTab" type="button" selector="//*[@class='data-grid-th col-views no-link col-views']" timeout="30"/>
25+
<element name="productName" type="text" selector="//td[contains(text(), '{{columnName}}')]" parameterized="true"/>
26+
<element name="productPrice" type="input" selector="//td[contains(text(), '{{productName}}')]//ancestor::td/following-sibling::td[contains(@class,' col-price a-right ')]" parameterized="true"/>
27+
<element name="productViews" type="input" selector="//td[contains(text(), '{{productName}}')]//ancestor::td/following-sibling::td[contains(@class,' col-views col-views last')]" parameterized="true"/>
28+
<element name="mostViewProductsTab" type="button" selector="//*[contains(@class, 'ui-state-default ui-corner-top') and contains(@aria-labelledby, 'grid_tab_reviewed_products')]" timeout="30"/>
29+
<element name="dashboardChart" type="text" selector="//*[@class='dashboard-diagram-disabled' and contains(text(), '{{columnName}}')]" parameterized="true"/>
2230
</section>
2331
</sections>
32+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<!--Click save button and see message-->
11+
<actionGroup name="AdminVerifyProductDetailsInDashboardActionGroup">
12+
<annotations>
13+
<description>Admin Asserts Details including Price and Views in Dashboard page.</description>
14+
</annotations>
15+
<arguments>
16+
<argument name="productName" type="string" defaultValue="$$createProduct.name$$"/>
17+
<argument name="productPrice" type="string" defaultValue=""/>
18+
<argument name="productViews" type="string" defaultValue=""/>
19+
</arguments>
20+
<waitForElementVisible selector="{{AdminDashboardSection.productTab}}" stepKey="waitForProductColumnToBeVisible"/>
21+
<waitForElementVisible selector="{{AdminDashboardSection.priceTab}}" stepKey="waitForPriceColumnToBeVisible"/>
22+
<waitForElementVisible selector="{{AdminDashboardSection.viewsTab}}" stepKey="waitForViewColumnToBeVisible"/>
23+
<waitForElementVisible selector="{{AdminDashboardSection.productName(productName)}}" stepKey="assertProductSkuInLineItem"/>
24+
<waitForText selector="{{AdminDashboardSection.productPrice(productName)}}" userInput="{{productPrice}}" stepKey="assertProductPrice"/>
25+
<waitForText selector="{{AdminDashboardSection.productViews(productName)}}" userInput="{{productViews}}" stepKey="assertProductViews"/>
26+
</actionGroup>
27+
</actionGroups>
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright 2025 Adobe
5+
* All Rights Reserved.
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="AdminVerifyMostViewProductsAndDisabledChartInDashBoardTest">
12+
<annotations>
13+
<features value="Sales"/>
14+
<stories value="Most Viewed Products Widget and Disabled Charts On Dashboard"/>
15+
<title value="Validating Most Viewed Products Widget and Disabled Charts Behaviour On Admin Dashboard Page"/>
16+
<description value="Admin Verifies Most View Products as well as Disables Chart Behaviour On Admin Dashboard Page"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="AC-11007"/>
19+
<group value="sales"/>
20+
</annotations>
21+
<before>
22+
<!-- Precondition Step 1. Create 5 Simple Products -->
23+
<createData entity="_defaultProduct" stepKey="createProduct">
24+
<field key="price">100.00</field>
25+
</createData>
26+
<createData entity="defaultSimpleProduct" stepKey="createSimpleProduct">
27+
<field key="price">200.00</field>
28+
</createData>
29+
<createData entity="SimpleProduct" stepKey="createFirstProduct">
30+
<field key="price">300.00</field>
31+
</createData>
32+
<createData entity="SimpleProduct2" stepKey="createSecondProduct">
33+
<field key="price">400.00</field>
34+
</createData>
35+
<createData entity="SimpleProduct3" stepKey="createThirdProduct">
36+
<field key="price">500.00</field>
37+
</createData>
38+
<!-- Precondition Step 2. Create Customer -->
39+
<createData entity="Simple_US_CA_Customer" stepKey="createCustomer"/>
40+
<!-- Precondition Step 3. Enable View Report In Configuration -->
41+
<magentoCLI command="config:set reports/options/enabled 1" stepKey="setReportAsEnable"/>
42+
</before>
43+
<after>
44+
<!-- Delete Customer and Product -->
45+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
46+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
47+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
48+
<deleteData createDataKey="createThirdProduct" stepKey="deleteThirdProduct"/>
49+
<deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/>
50+
<deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/>
51+
<!-- Disable View Report -->
52+
<magentoCLI command="config:set reports/options/enabled 0" stepKey="disableReportModule"/>
53+
<!-- Logout from Storefront -->
54+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/>
55+
<!-- Logout from Admin -->
56+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
57+
</after>
58+
<!--Step 1: Login To Storefront -->
59+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginAsCustomer">
60+
<argument name="Customer" value="$$createCustomer$$"/>
61+
</actionGroup>
62+
<!--Step 2: View All 5 Products -->
63+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage">
64+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
65+
</actionGroup>
66+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPageFirst">
67+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
68+
</actionGroup>
69+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPageSecond">
70+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
71+
</actionGroup>
72+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPageThird">
73+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
74+
</actionGroup>
75+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPageForth">
76+
<argument name="productUrlKey" value="$$createProduct.custom_attributes[url_key]$$"/>
77+
</actionGroup>
78+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToProductPage1">
79+
<argument name="productUrlKey" value="$$createSimpleProduct.custom_attributes[url_key]$$"/>
80+
</actionGroup>
81+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToSimpleProductPage1">
82+
<argument name="productUrlKey" value="$$createSimpleProduct.custom_attributes[url_key]$$"/>
83+
</actionGroup>
84+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToSimpleProductPage2">
85+
<argument name="productUrlKey" value="$$createSimpleProduct.custom_attributes[url_key]$$"/>
86+
</actionGroup>
87+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToSimpleProductPage3">
88+
<argument name="productUrlKey" value="$$createSimpleProduct.custom_attributes[url_key]$$"/>
89+
</actionGroup>
90+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToFirstProductPage1">
91+
<argument name="productUrlKey" value="$$createFirstProduct.custom_attributes[url_key]$$"/>
92+
</actionGroup>
93+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToFirstProductPage2">
94+
<argument name="productUrlKey" value="$$createFirstProduct.custom_attributes[url_key]$$"/>
95+
</actionGroup>
96+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToFirstProductPage3">
97+
<argument name="productUrlKey" value="$$createFirstProduct.custom_attributes[url_key]$$"/>
98+
</actionGroup>
99+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToSecondProductPage1">
100+
<argument name="productUrlKey" value="$$createSecondProduct.custom_attributes[url_key]$$"/>
101+
</actionGroup>
102+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToSecondProductPage2">
103+
<argument name="productUrlKey" value="$$createSecondProduct.custom_attributes[url_key]$$"/>
104+
</actionGroup>
105+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToSecondProductPage3">
106+
<argument name="productUrlKey" value="$$createSecondProduct.custom_attributes[url_key]$$"/>
107+
</actionGroup>
108+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToThirdProductPage">
109+
<argument name="productUrlKey" value="$$createThirdProduct.custom_attributes[url_key]$$"/>
110+
</actionGroup>
111+
<actionGroup ref="OpenStoreFrontProductPageActionGroup" stepKey="goToThirdProductPage1">
112+
<argument name="productUrlKey" value="$$createThirdProduct.custom_attributes[url_key]$$"/>
113+
</actionGroup>
114+
<!--Step 3: Login as Admin -->
115+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
116+
<waitForPageLoad stepKey="waitForPageLoad"/>
117+
<!--Step 4: Go To Admin Dash Board Page -->
118+
<actionGroup ref="AdminOpenDashboardPageActionGroup" stepKey="goToAdminDashboard"/>
119+
<!--Step 5: Click On Most Viewed Product -->
120+
<waitForElementClickable selector="{{AdminDashboardSection.mostViewProductsTab}}" stepKey="waitForMostViewProductsToBeClickable"/>
121+
<click selector="{{AdminDashboardSection.mostViewProductsTab}}" stepKey="clickOnMostViewProductsTab"/>
122+
<!--Step 6: Verify all 5 Product details In Most View Products Tab -->
123+
<actionGroup ref="AdminVerifyProductDetailsInDashboardActionGroup" stepKey="adminAssertProductDetails">
124+
<argument name="productName" value="$$createProduct.name$$"/>
125+
<argument name="productPrice" value="$$createProduct.price$$"/>
126+
<argument name="productViews" value="5"/>
127+
</actionGroup>
128+
<actionGroup ref="AdminVerifyProductDetailsInDashboardActionGroup" stepKey="adminAssertProductDetails1">
129+
<argument name="productName" value="$$createSimpleProduct.name$$"/>
130+
<argument name="productPrice" value="$$createSimpleProduct.price$$"/>
131+
<argument name="productViews" value="4"/>
132+
</actionGroup>
133+
<actionGroup ref="AdminVerifyProductDetailsInDashboardActionGroup" stepKey="adminAssertProductDetails2">
134+
<argument name="productName" value="$$createFirstProduct.name$$"/>
135+
<argument name="productPrice" value="$$createFirstProduct.price$$"/>
136+
<argument name="productViews" value="3"/>
137+
</actionGroup>
138+
<actionGroup ref="AdminVerifyProductDetailsInDashboardActionGroup" stepKey="adminAssertProductDetails3">
139+
<argument name="productName" value="$$createSecondProduct.name$$"/>
140+
<argument name="productPrice" value="$$createSecondProduct.price$$"/>
141+
<argument name="productViews" value="3"/>
142+
</actionGroup>
143+
<actionGroup ref="AdminVerifyProductDetailsInDashboardActionGroup" stepKey="adminAssertProductDetails4">
144+
<argument name="productName" value="$$createThirdProduct.name$$"/>
145+
<argument name="productPrice" value="$$createThirdProduct.price$$"/>
146+
<argument name="productViews" value="2"/>
147+
</actionGroup>
148+
<!--Step 7: Disable charts on dashboard by default -->
149+
<waitForElementVisible selector="{{AdminDashboardSection.dashboardChart(AdminMenuDashboard.message)}}" stepKey="waitForChartsToBeVisibleAsDisabled"/>
150+
</test>
151+
</tests>

0 commit comments

Comments
 (0)