Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BACKPORT 2.x] cypress test fixes for jaeger #280

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
136 changes: 118 additions & 18 deletions .cypress/integration/4_trace_analytics_dashboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/// <reference types="cypress" />

import { testDataSet, delay, setTimeFilter } from '../utils/constants';
import { testDataSet, delay, setTimeFilter, jaegerTestDataSet } from '../utils/constants';

describe('Dump test data', () => {
it('Indexes test data', () => {
Expand Down Expand Up @@ -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');
});

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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', () => {
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand All @@ -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) => {
Expand All @@ -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');
Expand 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();
Expand All @@ -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');
});
});
65 changes: 55 additions & 10 deletions .cypress/integration/5_trace_analytics_services.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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');
Expand Down Expand Up @@ -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();
Expand All @@ -181,16 +189,16 @@ 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();
});

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('.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', () => {
Expand Down Expand Up @@ -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();
});
});
Expand All @@ -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', () => {
Expand All @@ -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')
})
});
37 changes: 36 additions & 1 deletion .cypress/integration/6_trace_analytics_traces.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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');
})
});
Loading