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

[WIP]: Cypress automation for Trace analytics dashboard application #775

Merged
Merged
Show file tree
Hide file tree
Changes from 12 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
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,108 @@ describe('Testing plots', () => {
cy.get('text.annotation-text[data-unformatted="Now: 108"]').should('exist');
});
});

describe('Latency by trace group table', () =>{
beforeEach(() => {
cy.visit('app/observability-dashboards#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

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="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('button[data-test-subj="dashboard-table-trace-group-name-button"]').contains('mysql').should('exist');
});

it('Sorts the Latency by trace group table', () => {
cy.get('span[title*="Trace group name"]').click();
cy.get('[data-test-subj="dashboard-table-trace-group-name-button"]').eq(0).contains('/**').should('exist');
cy.wait(delay);
});

it('Verify tooltips in Latency by trace group table', () => {
cy.get('.euiIcon.euiIcon--small.euiIcon--subdued.euiIcon-isLoaded.eui-alignTop').eq(0).trigger('mouseover');
cy.contains('Traces of all requests that share a common API and operation at the start of distributed tracing instrumentation.').should('be.visible');
cy.get('.euiIcon.euiIcon--small.euiIcon--subdued.euiIcon-isLoaded.eui-alignTop').eq(1).trigger('mouseover');
cy.contains('Range of latencies for traces within a trace group in the selected time range.').should('be.visible');
cy.get('.euiIcon.euiIcon--small.euiIcon--subdued.euiIcon-isLoaded.eui-alignTop').eq(2).trigger('mouseover');
cy.contains('Average latency of traces within a trace group in the selected time range.').should('be.visible');
cy.get('.euiIcon.euiIcon--small.euiIcon--subdued.euiIcon-isLoaded.eui-alignTop').eq(3).trigger('mouseover');
cy.contains('24 hour time series view of hourly average, hourly percentile, and hourly range of latency for traces within a trace group.').should('be.visible');
cy.get('.euiIcon.euiIcon--small.euiIcon--subdued.euiIcon-isLoaded.eui-alignTop').eq(4).trigger('mouseover');
cy.contains('Error rate based on count of trace errors within a trace group in the selected time range.').should('be.visible');
cy.get('.euiIcon.euiIcon--small.euiIcon--subdued.euiIcon-isLoaded.eui-alignTop').eq(5).trigger('mouseover');
cy.contains('Count of traces with unique trace identifiers in the selected time range.').should('be.visible');
});

it('Verify Search engine on Trace dashboard', () => {
cy.get('.euiFieldSearch.euiFieldSearch--fullWidth').click().type('client_pay_order{enter}');
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();
cy.get('.euiBadge.euiBadge--hollow.euiBadge--iconRight.globalFilterItem').click();
cy.get('.euiIcon.euiIcon--medium.euiContextMenu__arrow').click();
cy.get('.euiContextMenuPanelTitle').contains('Edit filter').should('exist');
cy.get('.euiButton.euiButton--primary.euiButton--fill').click();
cy.get('.euiBadge.euiBadge--hollow.euiBadge--iconRight.globalFilterItem').click();
cy.get('.euiContextMenuItem__text').eq(1).contains('Exclude results').click();
cy.get('.euiTextColor.euiTextColor--danger').should('exist');
cy.get('.euiBadge.euiBadge--hollow.euiBadge--iconRight.globalFilterItem').click();
cy.get('.euiContextMenuItem__text').eq(1).contains('Include results').click();
cy.get('.euiBadge.euiBadge--hollow.euiBadge--iconRight.globalFilterItem').click();
cy.get('.euiContextMenuItem__text').eq(2).contains('Temporarily disable').click();
cy.get('.euiBadge.euiBadge--iconRight.globalFilterItem.globalFilterItem-isDisabled').should('exist').click();
cy.get('.euiContextMenuItem__text').eq(2).contains('Re-enable').click();
cy.get('.euiBadge.euiBadge--hollow.euiBadge--iconRight.globalFilterItem').click();
cy.get('.euiContextMenuItem__text').eq(3).contains('Delete').click();
});
});

describe('Testing filters on trace analytics page', () =>{
beforeEach(() => {
cy.visit('app/observability-dashboards#/trace_analytics/home', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

it('Verify Change all filters', () =>{
cy.get('.euiButtonIcon.euiButtonIcon--primary.euiButtonIcon--empty.euiButtonIcon--xSmall').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');
})

it('Verify Add filter section', () => {
cy.get('.euiPopover.euiPopover--anchorDownLeft').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();
cy.get('.euiComboBoxOption__content').eq(2).click();
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();
cy.get('[data-test-subj="filter-popover-cancel-button"]').contains('Cancel').click();
cy.get('.euiIcon.euiIcon--small.euiIcon--inherit.euiBadge__icon').click();
})
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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

import { delay, SERVICE_NAME, SERVICE_SPAN_ID, setTimeFilter } from '../utils/constants';
import { delay, SERVICE_NAME, SERVICE_SPAN_ID, setTimeFilter, verify_traces_spans_data_grid_cols_exists, count_table_row } from '../utils/constants';

describe('Testing services table empty state', () => {
beforeEach(() => {
Expand Down Expand Up @@ -46,6 +46,28 @@ describe('Testing services table', () => {
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('.euiTableCellContent__text[title="Name"]').should('exist');
cy.get('.euiTableCellContent__text[title="Average latency (ms)"]').should('exist');
cy.get('.euiTableCellContent__text[title="Error rate"]').should('exist');
cy.get('.euiTableCellContent__text[title="Throughput"]').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', () => {
Expand Down Expand Up @@ -115,9 +137,144 @@ describe('Testing service view', () => {
cy.get('.euiTextColor').contains('Span ID').trigger('mouseover');
cy.get('.euiButtonIcon[aria-label="span-flyout-filter-icon"').click({ force: true });
cy.wait(delay);

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-dashboards#/trace_analytics/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

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('Latency (ms)');
cy.get('[data-text = "Error rate"]').click();
cy.contains('60%');
cy.get('[data-text = "Throughput"]').click();
cy.contains('100');
cy.get('.euiText.euiText--medium').contains('Focus on').should('exist');
cy.get('[placeholder="Service name"]').focus().type('database{enter}');
})
});

describe('Testing traces Spans table verify table headers functionality', () => {
beforeEach(() => {
cy.visit('app/observability-dashboards#/trace_analytics/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

it('Renders the spans table and verify coloums headers', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean 'column'?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, updated the Spelling for same

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('.panel-title').contains('Spans').should('exist');
cy.get('.panel-title-count').contains('5').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);
});

it('Show all button Spans table', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
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').click();
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').click();
verify_traces_spans_data_grid_cols_exists();
cy.get('.euiButtonEmpty__text').contains('Density').click();
cy.get('.euiButtonContent__icon').eq(5).click();
cy.get('.euiButtonContent__icon').eq(6).click();
cy.get('.euiButtonContent__icon').eq(7).click();
});

it('Render Spans table and and click on sort', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
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();
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-spanId').click();
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-parentSpanId"]').click();
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-traceId"]').click();
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-traceGroup').click();
cy.get('[data-test-subj="dataGridColumnSortingPopoverColumnSelection-durationInNanos"]').click();
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('exist').click();
});

});


describe('Testing traces Spans table and verify columns functionality', () => {
beforeEach(() => {
cy.visit('app/observability-dashboards#/trace_analytics/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

it('Renders the spans table and click on first span to verify details', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
verify_traces_spans_data_grid_cols_exists();
cy.get('.euiLink--primary').eq(4).click();
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('.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');
count_table_row(1);
cy.get('[aria-label="remove current filter"]').click();
count_table_row(5);
});

it('Render Spans table and verify Column functionality', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
verify_traces_spans_data_grid_cols_exists();
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();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,44 @@ describe('Testing trace view', () => {
cy.contains('Spans (1)').should('exist');
});
});

describe('Testing traces table', () => {
beforeEach(() => {
cy.visit('app/observability-dashboards#/trace_analytics/traces', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
setTimeFilter();
});

it('Renders the traces table and verify Table Column, Pagination and Rows Data ', () => {
cy.get('.euiTableCellContent__text').contains('Trace ID').should('exist');
cy.get('.euiTableCellContent__text').contains('Trace group').should('exist');
cy.get('.euiTableCellContent__text').contains('Latency (ms)').should('exist');
cy.get('.euiTableCellContent__text').contains('Percentile in trace group').should('exist');
cy.get('.euiTableCellContent__text').contains('Errors').should('exist');
cy.get('.euiTableCellContent__text').contains('Last updated').should('exist');
cy.get('[data-test-subj="pagination-button-next"]').click();
cy.contains('client_pay_order').should('exist');
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('client_create_order').should('exist');
cy.get('path[style*="rgb(116, 146, 231)"]').should('exist');
cy.go('back');
cy.wait(delay);
cy.get('.euiButtonEmpty__text').contains('Rows per page').click();
cy.get('.euiContextMenuItem__text').contains('15 rows').click();
cy.get('.euiTable--auto')
.find("tr")
.then((row) => {
//row.length will give you the row count
cy.log(row.length-1);
let total=row.length-1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this needed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated this code for assert

});
cy.log('Rows are counted');
});
});
19 changes: 19 additions & 0 deletions dashboards-observability/.cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,22 @@ export const supressResizeObserverIssue = () => {
if (err.message.includes('ResizeObserver loop')) return false;
});
};

export const verify_traces_spans_data_grid_cols_exists = () => {
cy.get('.euiDataGridHeaderCell__content').contains('Span ID').should('exist');
cy.get('.euiDataGridHeaderCell__content').contains('Trace ID').should('exist');
cy.get('.euiDataGridHeaderCell__content').contains('Operation').should('exist');
cy.get('.euiDataGridHeaderCell__content').contains('Duration').should('exist');
cy.get('.euiDataGridHeaderCell__content').contains('Start time').should('exist');
cy.get('.euiDataGridHeaderCell__content').contains('End time').should('exist');
cy.get('.euiDataGridHeaderCell__content').contains('Errors').should('exist');
}

export const count_table_row = (expected_row_count) => {
cy.get('.euiDataGridHeader [role="columnheader"]').then($el => {
let colmun_header_count = Cypress.$($el).length;
let table_grid_cell_count = Cypress.$('[data-test-subj="dataGridRowCell"]').length;
const total_row_count = table_grid_cell_count / colmun_header_count;
expect(total_row_count).to.equal(expected_row_count)
});
}