1- import healthCheckPageElements from "../../../../support/elements/dashboard/manage/sdk/healthCheck" ;
1+ import {
2+ healthCheckPageElements ,
3+ healthCheckMetricCardElements ,
4+ hcsEChartElements ,
5+ statusCodesEChartElements ,
6+ errorMessagesEChartElements
7+ } from "../../../../support/elements/dashboard/manage/sdk/healthCheck" ;
8+
29
310const verifyStaticElementsOfPage = ( ) => {
411 cy . verifyElement ( {
@@ -33,21 +40,21 @@ const verifyStaticElementsOfPage = () => {
3340 } ) ;
3441
3542 cy . verifyElement ( {
36- labelElement : healthCheckPageElements . HEALTH_CHECK_RECEIVED_LABEL ,
43+ labelElement : healthCheckMetricCardElements . HEALTH_CHECK_RECEIVED_LABEL ,
3744 labelText : "Health Checks Received" ,
38- element : healthCheckPageElements . HEALTH_CHECK_RECEIVED_RECEIVED_TREND_ICON ,
45+ element : healthCheckMetricCardElements . HEALTH_CHECK_RECEIVED_RECEIVED_TREND_ICON ,
3946 } ) ;
4047
4148 cy . verifyElement ( {
42- labelElement : healthCheckPageElements . SDK_ERROR_LOGS_LABEL ,
49+ labelElement : healthCheckMetricCardElements . SDK_ERROR_LOGS_LABEL ,
4350 labelText : "SDK Error Logs" ,
44- element : healthCheckPageElements . SDK_ERROR_LOGS_TREND_ICON ,
51+ element : healthCheckMetricCardElements . SDK_ERROR_LOGS_TREND_ICON ,
4552 } ) ;
4653
4754 cy . verifyElement ( {
48- labelElement : healthCheckPageElements . SDK_WARN_LOGS_LABEL ,
55+ labelElement : healthCheckMetricCardElements . SDK_WARN_LOGS_LABEL ,
4956 labelText : "SDK Warn Logs" ,
50- element : healthCheckPageElements . SDK_WARN_LOGS_TREND_ICON ,
57+ element : healthCheckMetricCardElements . SDK_WARN_LOGS_TREND_ICON ,
5158 } ) ;
5259
5360 cy . scrollPageToCenter ( ) ;
@@ -75,80 +82,252 @@ const verifyEmptyPageElements = () => {
7582
7683 cy . scrollPageToTop ( ) ;
7784
85+ verifyHealthCheckMetricCard ( {
86+ isEmpty : true ,
87+ } ) ;
88+
89+ cy . scrollPageToCenter ( ) ;
90+
91+ verifyHcsEChart ( {
92+ isEmpty : true ,
93+ } ) ;
94+
95+ cy . scrollPageToBottom ( ) ;
96+
97+ verifyStatusCodesEChart ( {
98+ isEmpty : true ,
99+ } ) ;
100+ } ;
101+
102+ const verifyFullDataPageElements = ( ) => {
103+
104+ verifyStaticElementsOfPage ( ) ;
105+
106+ cy . scrollPageToTop ( ) ;
107+
108+ verifyHealthCheckMetricCard ( {
109+ isEmpty : false ,
110+ } ) ;
111+
112+ cy . scrollPageToCenter ( ) ;
113+
114+ verifyHcsEChart ( {
115+ isEmpty : false ,
116+ } ) ;
117+
118+ cy . scrollPageToBottom ( ) ;
119+
120+ verifyStatusCodesEChart ( {
121+ isEmpty : false ,
122+ } ) ;
123+ } ;
124+
125+ const verifyHealthCheckMetricCard = ( {
126+ isEmpty = false ,
127+ healthCheckReceivedNumber = null ,
128+ healthCheckReceivedPercentage = null ,
129+ sdkErrorLogsNumber = null ,
130+ sdkErrorLogsPercentage = null ,
131+ sdkWarnLogsNumber = null ,
132+ sdkWarnLogsPercentage = null
133+ } ) => {
134+
135+ if ( isEmpty ) {
136+ cy . verifyElement ( {
137+ labelElement : healthCheckMetricCardElements . HEALTH_CHECK_RECEIVED_RECEIVED_NUMBER ,
138+ labelText : "0" ,
139+ } ) ;
140+
141+ cy . verifyElement ( {
142+ labelElement : healthCheckMetricCardElements . HEALTH_CHECK_RECEIVED_RECEIVED_PERCENTAGE ,
143+ labelText : "NA" ,
144+ } ) ;
145+
146+ cy . verifyElement ( {
147+ labelElement : healthCheckMetricCardElements . SDK_ERROR_LOGS_NUMBER ,
148+ labelText : "0" ,
149+ } ) ;
150+
151+ cy . verifyElement ( {
152+ labelElement : healthCheckMetricCardElements . SDK_ERROR_LOGS_PERCENTAGE ,
153+ labelText : "NA" ,
154+ } ) ;
155+
156+ cy . verifyElement ( {
157+ labelElement : healthCheckMetricCardElements . SDK_WARN_LOGS_NUMBER ,
158+ labelText : "0" ,
159+ } ) ;
160+
161+ cy . verifyElement ( {
162+ labelElement : healthCheckMetricCardElements . SDK_WARN_LOGS_PERCENTAGE ,
163+ labelText : "NA" ,
164+ } ) ;
165+
166+ return ;
167+ }
168+
78169 cy . verifyElement ( {
79- labelElement : healthCheckPageElements . HEALTH_CHECK_RECEIVED_RECEIVED_NUMBER ,
80- labelText : "0" ,
170+ shouldNot : ! isEmpty ,
171+ element : healthCheckMetricCardElements . HEALTH_CHECK_RECEIVED_RECEIVED_NUMBER ,
172+ elementText : healthCheckReceivedNumber ,
81173 } ) ;
82174
83175 cy . verifyElement ( {
84- labelElement : healthCheckPageElements . HEALTH_CHECK_RECEIVED_RECEIVED_VALUE ,
85- labelText : "NA" ,
176+ shouldNot : ! isEmpty ,
177+ element : healthCheckMetricCardElements . HEALTH_CHECK_RECEIVED_RECEIVED_PERCENTAGE ,
178+ elementText : healthCheckReceivedPercentage ,
86179 } ) ;
87180
88181 cy . verifyElement ( {
89- labelElement : healthCheckPageElements . SDK_ERROR_LOGS_NUMBER ,
90- labelText : "0" ,
182+ shouldNot : ! isEmpty ,
183+ element : healthCheckMetricCardElements . SDK_ERROR_LOGS_NUMBER ,
184+ elementText : sdkErrorLogsNumber ,
91185 } ) ;
92186
93187 cy . verifyElement ( {
94- labelElement : healthCheckPageElements . SDK_ERROR_LOGS_VALUE ,
95- labelText : "NA" ,
188+ shouldNot : ! isEmpty ,
189+ element : healthCheckMetricCardElements . SDK_ERROR_LOGS_PERCENTAGE ,
190+ elementText : sdkErrorLogsPercentage ,
96191 } ) ;
97192
98193 cy . verifyElement ( {
99- labelElement : healthCheckPageElements . SDK_WARN_LOGS_NUMBER ,
100- labelText : "0" ,
194+ shouldNot : ! isEmpty ,
195+ element : healthCheckMetricCardElements . SDK_WARN_LOGS_NUMBER ,
196+ elementText : sdkWarnLogsNumber ,
101197 } ) ;
102198
103199 cy . verifyElement ( {
104- labelElement : healthCheckPageElements . SDK_WARN_LOGS_VALUE ,
105- labelText : "NA" ,
200+ shouldNot : ! isEmpty ,
201+ element : healthCheckMetricCardElements . SDK_WARN_LOGS_PERCENTAGE ,
202+ elementText : sdkWarnLogsPercentage ,
106203 } ) ;
204+ } ;
205+
206+ const verifyHcsEChart = ( {
207+ isEmpty = false ,
208+ } ) => {
209+ if ( isEmpty ) {
210+ cy . verifyElement ( {
211+ element : hcsEChartElements . EMPTY_TABLE_ICON ,
212+ } ) ;
213+
214+ cy . verifyElement ( {
215+ labelElement : hcsEChartElements . EMPTY_TABLE_TITLE ,
216+ labelText : "...hmm, seems empty here" ,
217+ } ) ;
218+
219+ cy . verifyElement ( {
220+ labelElement : hcsEChartElements . EMPTY_TABLE_SUBTITLE ,
221+ labelText : "No data found" ,
222+ } ) ;
223+
224+ return ;
225+ }
107226
108227 cy . verifyElement ( {
109- element : healthCheckPageElements . HEALTH_CHECK_EMPTY_TABLE_ICON ,
228+ element : hcsEChartElements . SELECT_HCS_CHART_TYPE ,
110229 } ) ;
111230
112231 cy . verifyElement ( {
113- labelElement : healthCheckPageElements . HEALTH_CHECK_EMPTY_TABLE_TITLE ,
114- labelText : "...hmm, seems empty here" ,
232+ element : hcsEChartElements . CHART_HCS ,
115233 } ) ;
116234
117235 cy . verifyElement ( {
118- labelElement : healthCheckPageElements . HEALTH_CHECK_EMPTY_TABLE_SUBTITLE ,
119- labelText : "No data found" ,
236+ element : hcsEChartElements . CHART_TYPE_ANNOTATION_BUTTON ,
120237 } ) ;
121238
122- cy . scrollPageToCenter ( ) ;
239+ cy . verifyElement ( {
240+ element : hcsEChartElements . CHART_MORE_BUTTON ,
241+ } ) ;
123242
124243 cy . verifyElement ( {
125- element : healthCheckPageElements . STATUS_EMPTY_TABLE_ICON ,
244+ element : hcsEChartElements . RECEIVED_HEALTH_CHECKS_ICON ,
245+ labelElement : hcsEChartElements . RECEIVED_HEALTH_CHECKS_LABEL ,
246+ labelText : "Received Health Checks"
126247 } ) ;
127248
128249 cy . verifyElement ( {
129- labelElement : healthCheckPageElements . STATUS_EMPTY_TABLE_TITLE ,
130- labelText : "...hmm, seems empty here" ,
250+ element : hcsEChartElements . ERROR_LOGS_ICON ,
251+ labelElement : hcsEChartElements . ERROR_LOGS_LABEL ,
252+ labelText : "Error Logs"
131253 } ) ;
132254
133255 cy . verifyElement ( {
134- labelElement : healthCheckPageElements . STATUS_EMPTY_TABLE_SUBTITLE ,
135- labelText : "No data found" ,
256+ element : hcsEChartElements . WARNING_LOGS_ICON ,
257+ labelElement : hcsEChartElements . WARNING_LOGS_LABEL ,
258+ labelText : "Warning Logs"
136259 } ) ;
260+ } ;
137261
138- cy . scrollPageToBottom ( ) ;
262+ const verifyStatusCodesEChart = ( {
263+ isEmpty = false ,
264+ } ) => {
265+ if ( isEmpty ) {
266+ cy . verifyElement ( {
267+ element : statusCodesEChartElements . EMPTY_TABLE_ICON ,
268+ } ) ;
269+
270+ cy . verifyElement ( {
271+ labelElement : statusCodesEChartElements . EMPTY_TABLE_TITLE ,
272+ labelText : "...hmm, seems empty here" ,
273+ } ) ;
274+
275+ cy . verifyElement ( {
276+ labelElement : statusCodesEChartElements . EMPTY_TABLE_SUBTITLE ,
277+ labelText : "No data found" ,
278+ } ) ;
279+
280+ return ;
281+ }
282+
283+ cy . verifyElement ( {
284+ element : statusCodesEChartElements . CHART_STATUS_CODES ,
285+ } ) ;
286+
287+ cy . verifyElement ( {
288+ element : statusCodesEChartElements . CHART_MORE_BUTTON ,
289+ } ) ;
290+
291+ cy . verifyElement ( {
292+ element : statusCodesEChartElements . STATUS_CODE_MIN_1_ICON ,
293+ labelElement : statusCodesEChartElements . STATUS_CODE_MIN_1_LABEL ,
294+ labelText : "-1"
295+ } ) ;
296+ } ;
297+
298+ const verifyErrorMessagesEChart = ( {
299+ isEmpty = false ,
300+ } ) => {
301+ if ( isEmpty ) {
302+ cy . verifyElement ( {
303+ element : errorMessagesEChartElements . EMPTY_TABLE_ICON ,
304+ } ) ;
305+
306+ cy . verifyElement ( {
307+ labelElement : errorMessagesEChartElements . EMPTY_TABLE_TITLE ,
308+ labelText : "...hmm, seems empty here" ,
309+ } ) ;
310+
311+ cy . verifyElement ( {
312+ labelElement : errorMessagesEChartElements . EMPTY_TABLE_SUBTITLE ,
313+ labelText : "No data found" ,
314+ } ) ;
315+
316+ return ;
317+ }
139318
140319 cy . verifyElement ( {
141- element : healthCheckPageElements . ERROR_MESSAGES_EMPTY_TABLE_ICON ,
320+ element : errorMessagesEChartElements . CHART_ERROR_MESSAGES ,
142321 } ) ;
143322
144323 cy . verifyElement ( {
145- labelElement : healthCheckPageElements . ERROR_MESSAGES_EMPTY_TABLE_TITLE ,
146- labelText : "...hmm, seems empty here" ,
324+ element : errorMessagesEChartElements . CHART_MORE_BUTTON ,
147325 } ) ;
148326
149327 cy . verifyElement ( {
150- labelElement : healthCheckPageElements . ERROR_MESSAGES_EMPTY_TABLE_SUBTITLE ,
151- labelText : "No data found" ,
328+ element : errorMessagesEChartElements . APP_DOES_NOT_EXIST_ICON ,
329+ labelElement : errorMessagesEChartElements . APP_DOES_NOT_EXIST_LABEL ,
330+ labelText : "App does not exist"
152331 } ) ;
153332} ;
154333
@@ -174,6 +353,11 @@ const clickSdkConfigurationTab = () => {
174353
175354module . exports = {
176355 verifyEmptyPageElements,
356+ verifyFullDataPageElements,
357+ verifyHealthCheckMetricCard,
358+ verifyHcsEChart,
359+ verifyStatusCodesEChart,
360+ verifyErrorMessagesEChart,
177361 clickSdkStatsTab,
178362 clickRequestStatsTab,
179363 clickHealthCheckTab,
0 commit comments