Skip to content

Commit

Permalink
Merge pull request #493 from TackAdam/cypServiceFix
Browse files Browse the repository at this point in the history
Cypress Testing v12.8.1 - Trace Analytics (Services & Traces) fixes
  • Loading branch information
TackAdam authored May 31, 2023
2 parents ee5429d + 832c9ee commit b4df4f2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 40 deletions.
1 change: 0 additions & 1 deletion .cypress/integration/4_trace_analytics_dashboard.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ describe('Testing dashboard table', () => {
});

it('Adds the percentile filters', () => {
cy.wait(delay);//Needed after removing waits from setTimeFilter()
cy.contains(' >= 95 percentile').click({ force: true });
cy.contains(' >= 95 percentile').click({ force: true });

Expand Down
33 changes: 5 additions & 28 deletions .cypress/integration/5_trace_analytics_services.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('Testing services table empty state', () => {
win.sessionStorage.clear();
},
});
cy.wait(delay * 3);
});

it('Renders empty state', () => {
Expand Down Expand Up @@ -72,11 +71,6 @@ describe('Testing services table', () => {

describe('Testing service view empty state', () => {
beforeEach(() => {
// exception is thrown on loading EuiDataGrid in cypress only, ignore for now
cy.on('uncaught:exception', (err, runnable) => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/observability-traces#/services/${SERVICE_NAME}`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
Expand All @@ -93,11 +87,6 @@ describe('Testing service view empty state', () => {

describe('Testing service view', () => {
beforeEach(() => {
// exception is thrown on loading EuiDataGrid in cypress only, ignore for now
cy.on('uncaught:exception', (err, runnable) => {
if (err.message.includes('ResizeObserver loop'))
return false;
});
cy.visit(`app/observability-traces#/services`, {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
Expand All @@ -106,7 +95,7 @@ describe('Testing service view', () => {
setTimeFilter();
cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}`);
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.wait(delay);
cy.get('.euiTableRow').should('have.length.lessThan', 3);//Replaces wait
cy.get('[data-test-subj="service-link"]').eq(0).click();
});

Expand All @@ -119,28 +108,22 @@ describe('Testing service view', () => {

it('Has working breadcrumbs', () => {
cy.get('.euiBreadcrumb').contains(SERVICE_NAME).click();
cy.wait(delay);
cy.get('h2.euiTitle').contains(SERVICE_NAME).should('exist');
cy.get('.euiBreadcrumb').contains('Services').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Services').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');
cy.get('.euiTitle').contains('Logs').should('exist');
});

it('Renders spans data grid, flyout, filters', () => {
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');
cy.contains('Span attributes').should('exist');
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');
Expand Down Expand Up @@ -172,10 +155,6 @@ 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-traces#/services', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
Expand Down Expand Up @@ -211,6 +190,7 @@ 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('.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();
cy.get('.euiDataGrid__focusWrap').click().should('exist');
Expand Down Expand Up @@ -268,10 +248,8 @@ describe('Testing traces Spans table and verify columns functionality', () => {
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: 277a5934acf55dcf').should('exist');
cy.wait(delay);
count_table_row(1);
cy.get('[aria-label="remove current filter"]').click();
cy.wait(delay);
count_table_row(8);
});

Expand All @@ -298,6 +276,7 @@ describe('Testing switch mode to jaeger', () => {
setTimeFilter();
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='jaeger-mode']").click();
//cy.get('.euiButtonEmpty__text').should('contain', 'Jaeger');
});

it('Verifies columns and data', () => {
Expand All @@ -312,10 +291,8 @@ describe('Testing switch mode to jaeger', () => {
});

it('Verifies traces links to traces page with filter applied', () => {
cy.wait(delay);
cy.get('.euiTableRow').should('have.length.lessThan', 7);//Replaces Wait
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')
Expand Down
14 changes: 3 additions & 11 deletions .cypress/integration/6_trace_analytics_traces.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ describe('Testing traces table empty state', () => {
win.sessionStorage.clear();
},
});
cy.wait(delay * 3);
});

it('Renders empty state', () => {
Expand Down Expand Up @@ -69,7 +68,7 @@ describe('Testing trace view', () => {
setTimeFilter();
cy.get('input[type="search"]').focus().type(`${TRACE_ID}`);
cy.get('.euiButton__text').contains('Refresh').click();
cy.wait(delay);
cy.get('.euiTableRow').should('have.length.lessThan', 3);//Replaces wait
cy.get('[data-test-subj="trace-link"]').eq(0).click();
});

Expand All @@ -86,33 +85,27 @@ describe('Testing trace view', () => {

it('Has working breadcrumbs', () => {
cy.get(`.euiBreadcrumb[href="#/traces/${TRACE_ID}"]`).click();
cy.wait(delay);
cy.get('h2.euiTitle').contains(TRACE_ID).should('exist');
cy.get('.euiBreadcrumb[href="#/traces"]').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Traces').should('exist');
cy.get('.euiBreadcrumb[href="#/"]').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Dashboard').should('exist');
cy.get('.euiBreadcrumb[href="observability-logs#/"]').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Event analytics').should('exist');
cy.get('.euiTitle').contains('Logs').should('exist');
});

it('Renders data grid, flyout and filters', () => {
cy.get('.euiButton__text[title="Span list"]').click({ force: true });
cy.contains('2 columns hidden').should('exist');

cy.wait(delay);
cy.get('.euiLink').contains(SPAN_ID).trigger('mouseover', { force: true });
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true }); // first click doesn't go through eui data grid
cy.wait(delay);

cy.contains('Span detail').should('exist');
cy.contains('Span attributes').should('exist');
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.contains('Spans (1)').should('exist');
Expand Down Expand Up @@ -146,7 +139,6 @@ describe('Testing traces table', () => {
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();
let expected_row_count=15;
Expand Down
1 change: 1 addition & 0 deletions .cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
.type('{selectall}' + endTime, { force: true });
}
if (refresh) cy.get('.euiButton__text').contains('Refresh').click();
cy.get('.euiTableRow').should('have.length.greaterThan', 3);//Replaces Wait
};

// notebooks
Expand Down

0 comments on commit b4df4f2

Please sign in to comment.