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

Fix trace analytics cypress #652

Merged
merged 3 commits into from
Apr 13, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Testing dashboard table empty state', () => {

it('Renders empty state', () => {
cy.contains(' (0)').should('exist');
cy.get('h2.euiTitle').contains('No matches').should('exist');
cy.contains('No matches').should('exist');
});
});

Expand Down Expand Up @@ -163,26 +163,27 @@ describe('Testing plots', () => {
});

it('Renders service map', () => {
// plotly scale texts are in attribute "data-unformatted"
cy.get('text.ytitle[data-unformatted="Latency (ms)"]').should('exist');
cy.get('text[data-unformatted="200"]').should('exist');
cy.get('.vis-network').should('exist');

cy.get('.euiToggle__input[title="Error rate"]').click();
cy.get('.euiButton__text[title="Error rate"]').click();
cy.get('text.ytitle[data-unformatted="Error rate"]').should('exist');
cy.get('text[data-unformatted="10%"]').should('exist');

cy.get('.euiToggle__input[title="Throughput"]').click();
cy.get('.euiButton__text[title="Throughput"]').click();
cy.get('text.ytitle[data-unformatted="Throughput"]').should('exist');
cy.get('text[data-unformatted="60"]').should('exist');
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', () => {
cy.get('text.ytitle[data-unformatted="Error rate (%)"]').should('exist');
cy.get('text.annotation-text[data-unformatted="Now: 0%"]').should('exist');
cy.get('text.annotation-text[data-unformatted="Now: 14.81%"]').should('exist');
cy.get('text.ytitle[data-unformatted="Throughput (n)"]').should('exist');
cy.get('text.annotation-text[data-unformatted="Now: 62"]').should('exist');
cy.get('text.annotation-text[data-unformatted="Now: 108"]').should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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

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

describe('Testing services table empty state', () => {
beforeEach(() => {
Expand All @@ -19,7 +19,7 @@ describe('Testing services table empty state', () => {

it('Renders empty state', () => {
cy.contains(' (0)').should('exist');
cy.get('h2.euiTitle').contains('No matches').should('exist');
cy.contains('No matches').should('exist');
});
});

Expand All @@ -43,7 +43,6 @@ 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.wait(delay);
cy.contains(' (1)').should('exist');
cy.contains('3.57%').should('exist');
});
Expand All @@ -61,11 +60,10 @@ describe('Testing service view empty state', () => {
win.sessionStorage.clear();
},
});
cy.wait(delay * 3);
});

it('Renders service view empty state', () => {
cy.get('h2.euiTitle').contains('frontend-client').should('exist');
cy.contains('frontend-client').should('exist');
cy.get('.euiText').contains('0').should('exist');
cy.get('.euiText').contains('-').should('exist');
});
Expand Down Expand Up @@ -109,6 +107,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('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });
cy.wait(delay);
cy.contains('Span detail').should('exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Testing traces table empty state', () => {

it('Renders empty state', () => {
cy.contains(' (0)').should('exist');
cy.get('h2.euiTitle').contains('No matches').should('exist');
cy.contains('No matches').should('exist');
});
});

Expand Down Expand Up @@ -54,7 +54,6 @@ 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.wait(delay);
cy.contains(' (1)').should('exist');
cy.contains('03/25/2021 10:21:22').should('exist');
});
Expand All @@ -67,40 +66,42 @@ describe('Testing trace view', () => {
win.sessionStorage.clear();
},
});
cy.wait(delay * 3);
});

it('Renders the trace view', () => {
cy.contains('43.75%').should('exist');
cy.contains('42.58%').should('exist');
cy.contains('03/25/2021 10:21:22').should('exist');
cy.get('h2.euiTitle').contains(TRACE_ID).should('exist');
cy.contains(TRACE_ID).should('exist');

cy.get('div.js-plotly-plot').should('have.length.gte', 2);
cy.get('text[data-unformatted="database <br>mysql.APM "]').should('exist');
cy.contains(`"${SPAN_ID}"`).should('exist');
});

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

it('Renders data grid, flyout and filters', () => {
cy.get('.euiToggle__input[title="Span list"]').click({ force: true });
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');
Expand Down
7 changes: 4 additions & 3 deletions dashboards-observability/.cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const delay = 1500;
export const TRACE_ID = '8832ed6abbb2a83516461960c89af49d';
export const SPAN_ID = 'a673bc074b438374';
export const SERVICE_NAME = 'frontend-client';
export const SERVICE_SPAN_ID = '7df5609a6d104736';

export const testDataSet = [
{
Expand Down Expand Up @@ -40,7 +41,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
cy.get('.euiTab__content').contains('Absolute').click();
cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]')
.focus()
.type('{selectall}' + startTime);
.type('{selectall}' + startTime, { force: true });
if (setEndTime) {
cy.wait(delay);
cy.get(
Expand All @@ -50,7 +51,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
cy.get('.euiTab__content').contains('Absolute').click();
cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]')
.focus()
.type('{selectall}' + endTime);
.type('{selectall}' + endTime, { force: true });
}
if (refresh) cy.get('.euiButton__text').contains('Refresh').click();
cy.wait(delay);
Expand Down Expand Up @@ -98,4 +99,4 @@ export const supressResizeObserverIssue = () => {
cy.on('uncaught:exception', (err, runnable) => {
if (err.message.includes('ResizeObserver loop')) return false;
});
};
};