Skip to content

Commit eb81913

Browse files
MAGETWO-98584: Google chart API used by Magento dashboard scheduled to be turned off
- Add functional test.
1 parent cc5ca3f commit eb81913

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
11+
<section name="AdminDashboardSection">
12+
<element name="dashboardDiagramContent" type="button" selector="#diagram_tab_content"/>
13+
<element name="dashboardDiagramOrderContentTab" type="block" selector="#diagram_tab_orders_content"/>
14+
<element name="dashboardDiagramAmounts" type="button" selector="#diagram_tab_amounts"/>
15+
<element name="dashboardDiagramAmountsContentTab" type="block" selector="#diagram_tab_amounts_content"/>
16+
<element name="dashboardDiagramTotals" type="text" selector="#diagram_tab_amounts_content"/>
17+
<element name="dashboardTotals" type="text" selector="//*[@class='dashboard-totals-label' and contains(text(), '{{columnName}}')]/../*[@class='dashboard-totals-value']" parameterized="true"/>
18+
</section>
19+
</sections>
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
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="AdminDashboardWithChartsTest">
12+
<annotations>
13+
<features value="Backend"/>
14+
<title value="Google chart on Magento dashboard"/>
15+
<description value="Google chart on Magento dashboard page is not broken"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MAGETWO-98934"/>
18+
<useCaseId value="MAGETWO-98584"/>
19+
<group value="backend"/>
20+
</annotations>
21+
<before>
22+
<magentoCLI command="config:set admin/dashboard/enable_charts 1" stepKey="setEnableCharts" />
23+
<createData entity="SimpleProduct2" stepKey="createProduct">
24+
<field key="price">150</field>
25+
</createData>
26+
<createData entity="Simple_US_Customer" stepKey="createCustomer">
27+
<field key="firstname">John1</field>
28+
<field key="lastname">Doe1</field>
29+
</createData>
30+
</before>
31+
<after>
32+
<!-- Reset admin order filter -->
33+
<comment userInput="Reset admin order filter" stepKey="resetAdminOrderFilter"/>
34+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/>
35+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingOrderGrid"/>
36+
<magentoCLI command="config:set admin/dashboard/enable_charts 0" stepKey="setDisableChartsAsDefault" />
37+
<deleteData createDataKey="createProduct" stepKey="deleteProduct"/>
38+
<deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/>
39+
<actionGroup ref="logout" stepKey="logout"/>
40+
</after>
41+
<!-- Login as admin -->
42+
<comment userInput="Login as admin" stepKey="adminLogin"/>
43+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
44+
<!-- Grab quantity value -->
45+
<comment userInput="Grab quantity value from dashboard" stepKey="grabQuantityFromDashboard"/>
46+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabStartQuantity"/>
47+
<!-- Login as customer -->
48+
<comment userInput="Login as customer" stepKey="loginAsCustomer"/>
49+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="customerLogin">
50+
<argument name="Customer" value="$$createCustomer$$" />
51+
</actionGroup>
52+
<!-- Add Product to Shopping Cart-->
53+
<comment userInput="Add product to the shopping cart" stepKey="addProductToCart"/>
54+
<amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/>
55+
<waitForPageLoad stepKey="waitForProductPageLoad"/>
56+
<actionGroup ref="addToCartFromStorefrontProductPage" stepKey="addToCartFromStorefrontProductPage">
57+
<argument name="productName" value="$$createProduct.name$$"/>
58+
</actionGroup>
59+
<!--Go to Checkout-->
60+
<comment userInput="Go to checkout" stepKey="goToCheckout"/>
61+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
62+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingCheckoutPageWithShippingMethod"/>
63+
<click selector="{{CheckoutShippingMethodsSection.firstShippingMethod}}" stepKey="selectFirstShippingMethod"/>
64+
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMask1"/>
65+
<waitForElement selector="{{CheckoutShippingMethodsSection.next}}" time="30" stepKey="waitForNextButton"/>
66+
<click selector="{{CheckoutShippingMethodsSection.next}}" stepKey="clickNext"/>
67+
<!-- Checkout select Check/Money Order payment -->
68+
<comment userInput="Select Check/Money payment" stepKey="checkoutSelectCheckMoneyPayment"/>
69+
<actionGroup ref="CheckoutSelectCheckMoneyOrderPaymentActionGroup" stepKey="selectCheckMoneyPayment"/>
70+
<!-- Place Order -->
71+
<comment userInput="Place order" stepKey="placeOrder"/>
72+
<click selector="{{CheckoutPaymentSection.placeOrder}}" stepKey="clickPlaceOrder"/>
73+
<see selector="{{CheckoutSuccessMainSection.successTitle}}" userInput="Thank you for your purchase!" stepKey="seeSuccessTitle"/>
74+
<see selector="{{CheckoutSuccessMainSection.orderNumberText}}" userInput="Your order number is: " stepKey="seeOrderNumber"/>
75+
<grabTextFrom selector="{{CheckoutSuccessMainSection.orderNumber22}}" stepKey="grabOrderNumber"/>
76+
<!-- Search for Order in the order grid -->
77+
<comment userInput="Search for Order in the order grid" stepKey="searchOrderInGrid"/>
78+
<actionGroup ref="filterOrderGridById" stepKey="filterOrderGridById">
79+
<argument name="orderId" value="$grabOrderNumber"/>
80+
</actionGroup>
81+
<waitForLoadingMaskToDisappear stepKey="waitForSearchingOrder"/>
82+
<!-- Create invoice -->
83+
<comment userInput="Create invoice" stepKey="createInvoice"/>
84+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
85+
<click selector="{{AdminOrderDetailsMainActionsSection.invoice}}" stepKey="clickInvoiceButton"/>
86+
<see selector="{{AdminHeaderSection.pageTitle}}" userInput="New Invoice" stepKey="seeNewInvoiceInPageTitle" after="clickInvoiceButton"/>
87+
<see selector="{{AdminInvoiceTotalSection.total('Subtotal')}}" userInput="$150.00" stepKey="seeCorrectGrandTotal"/>
88+
<click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/>
89+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The invoice has been created." stepKey="seeSuccessInvoiceMessage"/>
90+
<!--Create Shipment for the order-->
91+
<comment userInput="Create Shipment for the order" stepKey="createShipmentForOrder"/>
92+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="onOrdersPage2"/>
93+
<waitForPageLoad time="30" stepKey="waitForOrderListPageLoading"/>
94+
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="openOrderPageForShip"/>
95+
<waitForPageLoad stepKey="waitForOrderDetailsPage"/>
96+
<click selector="{{AdminOrderDetailsMainActionsSection.ship}}" stepKey="clickShipAction"/>
97+
<waitForPageLoad stepKey="waitForShipmentPagePage"/>
98+
<seeInCurrentUrl url="{{AdminShipmentNewPage.url}}" stepKey="seeOrderShipmentUrl"/>
99+
<!--Submit Shipment-->
100+
<comment userInput="Submit Shipment" stepKey="submitShipment"/>
101+
<click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="clickSubmitShipment"/>
102+
<waitForPageLoad stepKey="waitForShipmentSubmit"/>
103+
<see selector="{{AdminOrderDetailsMessagesSection.successMessage}}" userInput="The shipment has been created." stepKey="seeShipmentCreateSuccess"/>
104+
<!-- Go to dashboard page -->
105+
<comment userInput="Go to dashboard page" stepKey="goToDashboardPage"/>
106+
<amOnPage url="{{AdminDashboardPage.url}}" stepKey="amOnDashboardPage"/>
107+
<waitForPageLoad stepKey="waitForDashboardPageLoad4"/>
108+
<!-- Grab quantity value -->
109+
<comment userInput="Grab quantity value from dashboard at the end" stepKey="grabQuantityFromDashboardAtTheEnd"/>
110+
<grabTextFrom selector="{{AdminDashboardSection.dashboardTotals('Quantity')}}" stepKey="grabEndQuantity"/>
111+
<!-- Assert that page is not broken -->
112+
<comment userInput="Assert that dashboard page is not broken" stepKey="assertDashboardPageIsNotBroken"/>
113+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramOrderContentTab}}" stepKey="seeOrderContentTab"/>
114+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramContent}}" stepKey="seeDiagramContent"/>
115+
<click selector="{{AdminDashboardSection.dashboardDiagramAmounts}}" stepKey="clickDashboardAmount"/>
116+
<waitForLoadingMaskToDisappear stepKey="waitForDashboardAmountLoading"/>
117+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramAmountsContentTab}}" stepKey="seeDiagramAmountContent"/>
118+
<seeElement selector="{{AdminDashboardSection.dashboardDiagramTotals}}" stepKey="seeAmountTotals"/>
119+
<dontSeeJsError stepKey="dontSeeJsError"/>
120+
<assertGreaterThan expected="$grabStartQuantity" actual="$grabEndQuantity" stepKey="checkQuantityWasChanged"/>
121+
</test>
122+
</tests>

0 commit comments

Comments
 (0)