Skip to content

Commit 8de4b3e

Browse files
authored
[Refactoring] Use JDBC response format for visualizations (opensearch-project#324)
* use jdbc format Signed-off-by: Eric Wei <[email protected]> * use jdbc format for line Signed-off-by: Eric Wei <[email protected]> * use josn for pie and add changes for related rendering flows Signed-off-by: Eric Wei <[email protected]> * use jdbc for heatmap Signed-off-by: Eric Wei <[email protected]> * change viz to jdbc elsewhere and make related changes to use jdbc data Signed-off-by: Eric Wei <[email protected]> * correct suppress naming Signed-off-by: Eric Wei <[email protected]> * added download path for issue causing app reloads Signed-off-by: Eric Wei <[email protected]> * quick resolution for few tests Signed-off-by: Eric Wei <[email protected]> * update jest tests/snapshots Signed-off-by: Eric Wei <[email protected]> * keep viz for on calculating availability for now Signed-off-by: Eric Wei <[email protected]> * add cypress downloads to gitignore Signed-off-by: Eric Wei <[email protected]> * disable no-console Signed-off-by: Eric Wei <[email protected]> * better naming and type defination Signed-off-by: Eric Wei <[email protected]> * update function doc and types Signed-off-by: Eric Wei <[email protected]> --------- Signed-off-by: Eric Wei <[email protected]>
1 parent ea4836f commit 8de4b3e

40 files changed

+5356
-757
lines changed

.cypress/integration/1_event_analytics.spec.js

+21-65
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,15 @@ import {
2222
HOST_TEXT_2,
2323
HOST_TEXT_3,
2424
HOST_TEXT_4,
25-
AGENT_TEXT_1,
26-
AGENT_TEXT_2,
27-
AGENT_TEXT_3,
2825
BAR_LEG_TEXT_1,
2926
BAR_LEG_TEXT_2,
3027
BAR_LEG_TEXT_3,
3128
VIS_TYPE_PIE,
32-
VIS_TYPE_HBAR,
3329
VIS_TYPE_VBAR,
34-
VIS_TYPE_HEATMAP,
3530
FIELD_HOST,
3631
FIELD_AGENT
3732
} from '../utils/event_analytics/constants';
38-
import { supressResizeObserverIssue, COMMAND_TIMEOUT_LONG } from '../utils/constants';
33+
import { suppressResizeObserverIssue, COMMAND_TIMEOUT_LONG } from '../utils/constants';
3934
import { clearQuerySearchBoxText } from '../utils/event_analytics/helpers';
4035

4136
describe('Adding sample data and visualization', () => {
@@ -90,7 +85,7 @@ describe('Open flyout for a data row to see details', () => {
9085

9186
it('Should be able to open flyout and see data, json and traces', () => {
9287
cy.get('[data-test-subj="docTable"] tbody tr button.euiButtonIcon').first().click();
93-
supressResizeObserverIssue();
88+
suppressResizeObserverIssue();
9489
cy.get('.observability-flyout').should('exist');
9590
cy.get('.observability-flyout .osdDocViewer .euiTabs span.euiTab__content')
9691
.contains('Table')
@@ -117,7 +112,7 @@ describe('Open flyout for a data row to see details', () => {
117112
describe('Add/delete/switch explorer top level tabs', () => {
118113
before(() => {
119114
landOnEventExplorer();
120-
supressResizeObserverIssue();
115+
suppressResizeObserverIssue();
121116
});
122117

123118
it('Add a new tab', () => {
@@ -138,7 +133,7 @@ describe('Add/delete/switch explorer top level tabs', () => {
138133
.find('button.euiTab')
139134
.first()
140135
.click();
141-
supressResizeObserverIssue();
136+
suppressResizeObserverIssue();
142137
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
143138
.find('button.euiTab')
144139
.first()
@@ -215,22 +210,22 @@ describe('Click actions', () => {
215210
cy.get('[data-test-subj="eventHomeAction__delete"]').click();
216211
cy.get('[data-test-subj="popoverModal__deleteTextInput"]').type('delete');
217212
cy.get('[data-test-subj="popoverModal__deleteButton"').click();
218-
cy.get('.euiToastHeader__title').contains('successfully').should('exist');
213+
cy.get('.euiToastHeader__title').should('contain', 'successfully');
219214
});
220215
});
221216

222217
describe('Saves a query on explorer page', () => {
223218
it('Saves a visualization on visualization tab of explorer page', () => {
224219
landOnEventExplorer();
225220
querySearch(TEST_QUERIES[1].query, TEST_QUERIES[1].dateRangeDOM);
226-
supressResizeObserverIssue();
221+
suppressResizeObserverIssue();
227222
cy.get('button[id="main-content-vis"]').contains('Visualizations').click();
228223
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click();
229224
cy.get('[data-test-subj="eventExplorer__querySaveName"]')
230225
.focus()
231226
.type(SAVE_QUERY2, { force: true });
232227
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]').click({ force: true });
233-
cy.get('.euiToastHeader__title').should('contain', 'successfully');
228+
cy.get('.euiToastHeader__title').contains('successfully').should('exist');
234229
landOnEventHome();
235230
cy.get('[data-test-subj="eventHome__savedQueryTableName"]').first().contains(SAVE_QUERY2);
236231
});
@@ -245,7 +240,7 @@ describe('Saves a query on explorer page', () => {
245240
cy.wait(delay);
246241
landOnEventExplorer();
247242
querySearch(TEST_QUERIES[1].query, TEST_QUERIES[1].dateRangeDOM);
248-
supressResizeObserverIssue();
243+
suppressResizeObserverIssue();
249244
cy.get('button[id="main-content-vis"]', { timeout: COMMAND_TIMEOUT_LONG })
250245
.contains('Visualizations')
251246
.click();
@@ -261,7 +256,7 @@ describe('Saves a query on explorer page', () => {
261256

262257
it('Saves a query on event tab of explorer page', () => {
263258
landOnEventExplorer();
264-
supressResizeObserverIssue();
259+
suppressResizeObserverIssue();
265260
querySearch(TEST_QUERIES[0].query, TEST_QUERIES[0].dateRangeDOM);
266261

267262
cy.get('.tab-title').contains('Events').click();
@@ -281,7 +276,7 @@ describe('Saves a query on explorer page', () => {
281276

282277
it('Click on a saved query from event analytics home', () => {
283278
landOnEventExplorer();
284-
supressResizeObserverIssue();
279+
suppressResizeObserverIssue();
285280
querySearch(TEST_QUERIES[0].query, TEST_QUERIES[0].dateRangeDOM);
286281

287282
cy.get('.tab-title').contains('Events').click();
@@ -310,7 +305,7 @@ describe('Saves a query on explorer page', () => {
310305
describe('Override timestamp for an index', () => {
311306
it('Click override button to override default timestamp', () => {
312307
landOnEventExplorer();
313-
supressResizeObserverIssue();
308+
suppressResizeObserverIssue();
314309
clearQuerySearchBoxText('searchAutocompleteTextArea');
315310
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type(TEST_QUERIES[2].query);
316311
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').contains('Refresh').click();
@@ -330,7 +325,7 @@ describe('Override timestamp for an index', () => {
330325
describe('Toggle sidebar fields', () => {
331326
it('Toggle fields between available and selected section', () => {
332327
landOnEventExplorer();
333-
supressResizeObserverIssue();
328+
suppressResizeObserverIssue();
334329
querySearch(TEST_QUERIES[0].query, YEAR_TO_DATE_DOM_ID);
335330
cy.get('[data-test-subj="fieldToggle-AvgTicketPrice"]').click();
336331
cy.get('[data-test-subj="field-AvgTicketPrice"]').should('exist');
@@ -344,7 +339,7 @@ describe('Toggle sidebar fields', () => {
344339
describe('Search fields in sidebar', () => {
345340
it('Search a field', () => {
346341
landOnEventExplorer();
347-
supressResizeObserverIssue();
342+
suppressResizeObserverIssue();
348343
querySearch(TEST_QUERIES[0].query, YEAR_TO_DATE_DOM_ID);
349344
cy.get('[data-test-subj="eventExplorer__sidebarSearch"]').type('A');
350345
cy.get('[data-test-subj="field-Cancelled"]').should('not.exist');
@@ -373,7 +368,7 @@ describe('Delete saved objects', () => {
373368
describe('Click to view field insights', () => {
374369
beforeEach(() => {
375370
landOnEventExplorer();
376-
supressResizeObserverIssue();
371+
suppressResizeObserverIssue();
377372
querySearch(TEST_QUERIES[2].query, YEAR_TO_DATE_DOM_ID);
378373
});
379374

@@ -411,7 +406,7 @@ describe('Click to view field insights', () => {
411406
describe('Switch on and off livetail', () => {
412407
it('Switch on and off in live tail', () => {
413408
landOnEventExplorer();
414-
supressResizeObserverIssue();
409+
suppressResizeObserverIssue();
415410
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type(TEST_QUERIES[1].query);
416411
cy.get('[data-test-subj=eventLiveTail]').click();
417412
cy.get('[data-test-subj=eventLiveTail__delay10s]').click();
@@ -424,7 +419,7 @@ describe('Switch on and off livetail', () => {
424419
describe('Live tail stop automatically', () => {
425420
it('Moving to other tab should stop live tail automatically', () => {
426421
landOnEventExplorer();
427-
supressResizeObserverIssue();
422+
suppressResizeObserverIssue();
428423
clearQuerySearchBoxText('searchAutocompleteTextArea');
429424
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type(TEST_QUERIES[1].query);
430425
cy.get('[data-test-subj=eventLiveTail]').click();
@@ -433,7 +428,7 @@ describe('Live tail stop automatically', () => {
433428
});
434429

435430
it('Add a new tab', () => {
436-
supressResizeObserverIssue();
431+
suppressResizeObserverIssue();
437432
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
438433
.find('button.euiTab')
439434
.then((lists) => {
@@ -453,7 +448,7 @@ describe('Live tail stop automatically', () => {
453448
.find('button.euiTab')
454449
.first()
455450
.click();
456-
supressResizeObserverIssue();
451+
suppressResizeObserverIssue();
457452

458453
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
459454
.find('button.euiTab')
@@ -474,7 +469,7 @@ describe('Live tail stop automatically', () => {
474469
const initialLength = Cypress.$(lists).length;
475470
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"] button.euiTab').eq(1).click();
476471
cy.get('button.euiTab-isSelected [data-test-subj="eventExplorer__tabClose"]').click();
477-
supressResizeObserverIssue();
472+
suppressResizeObserverIssue();
478473
cy.get('[data-test-subj="eventExplorer__topLevelTabbing"]')
479474
.find('button.euiTab')
480475
.should('have.length', initialLength - 1);
@@ -487,7 +482,7 @@ describe('Live tail stop automatically', () => {
487482
});
488483

489484
describe('Visualizing data', () => {
490-
before(() => {
485+
beforeEach(() => {
491486
landOnEventVisualizations();
492487
querySearch(TEST_QUERIES[2].query, YEAR_TO_DATE_DOM_ID);
493488
});
@@ -542,50 +537,11 @@ describe('Visualizing data', () => {
542537
cy.get(`input[value="${FIELD_AGENT}"]`).click();
543538
cy.get('[data-test-subj="panelCloseBtn"]').click();
544539
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click();
545-
supressResizeObserverIssue();
546-
547-
cy.get('.infolayer .legendtext').as('legandTxt');
548-
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_1);
549-
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_2);
550-
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_3);
551-
});
540+
suppressResizeObserverIssue();
552541

553-
it('Visualize horizontal bar chart', () => {
554-
cy.get('[data-test-subj="comboBoxInput"]').click();
555-
cy.get('[data-test-subj="comboBoxOptionsList "] span').contains(VIS_TYPE_HBAR).click();
556-
cy.get('[data-test-subj="vizConfigSection-dimensions"]')
557-
.find('[data-test-subj="viz-config-section"]')
558-
.eq(1)
559-
.find('[data-test-subj="viz-config-delete-btn"]')
560-
.click();
561-
cy.get('[data-test-subj="vizConfigSection-breakdowns"]')
562-
.find('[data-test-subj="viz-config-add-btn"]')
563-
.click();
564-
cy.get('[data-test-subj="explorer__vizDataConfig-panel"]')
565-
.find('[data-test-subj="comboBoxInput"]')
566-
.click()
567-
.type(FIELD_AGENT);
568-
cy.get(`input[value="${FIELD_AGENT}"]`).click();
569-
cy.get('[data-test-subj="panelCloseBtn"]').click();
570-
cy.get('[data-test-subj="visualizeEditorRenderButton"]').click();
571542
cy.get('.infolayer .legendtext').as('legandTxt');
572543
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_1);
573544
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_2);
574545
cy.get('@legandTxt').should('contain', BAR_LEG_TEXT_3);
575546
});
576-
577-
it('Visualize heatmap chart', () => {
578-
cy.get('[data-test-subj="comboBoxInput"]').click();
579-
cy.get('[data-test-subj="comboBoxOptionsList "] span').contains(VIS_TYPE_HEATMAP).click();
580-
supressResizeObserverIssue();
581-
cy.get('g.cartesianlayer g.xy g.xaxislayer-above g.xtick text').as('legandXTxt');
582-
cy.get('@legandXTxt').should('contain', HOST_TEXT_1);
583-
cy.get('@legandXTxt').should('contain', HOST_TEXT_3);
584-
cy.get('@legandXTxt').should('contain', HOST_TEXT_4);
585-
cy.get('@legandXTxt').should('contain', HOST_TEXT_2);
586-
cy.get('g.cartesianlayer g.xy g.yaxislayer-above g.ytick text').as('legandYTxt');
587-
cy.get('@legandYTxt').should('contain', AGENT_TEXT_1);
588-
cy.get('@legandYTxt').should('contain', AGENT_TEXT_2);
589-
cy.get('@legandYTxt').should('contain', AGENT_TEXT_3);
590-
});
591547
});

.cypress/integration/3_panels.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
SAMPLE_VISUALIZATIONS_NAMES,
1717
} from '../utils/panel_constants';
1818

19-
import { supressResizeObserverIssue } from '../utils/constants';
19+
import { suppressResizeObserverIssue } from '../utils/constants';
2020

2121
const moveToEventsHome = () => {
2222
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/event_analytics/`);
@@ -59,7 +59,7 @@ describe('Creating visualizations', () => {
5959
});
6060
cy.get('.euiButton__text').contains('Refresh').trigger('mouseover').click();
6161
cy.wait(delay);
62-
supressResizeObserverIssue();
62+
suppressResizeObserverIssue();
6363
cy.get('button[id="main-content-vis"]').contains('Visualizations').trigger('mouseover').click();
6464
cy.wait(delay * 2);
6565
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').trigger('mouseover').click();
@@ -80,7 +80,7 @@ describe('Creating visualizations', () => {
8080
});
8181
cy.get('.euiButton__text').contains('Refresh').trigger('mouseover').click();
8282
cy.wait(delay);
83-
supressResizeObserverIssue();
83+
suppressResizeObserverIssue();
8484
cy.get('button[id="main-content-vis"]').contains('Visualizations').trigger('mouseover').click();
8585
cy.wait(delay);
8686
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').trigger('mouseover').click();
@@ -384,7 +384,7 @@ describe('Testing a panel', () => {
384384
});
385385
cy.get('button[data-test-subj="superDatePickerApplyTimeButton"]').click();
386386

387-
supressResizeObserverIssue();
387+
suppressResizeObserverIssue();
388388
cy.get('button[id="main-content-vis"]').contains('Visualizations').trigger('mouseover').click();
389389
cy.wait(delay * 2);
390390
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').trigger('mouseover').click();
@@ -420,7 +420,7 @@ describe('Testing a panel', () => {
420420
.contains(PPL_VISUALIZATIONS_NAMES[0])
421421
.should('exist');
422422
cy.get('button[aria-label="actionMenuButton"]').eq(0).trigger('mouseover').click();
423-
supressResizeObserverIssue();
423+
suppressResizeObserverIssue();
424424
cy.get('button[data-test-subj="editVizContextMenuItem"]').click();
425425
cy.wait(delay * 3);
426426
cy.url().should('match', new RegExp('(.*)#/event_analytics/explorer'));

.cypress/integration/7_app_analytics.spec.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {
3333
TYPING_DELAY,
3434
timeoutDelay
3535
} from '../utils/app_constants';
36-
import { supressResizeObserverIssue } from '../utils/constants';
36+
import { suppressResizeObserverIssue } from '../utils/constants';
3737

3838
describe('Creating application', () => {
3939
beforeEach(() => {
@@ -233,7 +233,7 @@ describe('Viewing application', () => {
233233
cy.get('[data-test-subj="app-analytics-serviceTab"]').click();
234234
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
235235
cy.get('[data-test-subj="app-analytics-traceTab"]').click();
236-
supressResizeObserverIssue();
236+
suppressResizeObserverIssue();
237237
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
238238
cy.get('[data-test-subj="app-analytics-logTab"]').click();
239239
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
@@ -262,7 +262,7 @@ describe('Viewing application', () => {
262262
cy.get('[data-test-subj="app-analytics-serviceTab"]').click();
263263
cy.wait(delay);
264264
cy.get('.euiLink').contains('authentication').click();
265-
supressResizeObserverIssue();
265+
suppressResizeObserverIssue();
266266
cy.get('[data-test-subj="serviceDetailFlyoutTitle"]').should('be.visible');
267267
cy.get('[data-test-subj="serviceDetailFlyout"]').within(($flyout) => {
268268
cy.get('[data-test-subj="Number of connected servicesDescriptionList"]').should('contain', '3');
@@ -279,7 +279,7 @@ describe('Viewing application', () => {
279279

280280
it('Opens trace detail flyout when Trace ID is clicked', () => {
281281
cy.get('[data-test-subj="app-analytics-traceTab"]').click();
282-
supressResizeObserverIssue();
282+
suppressResizeObserverIssue();
283283
cy.wait(delay);
284284
cy.get('[title="03f9c770db5ee2f1caac0afc36db49ba"]').click();
285285
cy.get('[data-test-subj="traceDetailFlyoutTitle"]').should('be.visible');
@@ -300,7 +300,7 @@ describe('Viewing application', () => {
300300

301301
it('Opens span detail flyout when Span ID is clicked', () => {
302302
cy.get('[data-test-subj="app-analytics-traceTab"]').click();
303-
supressResizeObserverIssue();
303+
suppressResizeObserverIssue();
304304
cy.wait(delay);
305305
cy.get('[data-test-subj="dataGridRowCell"]').contains('5ff3516909562c60').click();
306306
cy.get('[data-test-subj="spanDetailFlyout"]').should('be.visible');
@@ -334,7 +334,7 @@ describe('Viewing application', () => {
334334
changeTimeTo24('months');
335335
cy.wait(delay * 2);
336336
cy.get('[data-test-subj="main-content-visTab"]').click();
337-
supressResizeObserverIssue();
337+
suppressResizeObserverIssue();
338338
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]').click();
339339
cy.get('[data-test-subj="eventExplorer__querySaveName"]').click().type(visOneName);
340340
cy.wait(delay);
@@ -351,7 +351,7 @@ describe('Viewing application', () => {
351351
cy.get('[data-test-subj="app-analytics-panelTab"]').click();
352352
cy.get('[aria-label="actionMenuButton"]').click();
353353
cy.get('[data-test-subj="editVizContextMenuItem"]').click();
354-
supressResizeObserverIssue();
354+
suppressResizeObserverIssue();
355355
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
356356
cy.get('.euiTab[id="availability-panel"]').click();
357357
cy.get('[title="Bar"]').click();
@@ -389,7 +389,7 @@ describe('Viewing application', () => {
389389
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
390390
cy.wait(delay);
391391
cy.get('[data-test-subj="main-content-visTab"]').click();
392-
supressResizeObserverIssue();
392+
suppressResizeObserverIssue();
393393
cy.get('.euiTab[id="availability-panel"]').click();
394394
cy.get('[title="Bar"]').click();
395395
cy.focused().type('{downArrow}');

.cypress/utils/app_constants.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { supressResizeObserverIssue } from './constants';
6+
import { suppressResizeObserverIssue } from './constants';
77

88
export const delay = 1000;
99
export const timeoutDelay = 30000;
@@ -18,13 +18,13 @@ export const moveToHomePage = () => {
1818
export const moveToCreatePage = () => {
1919
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/application_analytics/`);
2020
cy.get('.euiButton[href="#/application_analytics/create"]').eq(0).click();
21-
supressResizeObserverIssue();
21+
suppressResizeObserverIssue();
2222
cy.get('[data-test-subj="createPageTitle"]').should('contain', 'Create application');
2323
};
2424

2525
export const moveToApplication = (name) => {
2626
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/application_analytics/`);
27-
supressResizeObserverIssue();
27+
suppressResizeObserverIssue();
2828
cy.wait(delay * 6);
2929
cy.get(`[data-test-subj="${name}ApplicationLink"]`).click();
3030
cy.wait(delay);
@@ -36,7 +36,7 @@ export const moveToEditPage = () => {
3636
moveToApplication(nameOne);
3737
cy.get('[data-test-subj="app-analytics-configTab"]').click();
3838
cy.get('[data-test-subj="editApplicationButton"]').click();
39-
supressResizeObserverIssue();
39+
suppressResizeObserverIssue();
4040
cy.wait(delay);
4141
cy.get('[data-test-subj="createPageTitle"]').should('contain', 'Edit application');
4242
};

0 commit comments

Comments
 (0)