forked from opensearch-project/dashboards-observability
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrace_analytics_services.spec.js
460 lines (407 loc) · 18.3 KB
/
trace_analytics_services.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
/// <reference types="cypress" />
import {
expandServiceView,
SERVICE_NAME,
SERVICE_SPAN_ID,
setTimeFilter,
verify_traces_spans_data_grid_cols_exists,
count_table_row,
AUTH_SERVICE_SPAN_ID,
} from '../../utils/constants';
import { suppressResizeObserverIssue } from '../../utils/constants';
suppressResizeObserverIssue(); //needs to be in file once
describe('Testing services table empty state', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
});
it('Renders empty state', () => {
cy.contains(' (0)').should('exist');
cy.contains('No matches').should('exist');
});
});
describe('Testing services table', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});
it('Renders the services table', () => {
cy.contains(' (8)').should('exist');
cy.contains('analytics-service, frontend-client, recommendation').should('exist');
cy.contains('186.95').should('exist');
cy.contains('14.29%').should('exist');
});
it('Searches correctly', () => {
cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}{enter}`);
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.contains(' (1)').should('exist');
cy.contains('3.57%').should('exist');
});
it('Verify columns in Services table', () => {
cy.get('.euiFlexItem.euiFlexItem--flexGrowZero .panel-title')
.contains('Services')
.should('exist');
cy.get('.euiTableCellContent__text[title="Name"]').should('exist');
cy.get('.euiTableCellContent__text[title="Average duration (ms)"]').should('exist');
cy.get('.euiTableCellContent__text[title="Error rate"]').should('exist');
cy.get('.euiTableCellContent__text[title="Request rate"]').should('exist');
cy.get('.euiTableCellContent__text[title="No. of connected services"]').should('exist');
cy.get('.euiTableCellContent__text[title="Connected services"]').should('exist');
cy.get('.euiTableCellContent__text[title="Traces"]').should('exist');
cy.get('[data-test-subj="tablePaginationPopoverButton"]').click();
cy.get('.euiIcon.euiIcon--medium.euiIcon--inherit.euiContextMenu__icon')
.eq(0)
.should('exist')
.click();
cy.get('[data-test-subj="pagination-button-next"]').should('exist').click();
cy.get('.euiLink.euiLink--primary').contains('order').should('exist');
});
it('Navigate from Services to Traces', () => {
cy.get('.euiTableCellContent__text[title="Traces"]').should('exist');
cy.contains('74').should('exist').click();
cy.get('.euiText.euiText--medium .panel-title').should('exist');
cy.get('.euiBadge__childButton[data-test-subj="filterBadge"]').should('exist');
});
});
describe('Testing service view empty state', () => {
beforeEach(() => {
cy.visit(`app/observability-traces#/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
});
it('Renders service view empty state', () => {
cy.contains('frontend-client').should('exist');
cy.get('.euiText').contains('0').should('exist');
cy.get('.euiText').contains('-').should('exist');
});
});
describe('Testing service view', () => {
beforeEach(() => {
cy.visit(`app/observability-traces#/services`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}`);
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.get('.euiTableRow').should('have.length.lessThan', 3); //Replaces wait
expandServiceView(0);
});
it('Renders service view', () => {
cy.get('h1.overview-content').contains(SERVICE_NAME).should('exist');
cy.contains('178.6').should('exist');
cy.contains('3.57%').should('exist');
cy.get('div.vis-network').should('exist');
});
it('Has working breadcrumbs', () => {
cy.get('.euiBreadcrumb').contains(SERVICE_NAME).click();
cy.get('h1.overview-content').contains(SERVICE_NAME).should('exist');
cy.get('.euiBreadcrumb').contains('Services').click();
cy.get('.euiBreadcrumb').contains('Trace analytics').click();
cy.get('.euiBreadcrumb').contains('Observability').click();
cy.get('.euiTitle').contains('Logs').should('exist');
});
it('Renders spans data grid, flyout, filters', () => {
cy.get("[data-test-subj='spanId-link']")
.contains(SERVICE_SPAN_ID)
.trigger('mouseover', { force: true });
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });
cy.contains('Span detail').should('exist');
cy.contains('Span attributes').should('exist');
cy.get('.euiTextColor').contains('Span ID').trigger('mouseover');
cy.get('.euiButtonIcon[aria-label="span-flyout-filter-icon"').click({ force: true });
cy.get('.euiBadge__text').contains('spanId: ').should('exist');
cy.get('[data-test-subj="euiFlyoutCloseButton"]').click({ force: true });
cy.contains('Spans (1)').should('exist');
});
});
describe('Testing Service map', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
cy.get('.euiTableRow').should('have.length.greaterThan', 7); //Replaces wait
});
it('Render Service map', () => {
cy.get('.euiText.euiText--medium .panel-title').contains('Service map');
cy.get('[data-test-subj="latency"]').should('exist');
cy.get('.ytitle').contains('Average duration (ms)');
cy.get('[data-text = "Errors"]').click();
cy.contains('60%');
cy.get('[data-text = "Duration"]').click();
cy.contains('100');
cy.get('.euiFormLabel.euiFormControlLayout__prepend').contains('Focus on').should('exist');
});
it('Render the vis-network div and canvas', () => {
// Check the view where ServiceMap component is rendered
cy.get('.euiText.euiText--medium .panel-title').contains('Service map');
cy.get('.vis-network').should('exist');
cy.get('.vis-network canvas').should('exist');
// Check the canvas is not empty
cy.get('.vis-network canvas')
.should('have.attr', 'style')
.and('include', 'position: relative')
.and('include', 'touch-action: none')
.and('include', 'user-select: none')
.and('include', 'width: 100%')
.and('include', 'height: 100%');
cy.get('.vis-network canvas').should('have.attr', 'width').and('not.eq', '0');
cy.get('.vis-network canvas').should('have.attr', 'height').and('not.eq', '0');
});
it('Click on a node to see the details', () => {
cy.get('.euiText.euiText--medium .panel-title').contains('Service map');
cy.get('.vis-network canvas').should('exist');
// ensure rendering is complete before node click, replace wait
cy.get('[data-text="Errors"]').click();
cy.contains('60%');
cy.get('[data-text="Duration"]').click();
cy.contains('Average duration (ms)');
cy.get("[data-test-subj='tableHeaderCell_average_latency_1']").click();
// clicks on payment node
cy.get('.vis-network canvas').click(707, 388);
// checks the duration in node details popover
cy.get('.euiText.euiText--small').contains('Average duration: 216.43ms').should('exist');
});
it('Tests focus functionality in Service map', () => {
cy.get('.euiText.euiText--medium .panel-title').contains('Service map');
cy.get('[data-test-subj="latency"]').should('exist');
cy.get('.ytitle').contains('Average duration (ms)');
// Test metric selection functionality
cy.get('[data-text="Errors"]').click();
cy.contains('60%');
cy.get('[data-text="Duration"]').click();
cy.contains('100');
// Focus on "order" by selecting the first option
cy.get('.euiFormLabel.euiFormControlLayout__prepend').contains('Focus on').should('exist');
cy.get('[placeholder="Service name"]').click();
cy.get('.euiSelectableList__list li').eq(0).click();
// Verify the service map updates and focus is applied
cy.get('.euiFormLabel.euiFormControlLayout__prepend').contains('Focus on').should('exist');
cy.get('[placeholder="order"]').click();
cy.get('.euiSelectableList__list li').should('have.length', 4); // Focused view with 4 options
// Refresh to reset the focus
cy.get('[data-test-subj="serviceMapRefreshButton"]').click();
// Verify the service map is reset to the original state
cy.get('[placeholder="Service name"]').should('have.value', '');
cy.get('.euiSelectableList__list li').should('have.length', 8); // Original 8 options
});
});
describe('Testing traces Spans table verify table headers functionality', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});
it('Renders the spans table and verify columns headers', () => {
cy.contains(' (8)').should('exist');
cy.contains('analytics-service, frontend-client, recommendation').should('exist');
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
cy.get('.panel-title').contains('Spans').should('exist');
cy.get('.panel-title-count').contains('8').should('exist');
verify_traces_spans_data_grid_cols_exists();
});
it('Toggle columns and verify the columns hidden text verify rows', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click({ force: true });
cy.get('.panel-title-count').contains('8').should('exist');
cy.get('.euiSwitch.euiSwitch--compressed.euiSwitch--mini .euiSwitch__button').eq(3).click();
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]')
.click()
.should('have.text', '2 columns hidden');
count_table_row(8);
});
it('Show all button Spans table', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click();
cy.get('.euiPopoverFooter .euiFlexItem.euiFlexItem--flexGrowZero')
.eq(0)
.should('have.text', 'Show all')
.click();
cy.get('.euiDataGrid__focusWrap').click().should('exist');
verify_traces_spans_data_grid_cols_exists();
});
it('Hide all button Spans table', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
cy.get('.euiTableRow').should('have.length.lessThan', 2); //Replace wait
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click();
cy.get('.euiPopoverFooter .euiFlexItem.euiFlexItem--flexGrowZero')
.eq(1)
.should('have.text', 'Hide all')
.click();
cy.get('.euiDataGrid__focusWrap').click().should('exist');
cy.get('[data-test-subj="dataGridColumnSelectorPopover"]').should(
'have.text',
'10 columns hidden'
);
});
it('Render Spans table and change data table Density', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
verify_traces_spans_data_grid_cols_exists();
cy.get('[data-test-subj="service-dep-table"]').should('exist');
cy.get('.euiButtonEmpty__text').contains('Density').click();
cy.contains('.euiButtonContent', 'Compact density').find('.euiButtonContent__icon').click();
cy.contains('.euiButtonContent', 'Normal density').find('.euiButtonContent__icon').click();
cy.contains('.euiButtonContent', 'Expanded density').find('.euiButtonContent__icon').click();
});
it('Render Spans table and and click on sort', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
verify_traces_spans_data_grid_cols_exists();
cy.get('[data-test-subj="service-dep-table"]').should('exist');
cy.get('[data-test-subj="dataGridColumnSortingButton"]')
.contains('Sort fields')
.should('exist')
.click();
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection"]').click();
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-durationInNanos').click();
cy.get('[data-test-subj="dataGridColumnSortingButton"]').should('have.text', '1 fields sorted');
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
cy.get('button.euiLink.euiLink--primary').eq(4).contains('96e7fdedd82ab53c').click();
});
});
describe('Testing traces Spans table and verify columns functionality', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});
it('Renders the spans table and click on first span to verify details', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
verify_traces_spans_data_grid_cols_exists();
cy.contains(AUTH_SERVICE_SPAN_ID).click();
cy.get('[data-test-subj="spanDetailFlyout"]').contains('Span detail').should('exist');
cy.get('.euiFlyoutBody .panel-title').contains('Overview').should('exist');
cy.get('.euiTextColor.euiTextColor--subdued').contains('Span ID').should('exist');
cy.get('[data-test-subj="parentSpanId"]').contains('d03fecfa0f55b77c').should('exist');
cy.get('.euiFlyoutBody__overflowContent .panel-title')
.contains('Span attributes')
.should('exist');
cy.get('.euiDescriptionList__description .euiFlexItem').eq(0).trigger('mouseover').click();
cy.get('[aria-label="span-flyout-filter-icon"]').click();
cy.get('.euiFlyout__closeButton.euiFlyout__closeButton--inside').click();
cy.get('.euiBadge__content .euiBadge__text')
.contains('spanId: 277a5934acf55dcf')
.should('exist');
count_table_row(1);
cy.get('[aria-label="remove current filter"]').click();
verify_traces_spans_data_grid_cols_exists();
cy.contains('277a5934acf55dcf').should('exist');
cy.get('.panel-title-count').contains('8').should('exist');
count_table_row(8);
});
it('Render Spans table and verify Column functionality', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
expandServiceView(1);
verify_traces_spans_data_grid_cols_exists();
cy.get('[data-test-subj="service-dep-table"]').should('exist');
cy.get('.euiDataGridHeaderCell__content').contains('Span ID').click();
cy.get('.euiListGroupItem__label').contains('Hide column').click();
cy.get('.euiDataGridHeaderCell__content').contains('Trace ID').click();
cy.get('.euiListGroupItem__label').contains('Sort A-Z').click();
cy.get('.euiDataGridHeaderCell__content').contains('Trace group').click();
cy.get('.euiListGroupItem__label').contains('Move left').click();
});
});
describe('Testing navigation from Services to Traces', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});
it('Clicks on the "Traces" shortcut to redirect', () => {
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
cy.get('.euiLink.euiLink--primary').contains('74').click();
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
cy.get('[data-test-subj="filterBadge"]')
.should('exist')
.contains('serviceName: analytics-service');
cy.get('.euiText').contains('03f9c770db5ee2f1caac0afc36db49ba').should('exist');
});
it('Opens service flyout, clicks Actions, and selects View Traces', () => {
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
cy.get('[data-test-subj*="service-flyout-action-btntrace_service"]')
.should('exist')
.first()
.click();
cy.get('.euiButton').contains('Actions').click();
cy.get('.euiContextMenuItem').contains('View traces').click();
cy.get('[data-test-subj="globalLoadingIndicator"]').should('not.exist');
cy.get('[data-test-subj="filterBadge"]')
.should('exist')
.contains('serviceName: analytics-service');
cy.get('.euiText').contains('03f9c770db5ee2f1caac0afc36db49ba').should('exist');
});
});
describe('Testing switch mode to jaeger', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='jaeger-mode']").click();
//cy.get('.euiButtonEmpty__text').should('contain', 'Jaeger');
});
it('Verifies columns and data', () => {
cy.contains('customer').should('exist');
cy.contains('310.29').should('exist');
cy.contains('0%').should('exist');
cy.contains('Name').should('exist');
cy.contains('Average duration (ms)').should('exist');
cy.contains('Error rate').should('exist');
cy.contains('Request rate').should('exist');
cy.contains('Traces').should('exist');
});
it('Verifies traces links to traces page with filter applied', () => {
cy.get('.euiTableRow').should('have.length.lessThan', 7); //Replaces Wait
cy.get('.euiLink').contains('7').click();
cy.contains(' (7)').should('exist');
cy.get("[data-test-subj='filterBadge']").eq(0).contains('process.serviceName: customer');
});
});