diff --git a/.cypress/integration/4_trace_analytics_dashboard.spec.js b/.cypress/integration/4_trace_analytics_dashboard.spec.js index f9bfb57603..38441914db 100644 --- a/.cypress/integration/4_trace_analytics_dashboard.spec.js +++ b/.cypress/integration/4_trace_analytics_dashboard.spec.js @@ -5,7 +5,7 @@ /// -import { testDataSet, delay, setTimeFilter } from '../utils/constants'; +import { testDataSet, delay, setTimeFilter, jaegerTestDataSet } from '../utils/constants'; describe('Dump test data', () => { it('Indexes test data', () => { @@ -100,13 +100,10 @@ describe('Testing dashboard table', () => { it('Has working breadcrumbs', () => { cy.get('.euiBreadcrumb').contains('Dashboard').click(); - cy.wait(delay); cy.get('.euiTitle').contains('Dashboard').should('exist'); cy.get('.euiBreadcrumb').contains('Trace analytics').click(); - cy.wait(delay); cy.get('.euiTitle').contains('Dashboard').should('exist'); cy.get('.euiBreadcrumb').contains('Observability').click(); - cy.wait(delay); cy.get('.euiTitle').contains('Event analytics').should('exist'); }); @@ -137,7 +134,7 @@ describe('Testing dashboard table', () => { }); it('Redirects to traces table with filter', () => { - cy.wait(delay * 5); + cy.wait(delay); cy.get('.euiLink').contains('13').click(); cy.wait(delay); @@ -177,7 +174,6 @@ describe('Testing plots', () => { cy.get('text[data-unformatted="50"]').should('exist'); cy.get('input[type="search"]').eq(1).focus().type('payment{enter}'); - cy.wait(delay); }); it('Renders plots', () => { @@ -200,13 +196,12 @@ describe('Latency by trace group table', () =>{ it('Verify columns in Latency by trace group table along with pagination functionality', () => { cy.get('span.panel-title').eq(0).should('exist'); - cy.wait(delay); - cy.get('span[title="Trace group name"]').should('exist'); - cy.get('span[title="Latency variance (ms)"]').should('exist'); - cy.get('span[title="Average latency (ms)"]').should('exist'); - cy.get('span[title="24-hour latency trend"]').should('exist'); - cy.get('span[title="Error rate"] .euiToolTipAnchor').should('exist'); - cy.get('span[title="Traces"] .euiToolTipAnchor').should('exist'); + cy.get('[data-test-subj="tableHeaderCell_dashboard_trace_group_name_0"]').should('exist'); + cy.get('[data-test-subj="tableHeaderCell_dashboard_latency_variance_1"]').should('exist'); + cy.get('[data-test-subj="tableHeaderCell_dashboard_average_latency_2"]').should('exist'); + cy.get('[data-test-subj="tableHeaderCell_24_hour_latency_trend_3"]').should('exist'); + cy.get('[data-test-subj="tableHeaderCell_dashboard_error_rate_4"]').should('exist'); + cy.get('[data-test-subj="tableHeaderCell_dashboard_traces_5"]').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(); @@ -235,7 +230,8 @@ describe('Latency by trace group table', () =>{ }); it('Verify Search engine on Trace dashboard', () => { - cy.get('.euiFieldSearch.euiFieldSearch--fullWidth').click().type('client_pay_order{enter}'); + cy.get('.euiFieldSearch.euiFieldSearch--fullWidth').click().type('client_pay_order'); + cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click(); cy.wait(delay); cy.get('.euiTableCellContent.euiTableCellContent--alignRight.euiTableCellContent--overflowingContent').contains('211.04').should('exist'); cy.get('button[data-test-subj="dashboard-table-trace-group-name-button"]').click(); @@ -257,7 +253,7 @@ describe('Latency by trace group table', () =>{ }); }); -describe('Testing filters on trace analytics page', () =>{ +describe('Testing filters on trace analytics page', { scrollBehavior: false }, () =>{ beforeEach(() => { cy.visit('app/observability-dashboards#/trace_analytics/home', { onBeforeLoad: (win) => { @@ -268,7 +264,7 @@ describe('Testing filters on trace analytics page', () =>{ }); it('Verify Change all filters', () =>{ - cy.get('.euiButtonIcon.euiButtonIcon--primary.euiButtonIcon--empty.euiButtonIcon--xSmall').click(); + 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'); @@ -278,9 +274,8 @@ describe('Testing filters on trace analytics page', () =>{ }) it('Verify Add filter section', () => { - cy.get('.euiPopover.euiPopover--anchorDownLeft').contains('+ Add filter').click(); + cy.get('[data-test-subj="addfilter"]').contains('+ Add filter').click(); cy.get('.euiPopoverTitle').contains('Add filter').should('exist'); - cy.wait(delay); 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(); @@ -292,3 +287,108 @@ describe('Testing filters on trace analytics page', () =>{ cy.get('.euiIcon.euiIcon--small.euiIcon--inherit.euiBadge__icon').click(); }) }); + +describe('Dump jaeger test data', () => { + it('Indexes test data', () => { + const dumpDataSet = (mapping_url, data_url, index) => { + cy.request({ + method: 'POST', + failOnStatusCode: false, + url: 'api/console/proxy', + headers: { + 'content-type': 'application/json;charset=UTF-8', + 'osd-xsrf': true, + }, + qs: { + path: `${index}`, + method: 'PUT', + }, + }); + + cy.request(mapping_url).then((response) => { + cy.request({ + method: 'POST', + form: true, + url: 'api/console/proxy', + headers: { + 'content-type': 'application/json;charset=UTF-8', + 'osd-xsrf': true, + }, + qs: { + path: `${index}/_mapping`, + method: 'POST', + }, + body: response.body, + }); + }); + + cy.request(data_url).then((response) => { + cy.request({ + method: 'POST', + form: true, + url: 'api/console/proxy', + headers: { + 'content-type': 'application/json;charset=UTF-8', + 'osd-xsrf': true, + }, + qs: { + path: `${index}/_bulk`, + method: 'POST', + }, + body: response.body, + }); + }); + }; + + jaegerTestDataSet.forEach(({ mapping_url, data_url, index }) => + dumpDataSet(mapping_url, data_url, index) + ); + }); +}); + +describe('Testing switch mode to jaeger', () => { + beforeEach(() => { + cy.visit('app/observability-dashboards#/trace_analytics/home', { + onBeforeLoad: (win) => { + win.sessionStorage.clear(); + }, + }); + setTimeFilter(); + cy.get("[data-test-subj='indexPattern-switch-link']").click(); + cy.get("[data-test-subj='jaeger-mode']").click(); + }); + + it('Verifies errors mode columns and data', () => { + cy.contains('redis,GetDriver').should('exist'); + cy.contains('14.7').should('exist'); + cy.contains('100%').should('exist'); + cy.contains('7').should('exist'); + cy.contains('Service and Operation Name').should('exist'); + cy.contains('Average latency (ms)').should('exist'); + cy.contains('Error rate').should('exist'); + cy.contains('Traces').should('exist'); + }); + + it('Verifies traces links to traces page', () => { + cy.wait(delay); + cy.get('.euiLink').contains('7').click(); + cy.wait(delay); + + cy.get('h2.euiTitle').contains('Traces').should('exist'); + cy.contains(' (7)').should('exist'); + cy.get("[data-test-subj='filterBadge']").eq(0).contains('process.serviceName: redis') + cy.get("[data-test-subj='filterBadge']").eq(1).contains('operationName: GetDriver'); + }) + + it('Switches to throughput mode and verifies columns and data', () => { + cy.get("[data-test-subj='throughput-toggle']").click(); + cy.contains('frontend,HTTP GET /dispatch').should('exist'); + cy.contains('711.38').should('exist'); + cy.contains('0%').should('exist'); + cy.contains('8').should('exist'); + cy.contains('Service and Operation Name').should('exist'); + cy.contains('Average latency (ms)').should('exist'); + cy.contains('Error rate').should('exist'); + cy.contains('Traces').should('exist'); + }); +}); diff --git a/.cypress/integration/5_trace_analytics_services.spec.js b/.cypress/integration/5_trace_analytics_services.spec.js index bd2cd4c419..66ca860b13 100644 --- a/.cypress/integration/5_trace_analytics_services.spec.js +++ b/.cypress/integration/5_trace_analytics_services.spec.js @@ -98,12 +98,16 @@ describe('Testing service view', () => { if (err.message.includes('ResizeObserver loop')) return false; }); - cy.visit(`app/observability-dashboards#/trace_analytics/services/${SERVICE_NAME}`, { + cy.visit(`app/observability-dashboards#/trace_analytics/services`, { onBeforeLoad: (win) => { win.sessionStorage.clear(); }, }); - setTimeFilter(undefined, false); + setTimeFilter(); + cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}`); + cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click(); + cy.wait(delay); + cy.get('[data-test-subj="service-link"]').eq(0).click(); }); it('Renders service view', () => { @@ -129,7 +133,7 @@ describe('Testing service view', () => { }); it('Renders spans data grid, flyout, filters', () => { - cy.get('.euiLink').contains(SERVICE_SPAN_ID).trigger('mouseover', { force: true }); + 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.wait(delay); cy.contains('Span detail').should('exist'); @@ -168,6 +172,10 @@ describe('Testing Service map', () => { describe('Testing traces Spans table verify table headers functionality', () => { beforeEach(() => { + cy.on('uncaught:exception', (err, runnable) => { + if (err.message.includes('ResizeObserver loop')) + return false; + }); cy.visit('app/observability-dashboards#/trace_analytics/services', { onBeforeLoad: (win) => { win.sessionStorage.clear(); @@ -181,7 +189,7 @@ describe('Testing traces Spans table verify table headers functionality', () => cy.contains('analytics-service, frontend-client, recommendation').should('exist'); cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click(); cy.get('.panel-title').contains('Spans').should('exist'); - cy.get('.panel-title-count').contains('5').should('exist'); + cy.get('.panel-title-count').contains('8').should('exist'); verify_traces_spans_data_grid_cols_exists(); }); @@ -189,8 +197,8 @@ describe('Testing traces Spans table verify table headers functionality', () => cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click(); cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click(); cy.get('.euiSwitch.euiSwitch--compressed.euiSwitch--mini .euiSwitch__button').eq(3).click(); - cy.get('.euiButtonEmpty__text').eq(3).click().should('have.text', '2 columns hidden'); - count_table_row(5); + cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click().should('have.text', '2 columns hidden'); + count_table_row(8); }); it('Show all button Spans table', () => { @@ -231,8 +239,8 @@ describe('Testing traces Spans table verify table headers functionality', () => cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-startTime"]').click(); cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-endTime').click(); cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-status.code"]').click(); - cy.get('.euiButtonEmpty__text').eq(5).contains('8 fields sorted').should('exist'); cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection"]').click(); + cy.get('[data-test-subj="dataGridColumnSortingButton"]').should('have.text', '8 fields sorted'); cy.get('[data-test-subj="dataGridColumnSortingButton"]').should('exist').click(); }); }); @@ -255,15 +263,17 @@ describe('Testing traces Spans table and verify columns functionality', () => { cy.get('[data-test-subj="spanDetailFlyout"] .euiTitle.euiTitle--medium').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('.euiDescriptionList__description .euiFlexItem').eq(0).contains('d03fecfa0f55b77c').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: d03fecfa0f55b77c').should('exist'); + cy.get('.euiBadge__content .euiBadge__text').contains('spanId: 277a5934acf55dcf').should('exist'); + cy.wait(delay); count_table_row(1); cy.get('[aria-label="remove current filter"]').click(); - count_table_row(5); + cy.wait(delay); + count_table_row(8); }); it('Render Spans table and verify Column functionality', () => { @@ -277,3 +287,38 @@ describe('Testing traces Spans table and verify columns functionality', () => { cy.get('.euiListGroupItem__label').contains('Move left').click(); }); }); + + +describe('Testing switch mode to jaeger', () => { + beforeEach(() => { + cy.visit('app/observability-dashboards#/trace_analytics/services', { + onBeforeLoad: (win) => { + win.sessionStorage.clear(); + }, + }); + setTimeFilter(); + cy.get("[data-test-subj='indexPattern-switch-link']").click(); + cy.get("[data-test-subj='jaeger-mode']").click(); + }); + + 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 latency (ms)').should('exist'); + cy.contains('Error rate').should('exist'); + cy.contains('Throughput').should('exist'); + cy.contains('Traces').should('exist'); + }); + + it('Verifies traces links to traces page with filter applied', () => { + cy.wait(delay); + cy.get('.euiLink').contains('7').click(); + cy.wait(delay); + + cy.get('h2.euiTitle').contains('Traces').should('exist'); + cy.contains(' (7)').should('exist'); + cy.get("[data-test-subj='filterBadge']").eq(0).contains('process.serviceName: customer') + }) +}); \ No newline at end of file diff --git a/.cypress/integration/6_trace_analytics_traces.spec.js b/.cypress/integration/6_trace_analytics_traces.spec.js index 14f71ec101..8943991ff7 100644 --- a/.cypress/integration/6_trace_analytics_traces.spec.js +++ b/.cypress/integration/6_trace_analytics_traces.spec.js @@ -61,11 +61,16 @@ describe('Testing traces table', () => { describe('Testing trace view', () => { beforeEach(() => { - cy.visit(`app/observability-dashboards#/trace_analytics/traces/${TRACE_ID}`, { + cy.visit(`app/observability-dashboards#/trace_analytics/traces`, { onBeforeLoad: (win) => { win.sessionStorage.clear(); }, }); + setTimeFilter(); + cy.get('input[type="search"]').focus().type(`${TRACE_ID}`); + cy.get('.euiButton__text').contains('Refresh').click(); + cy.wait(delay); + cy.get('[data-test-subj="trace-link"]').eq(0).click(); }); it('Renders the trace view', () => { @@ -153,3 +158,33 @@ describe('Testing traces table', () => { }); }); }); + +describe('Testing switch mode to jaeger', () => { + beforeEach(() => { + cy.visit('app/observability-dashboards#/trace_analytics/traces', { + onBeforeLoad: (win) => { + win.sessionStorage.clear(); + }, + }); + setTimeFilter(); + cy.get("[data-test-subj='indexPattern-switch-link']").click(); + cy.get("[data-test-subj='jaeger-mode']").click(); + }); + + it('Verifies columns and data', () => { + cy.contains('08ee9fd9bf964384').should('exist'); + cy.contains('0.012').should('exist'); + cy.contains('No').should('exist'); + cy.contains('01/24/2023 08:33:35').should('exist'); + cy.contains('Latency (ms)').should('exist'); + cy.contains('Trace ID').should('exist'); + cy.contains('Errors').should('exist'); + cy.contains('Last updated').should('exist'); + }); + + it('Verifies Trace View', () => { + cy.contains('08ee9fd9bf964384').click(); + cy.contains("Time spent by service").should('exist'); + cy.get("[data-test-subj='span-gantt-chart-panel']").should('exist'); + }) +}); diff --git a/.cypress/utils/constants.js b/.cypress/utils/constants.js index 415679aba7..6b9e7b77e8 100644 --- a/.cypress/utils/constants.js +++ b/.cypress/utils/constants.js @@ -30,6 +30,19 @@ export const testDataSet = [ }, ] +export const jaegerTestDataSet = [ + { + mapping_url: 'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/jaeger-service-2023-01-24-mappings.json', + data_url: 'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/jaeger-service-2023-01-24.json', + index: 'jaeger-service-2023-01-24', + }, + { + mapping_url: 'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/jaeger-span-2023-01-24-mappings.json', + data_url: 'https://raw.githubusercontent.com/opensearch-project/dashboards-observability/main/.cypress/utils/jaeger-span-2023-01-24.json', + index: 'jaeger-span-2023-01-24', + }, +] + export const setTimeFilter = (setEndTime = false, refresh = true) => { const startTime = 'Mar 25, 2021 @ 10:00:00.000'; const endTime = 'Mar 25, 2021 @ 11:00:00.000'; diff --git a/public/components/trace_analytics/components/common/__tests__/__snapshots__/search_bar.test.tsx.snap b/public/components/trace_analytics/components/common/__tests__/__snapshots__/search_bar.test.tsx.snap index ae5d60c25d..8489eec0a0 100644 --- a/public/components/trace_analytics/components/common/__tests__/__snapshots__/search_bar.test.tsx.snap +++ b/public/components/trace_analytics/components/common/__tests__/__snapshots__/search_bar.test.tsx.snap @@ -1015,6 +1015,7 @@ exports[`Search bar components renders search bar 1`] = ` /> } closePopover={[Function]} + data-test-subj="global-filter-button" display="inlineBlock" hasArrow={true} isOpen={false} @@ -1024,6 +1025,7 @@ exports[`Search bar components renders search bar 1`] = ` >
} closePopover={[Function]} + data-test-subj="addfilter" display="inlineBlock" hasArrow={true} isOpen={false} @@ -1105,6 +1108,7 @@ exports[`Search bar components renders search bar 1`] = ` >
} closePopover={[Function]} + data-test-subj="global-filter-button" display="inlineBlock" hasArrow={true} isOpen={false} @@ -52,6 +53,7 @@ exports[`Filter component renders filters 1`] = ` >
} closePopover={[Function]} + data-test-subj="addfilter" display="inlineBlock" hasArrow={true} isOpen={false} @@ -133,6 +136,7 @@ exports[`Filter component renders filters 1`] = ` >
getValidFilterFields(props.mode, props.page), [props.page]); + const validFilterFields = useMemo(() => getValidFilterFields(props.mode, props.page), [props.page, props.mode]); const filterFieldOptions = useMemo( () => getFilterFields(props.mode, props.page).map((field) => ({ label: field })), [props.page] @@ -201,6 +201,7 @@ export function Filters(props: FiltersOwnProps) { anchorPosition="rightUp" panelPaddingSize="none" withTitle + data-test-subj='global-filter-button' > @@ -226,6 +227,7 @@ export function Filters(props: FiltersOwnProps) { isOpen={isPopoverOpen} closePopover={() => setIsPopoverOpen(false)} anchorPosition="downLeft" + data-test-subj="addfilter" withTitle > {'Add filter'} diff --git a/public/components/trace_analytics/components/dashboard/__tests__/__snapshots__/dashboard.test.tsx.snap b/public/components/trace_analytics/components/dashboard/__tests__/__snapshots__/dashboard.test.tsx.snap index 8d722ce6d4..452952c19a 100644 --- a/public/components/trace_analytics/components/dashboard/__tests__/__snapshots__/dashboard.test.tsx.snap +++ b/public/components/trace_analytics/components/dashboard/__tests__/__snapshots__/dashboard.test.tsx.snap @@ -1001,6 +1001,7 @@ exports[`Dashboard component renders dashboard 1`] = ` /> } closePopover={[Function]} + data-test-subj="global-filter-button" display="inlineBlock" hasArrow={true} isOpen={false} @@ -1010,6 +1011,7 @@ exports[`Dashboard component renders dashboard 1`] = ` >
} closePopover={[Function]} + data-test-subj="addfilter" display="inlineBlock" hasArrow={true} isOpen={false} @@ -1096,6 +1099,7 @@ exports[`Dashboard component renders dashboard 1`] = ` >
} closePopover={[Function]} + data-test-subj="global-filter-button" display="inlineBlock" hasArrow={true} isOpen={false} @@ -3259,6 +3264,7 @@ exports[`Dashboard component renders empty dashboard 1`] = ` >
} closePopover={[Function]} + data-test-subj="addfilter" display="inlineBlock" hasArrow={true} isOpen={false} @@ -3340,6 +3347,7 @@ exports[`Dashboard component renders empty dashboard 1`] = ` >
} closePopover={[Function]} + data-test-subj="global-filter-button" display="inlineBlock" hasArrow={true} isOpen={false} @@ -5524,6 +5533,7 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = ` >
} closePopover={[Function]} + data-test-subj="addfilter" display="inlineBlock" hasArrow={true} isOpen={false} @@ -5610,6 +5621,7 @@ exports[`Dashboard component renders empty jaeger dashboard 1`] = ` >