diff --git a/.cypress/integration/trace_analytics_test/trace_analytics_dashboard.spec.js b/.cypress/integration/trace_analytics_test/trace_analytics_dashboard.spec.js index 5edf0d33a..579162d79 100644 --- a/.cypress/integration/trace_analytics_test/trace_analytics_dashboard.spec.js +++ b/.cypress/integration/trace_analytics_test/trace_analytics_dashboard.spec.js @@ -5,7 +5,7 @@ /// -import { testDataSet, delay, setTimeFilter, jaegerTestDataSet } from '../../utils/constants'; +import { testDataSet, setTimeFilter, jaegerTestDataSet } from '../../utils/constants'; import { suppressResizeObserverIssue } from '../../utils/constants'; suppressResizeObserverIssue();//needs to be in file once @@ -102,15 +102,15 @@ describe('Testing dashboard table', () => { }); it('Adds the percentile filters', () => { - cy.contains(' >= 95 percentile').click({ force: true }); - cy.contains(' >= 95 percentile').click({ force: true }); + + cy.get('[data-test-subj="dashboardTable"]').should('be.visible'); + cy.get('[data-test-subj="dashboard-table-percentile-button-2"]').click(); cy.contains('Latency percentile within trace group: >= 95th').should('exist'); cy.contains(' (7)').should('exist'); cy.contains('318.69').should('exist'); - cy.contains(' < 95 percentile').click({ force: true }); - cy.contains(' < 95 percentile').click({ force: true }); + cy.get('[data-test-subj="dashboard-table-percentile-button-1"]').click(); cy.contains('Latency percentile within trace group: < 95th').should('exist'); cy.contains(' (8)').should('exist'); @@ -148,6 +148,7 @@ describe('Testing plots', () => { it('Renders service map', () => { // plotly scale texts are in attribute "data-unformatted" + cy.get('.euiSideNavItemButton__label').contains('Services').click(); cy.get('text.ytitle[data-unformatted="Average duration (ms)"]').should('exist'); cy.get('text[data-unformatted="200"]').should('exist'); cy.get('.vis-network').should('exist'); @@ -218,7 +219,6 @@ describe('Latency by trace group table', () =>{ it('Verify Search engine on Trace dashboard', () => { cy.get('.euiFieldSearch.euiFieldSearch--fullWidth').click().type('client_pay_order'); cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click(); - cy.wait(delay);//Fails without cy.get('.euiTableCellContent.euiTableCellContent--alignRight.euiTableCellContent--overflowingContent').contains('211.04').should('exist'); cy.get('button[data-test-subj="dashboard-table-trace-group-name-button"]').eq(0).click(); cy.get('.euiBadge.euiBadge--hollow.euiBadge--iconRight.globalFilterItem').click(); @@ -250,25 +250,22 @@ describe('Testing filters on trace analytics page', { scrollBehavior: false }, ( }); it('Verify Change all filters', () =>{ - cy.wait(delay);//Needed after removing waits from setTimeFilter() cy.get('[data-test-subj="global-filter-button"]').click(); cy.get('.euiContextMenuPanelTitle').contains('Change all filters').should('exist'); - cy.get('.euiContextMenuItem__text').eq(0).contains('Enable all'); - cy.get('.euiContextMenuItem__text').eq(1).contains('Disable all'); - cy.get('.euiContextMenuItem__text').eq(2).contains('Invert inclusion'); - cy.get('.euiContextMenuItem__text').eq(3).contains('Invert enabled/disabled'); - cy.get('.euiContextMenuItem__text').eq(4).contains('Remove all'); + cy.get('.euiContextMenuItem__text').eq(1).contains('Enable all'); + cy.get('.euiContextMenuItem__text').eq(2).contains('Disable all'); + cy.get('.euiContextMenuItem__text').eq(3).contains('Invert inclusion'); + cy.get('.euiContextMenuItem__text').eq(4).contains('Invert enabled/disabled'); + cy.get('.euiContextMenuItem__text').eq(5).contains('Remove all'); }) it('Verify Add filter section', () => { - cy.wait(delay);//Needed after removing waits from setTimeFilter() - cy.get('[data-test-subj="addfilter"]').contains('+ Add filter').click(); - cy.get('.euiPopoverTitle').contains('Add filter').should('exist'); - cy.wait(delay);//drop down won't open without - cy.get('.euiComboBox__inputWrap.euiComboBox__inputWrap--noWrap').eq(0).trigger('mouseover').click(); - cy.get('.euiComboBoxOption__content').eq(1).click(); - cy.get('.euiComboBox__inputWrap.euiComboBox__inputWrap--noWrap').eq(1).trigger('mouseover').click(); - cy.get('.euiComboBoxOption__content').eq(2).click(); + cy.get('[data-test-subj="global-filter-button"]').click(); + cy.get('.euiContextMenuItem__text').contains('Add filter').click(); + cy.get('[data-test-subj="field-selector-filter-panel"]').click(); + cy.get('[data-test-subj="field-selector-filter-panel"]').type('traceId{enter}'); + cy.get('[data-test-subj="operator-selector-filter-panel"]').click(); + cy.get('[data-test-subj="operator-selector-filter-panel"]').type('exists{enter}'); cy.get('.euiButton.euiButton--primary.euiButton--fill').contains('Save').click(); cy.get('.euiBadge__content').should('exist').click(); cy.get('.euiIcon.euiIcon--medium.euiContextMenu__arrow').click(); diff --git a/.cypress/integration/trace_analytics_test/trace_analytics_services.spec.js b/.cypress/integration/trace_analytics_test/trace_analytics_services.spec.js index 1f278c2b3..024e3f984 100644 --- a/.cypress/integration/trace_analytics_test/trace_analytics_services.spec.js +++ b/.cypress/integration/trace_analytics_test/trace_analytics_services.spec.js @@ -5,7 +5,7 @@ /// -import { delay, SERVICE_NAME, SERVICE_SPAN_ID, setTimeFilter, verify_traces_spans_data_grid_cols_exists, count_table_row, AUTH_SERVICE_SPAN_ID } from '../../utils/constants'; +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 @@ -32,6 +32,8 @@ describe('Testing services table', () => { win.sessionStorage.clear(); }, }); + cy.get("[data-test-subj='indexPattern-switch-link']").click(); + cy.get("[data-test-subj='data_prepper-mode']").click(); setTimeFilter(); }); @@ -44,13 +46,13 @@ describe('Testing services table', () => { it('Searches correctly', () => { cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}{enter}`); - cy.get('.euiButton__text').contains('Refresh').click(); + 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--flexGrow10 .panel-title').contains('Services').should('exist'); + 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'); @@ -95,15 +97,17 @@ describe('Testing service view', () => { 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 - cy.get('[data-test-subj="service-link"]').eq(0).click(); + expandServiceView(0); }); it('Renders service view', () => { - cy.get('h2.euiTitle').contains(SERVICE_NAME).should('exist'); + 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'); @@ -111,7 +115,7 @@ describe('Testing service view', () => { it('Has working breadcrumbs', () => { cy.get('.euiBreadcrumb').contains(SERVICE_NAME).click(); - cy.get('h2.euiTitle').contains(SERVICE_NAME).should('exist'); + 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(); @@ -138,6 +142,8 @@ describe('Testing Service map', () => { win.sessionStorage.clear(); }, }); + cy.get("[data-test-subj='indexPattern-switch-link']").click(); + cy.get("[data-test-subj='data_prepper-mode']").click(); setTimeFilter(); }); @@ -149,7 +155,7 @@ describe('Testing Service map', () => { cy.contains('60%'); cy.get('[data-text = "Duration"]').click(); cy.contains('100'); - cy.get('.euiText.euiText--medium').contains('Focus on').should('exist'); + cy.get('.euiFormLabel.euiFormControlLayout__prepend').contains('Focus on').should('exist'); cy.get('[placeholder="Service name"]').focus().type('database{enter}'); }) }); @@ -161,28 +167,34 @@ describe('Testing traces Spans table verify table headers functionality', () => 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').click(); + 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').click(); - cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click(); + 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').click(); + 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'); @@ -190,7 +202,8 @@ describe('Testing traces Spans table verify table headers functionality', () => }); it('Hide all button Spans table', () => { - cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click(); + 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(); @@ -199,7 +212,8 @@ describe('Testing traces Spans table verify table headers functionality', () => }); it('Render Spans table and change data table Density', () => { - cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click(); + cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist'); + expandServiceView(1); verify_traces_spans_data_grid_cols_exists(); cy.get('.euiButtonEmpty__text').contains('Density').click(); cy.get('.euiButtonContent__icon').eq(5).click(); @@ -208,7 +222,8 @@ describe('Testing traces Spans table verify table headers functionality', () => }); it('Render Spans table and and click on sort', () => { - cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click(); + cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist'); + expandServiceView(1); verify_traces_spans_data_grid_cols_exists(); cy.get('[data-test-subj="dataGridColumnSortingButton"]').contains('Sort fields').should('exist').click(); cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection"]').click(); @@ -233,14 +248,17 @@ describe('Testing traces Spans table and verify columns functionality', () => { 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').click(); + 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"] .euiTitle.euiTitle--medium').contains('Span detail').should('exist'); + 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'); @@ -251,11 +269,13 @@ describe('Testing traces Spans table and verify columns functionality', () => { cy.get('.euiBadge__content .euiBadge__text').contains('spanId: 277a5934acf55dcf').should('exist'); count_table_row(1); cy.get('[aria-label="remove current filter"]').click(); + 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').click(); + cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist'); + expandServiceView(1); verify_traces_spans_data_grid_cols_exists(); cy.get('.euiDataGridHeaderCell__content').contains('Span ID').click(); cy.get('.euiListGroupItem__label').contains('Hide column').click(); diff --git a/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js b/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js index 843e6640a..acfff9d33 100644 --- a/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js +++ b/.cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js @@ -29,13 +29,15 @@ describe('Testing traces table', () => { 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 traces table', () => { cy.contains(' (108)').should('exist'); cy.contains('03/25/2021 10:23:45').should('exist'); - cy.contains('03f9c770db5ee2f1caac0...').should('exist'); + cy.contains('03f9c770db5ee2f1caac0afc36db49ba').should('exist'); cy.contains('224.99').should('exist'); // test data contains output from data-prepper 0.8, which doesn't have fields denormalized @@ -52,7 +54,7 @@ describe('Testing traces table', () => { it('Searches correctly', () => { cy.get('input[type="search"]').focus().type(`${TRACE_ID}{enter}`); - cy.get('.euiButton__text').contains('Refresh').click(); + cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click(); cy.contains(' (1)').should('exist'); cy.contains('03/25/2021 10:21:22').should('exist'); }); @@ -65,9 +67,11 @@ describe('Testing trace view', () => { 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"]').focus().type(`${TRACE_ID}`); - cy.get('.euiButton__text').contains('Refresh').click(); + cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click(); cy.get('.euiTableRow').should('have.length.lessThan', 3);//Replaces wait cy.get('[data-test-subj="trace-link"]').eq(0).click(); }); @@ -84,11 +88,10 @@ describe('Testing trace view', () => { }); it('Has working breadcrumbs', () => { - cy.get(`.euiBreadcrumb[href="#/traces/${TRACE_ID}"]`).click(); - cy.get('h2.euiTitle').contains(TRACE_ID).should('exist'); - cy.get('.euiBreadcrumb[href="#/traces"]').click(); - cy.get('.euiBreadcrumb[href="#/"]').click(); - cy.get('.euiBreadcrumb[href="observability-logs#/"]').click(); + cy.get('.euiBreadcrumb').contains(TRACE_ID).click(); + cy.get('.euiBreadcrumb').contains('Traces').click(); + cy.get('.euiBreadcrumb').contains('Trace analytics').click(); + cy.get('.euiBreadcrumb').contains('Observability').click(); cy.get('.euiTitle').contains('Logs').should('exist'); }); @@ -117,6 +120,8 @@ describe('Testing traces table', () => { win.sessionStorage.clear(); }, }); + cy.get("[data-test-subj='indexPattern-switch-link']").click(); + cy.get("[data-test-subj='data_prepper-mode']").click(); setTimeFilter(); }); @@ -132,8 +137,8 @@ describe('Testing traces table', () => { cy.get('[data-test-subj="pagination-button-previous"]').click(); cy.contains('224.99').should('exist'); cy.get('.euiButtonEmpty').contains('5').click(); - cy.contains('690d3c7af1a78cf89c43e...').should('exist'); - cy.contains('5be8370207cbb002a165d...').click(); + cy.contains('690d3c7af1a78cf89c43e').should('exist'); + cy.contains('5be8370207cbb002a165d').click(); cy.contains('client_create_order').should('exist'); cy.get('path[style*="rgb(116, 146, 231)"]').should('exist'); cy.go('back'); diff --git a/.cypress/utils/constants.js b/.cypress/utils/constants.js index 2f6150d30..6c2e3fa69 100644 --- a/.cypress/utils/constants.js +++ b/.cypress/utils/constants.js @@ -18,7 +18,7 @@ export const DATASOURCES_PATH = { export const TRACE_ID = '8832ed6abbb2a83516461960c89af49d'; export const SPAN_ID = 'a673bc074b438374'; export const SERVICE_NAME = 'frontend-client'; -export const SERVICE_SPAN_ID = '7df5609a6d104736'; +export const SERVICE_SPAN_ID = 'e275ac9d21929e9b'; export const AUTH_SERVICE_SPAN_ID = '277a5934acf55dcf'; export const testDataSet = [ @@ -68,26 +68,27 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => { cy.get('button.euiButtonEmpty[aria-label="Date quick select"]').click(); cy.get('.euiQuickSelect__applyButton').click(); cy.get('.euiSuperDatePicker__prettyFormatLink').click(); - cy.get( - 'button.euiDatePopoverButton--start[data-test-subj="superDatePickerstartDatePopoverButton"]' - ).click(); cy.get('.euiTab__content').contains('Absolute').click(); cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]') .focus() .type('{selectall}' + startTime, { force: true }); if (setEndTime) { - cy.get( - 'button.euiDatePopoverButton--end[data-test-subj="superDatePickerendDatePopoverButton"]' - ).click(); + cy.get('button.euiDatePopoverButton--end[data-test-subj="superDatePickerendDatePopoverButton"]').click(); cy.get('.euiTab__content').contains('Absolute').click(); cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]') .focus() .type('{selectall}' + endTime, { force: true }); } - if (refresh) cy.get('.euiButton__text').contains('Refresh').click(); + if (refresh) cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click(); cy.get('.euiTableRow').should('have.length.greaterThan', 3); //Replaces Wait }; +export const expandServiceView = (rowIndex = 0) => { + cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(rowIndex).click(); + cy.get('[data-test-subj="ActionContextMenu"]').click(); + cy.get('[data-test-subj="viewServiceButton"]').click(); +}; + // notebooks export const TEST_NOTEBOOK = 'Test Notebook'; export const TEST_INTEGRATION_INSTANCE = 'nginx-test'; @@ -130,6 +131,7 @@ export const PPL_QUERY_TEXT = `%ppl source=opensearch_dashboards_sample_data_flights {enter} `; + export const suppressResizeObserverIssue = () => { // exception is thrown on loading EuiDataGrid in cypress only, ignore for now cy.on('uncaught:exception', (err, runnable) => { diff --git a/public/components/trace_analytics/components/common/filters/__tests__/__snapshots__/filter_edit_popover.test.tsx.snap b/public/components/trace_analytics/components/common/filters/__tests__/__snapshots__/filter_edit_popover.test.tsx.snap index 76e2ee091..ed16c4579 100644 --- a/public/components/trace_analytics/components/common/filters/__tests__/__snapshots__/filter_edit_popover.test.tsx.snap +++ b/public/components/trace_analytics/components/common/filters/__tests__/__snapshots__/filter_edit_popover.test.tsx.snap @@ -91,6 +91,7 @@ exports[`Filter popover component renders filter popover 1`] = ` @@ -371,6 +373,7 @@ exports[`Filter popover component renders filter popover 1`] = ` diff --git a/public/components/trace_analytics/components/common/filters/filter_edit_popover.tsx b/public/components/trace_analytics/components/common/filters/filter_edit_popover.tsx index dc4d4b6d8..22b97b68a 100644 --- a/public/components/trace_analytics/components/common/filters/filter_edit_popover.tsx +++ b/public/components/trace_analytics/components/common/filters/filter_edit_popover.tsx @@ -45,6 +45,7 @@ export function FilterEditPopover(props: { getFilterFields(mode, page, attributesFilterFields).map((field) => ({ label: field, + 'data-test-subj': `filterFieldOptions-${field}`, })), [mode, page, attributesFilterFields] );