Skip to content

Commit

Permalink
Modularize and cleanup traces (#601)
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Lee <[email protected]>
  • Loading branch information
eugenesk24 authored Mar 23, 2022
1 parent af54d6a commit ed3a3bd
Show file tree
Hide file tree
Showing 21 changed files with 2,164 additions and 1,798 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ describe('Creating application', () => {
expectMessageOnHover('Provide at least one log source, service, entity or trace group.');
cy.get('.euiAccordion').contains('Services & entities').click();
cy.get('[data-test-subj="servicesEntitiesComboBox"]').click();
cy.get('.euiFilterSelectItem').contains(service_one).trigger('click');
cy.get('.euiFilterSelectItem').contains(service_one).click();
cy.get('.euiBadge').contains('1').should('exist');
cy.get('.euiButton').contains('Create').should('not.be.disabled');
cy.get('[data-test-subj="searchAutocompleteTextArea"]').type(baseQuery);
cy.get('.euiAccordion').contains('Trace groups').click();
cy.get('[data-test-subj="traceGroupsComboBox"]').type('http');
cy.get('.euiFilterSelectItem').contains(trace_one).trigger('click');
cy.get('.euiFilterSelectItem').contains(trace_two).trigger('click');
cy.get('.euiFilterSelectItem').contains(trace_one).click();
cy.get('.euiFilterSelectItem').contains(trace_two).click();
cy.get('.euiBadge').contains('2').should('exist');
cy.get('.euiButton').contains('Create').should('not.be.disabled');
});
Expand All @@ -74,7 +74,7 @@ describe('Creating application', () => {
cy.get('.aa-List').find('.aa-Item').should('have.length', 1);
cy.focused().type('{enter}');
cy.get('[data-test-subj="searchAutocompleteTextArea"]').should('contain', 'source ');
})
});

it('Creates an application and redirects to application', () => {
cy.get('[data-test-subj="nameFormRow"]').type(name);
Expand Down Expand Up @@ -163,9 +163,22 @@ describe('Creating application', () => {
describe('Viewing application', () => {
before(() => {
moveToApplication();
})
});

it('Has working breadcrumbs', () => {
cy.get('.euiBreadcrumb').contains('Cypress').click();
cy.wait(delay);
cy.get('.euiTitle').contains(name).should('exist');
cy.get('.euiBreadcrumb').contains('Application analytics').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Applications').should('exist');
cy.get('.euiBreadcrumb').contains('Observability').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Event analytics').should('exist');
});

it('Shares time range among tabs', () => {
moveToApplication();
changeTimeTo24('months');
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').should('contain', 'Last 24 months');
cy.get('.euiTab').contains('Services').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const landOnEventExplorer = () => {
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/event_analytics/explorer`
);
cy.wait(delay);
cy.wait(delay * 2);
};

const landOnPanels = () => {
Expand All @@ -51,6 +51,21 @@ describe('Adding sample data and visualization', () => {
});
});

describe('Has working breadcrumbs', () => {
it('Redirect to correct page on breadcrumb click', () => {
landOnEventExplorer();
cy.get('.euiBreadcrumb').contains('Explorer').click();
cy.wait(delay);
cy.get('[data-test-subj="searchAutocompleteTextArea"]').should('exist');
cy.get('.euiBreadcrumb').contains('Event analytics').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Event analytics').should('exist');
cy.get('.euiBreadcrumb').contains('Observability').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Event analytics').should('exist');
});
});

describe('Open flyout for a data row to see details', () => {
beforeEach(() => {
landOnEventExplorer();
Expand Down
28 changes: 28 additions & 0 deletions dashboards-observability/.cypress/integration/notebooks.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,18 @@ describe('Testing paragraphs', () => {
cy.wait(delay);
});

it('Has working breadcrumbs', () => {
cy.get('.euiBreadcrumb').contains(TEST_NOTEBOOK).click();
cy.wait(delay);
cy.get('.euiTitle').contains(TEST_NOTEBOOK).should('exist');
cy.get('.euiBreadcrumb').contains('Notebooks').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Notebooks').should('exist');
cy.get('.euiBreadcrumb').contains('Observability').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Event analytics').should('exist');
});

it('Renders markdown', () => {
cy.get('.euiTextArea').should('not.exist');
cy.get(`a[href="${SAMPLE_URL}"]`).should('exist');
Expand Down Expand Up @@ -432,4 +444,20 @@ describe('Testing paragraphs', () => {

cy.get('.euiButton__text').contains('Create notebook').should('exist');
});

it('Cleans up test notebooks', () => {
cy.get('[data-test-subj="notebook-notebook-actions-button"]').click();
cy.wait(delay);
cy.get('.euiContextMenuItem__text').contains('Delete notebook').click();
cy.wait(delay);

cy.get('button.euiButton--danger').should('be.disabled');

cy.get('input.euiFieldText[placeholder="delete"]').type('delete');
cy.get('button.euiButton--danger').should('not.be.disabled');
cy.get('.euiButton__text').contains('Delete').click();
cy.wait(delay * 3);

cy.get('.euiText').contains('No notebooks').should('exist');
});
});
14 changes: 14 additions & 0 deletions dashboards-observability/.cypress/integration/panels.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,21 @@ describe('Testing a panel', () => {
moveToTestPanel();
});

it('Redirects to correct page on breadcrumb click', () => {
moveToTestPanel();
cy.get('.euiBreadcrumb').contains(TEST_PANEL).click();
cy.wait(delay);
cy.get('.euiTitle').contains(TEST_PANEL).should('exist');
cy.get('.euiBreadcrumb').contains('Operational panels').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Operational panels').should('exist');
cy.get('.euiBreadcrumb').contains('Observability').click();
cy.wait(delay);
cy.get('.euiTitle').contains('Event analytics').should('exist');
});

it('Duplicate the open panel', () => {
moveToTestPanel();
cy.get('.euiButton__text').contains('Panel actions').click();
cy.wait(delay);
cy.get('.euiContextMenuItem__text').contains('Duplicate panel').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,18 @@ describe('Testing dashboard table', () => {
cy.contains('7.14%').should('exist');
});

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');
});

it('Adds the percentile filters', () => {
cy.contains(' >= 95 percentile').click({ force: true });
cy.wait(delay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,27 @@ describe('Testing service view', () => {
});

it('Renders service view', () => {
cy.get('h2.euiTitle').contains('frontend-client').should('exist');
cy.get('h2.euiTitle').contains(SERVICE_NAME).should('exist');
cy.contains('178.6').should('exist');
cy.contains('3.57%').should('exist');
cy.get('div.vis-network').should('exist');
});

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');
});

it('Renders spans data grid, flyout, filters', () => {
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });
cy.wait(delay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ describe('Testing traces table', () => {
cy.contains('-').should('exist');
});

it('Sorts the traces table', () => {
cy.get('.euiTableRow').first().contains('-').should('exist');
cy.get('.euiTableCellContent').contains('Trace group').click();
cy.get('.euiTableRow').first().contains('/%2A%2A').should('exist');
});

it('Searches correctly', () => {
cy.get('input[type="search"]').focus().type(`${TRACE_ID}{enter}`);
cy.get('.euiButton__text').contains('Refresh').click();
Expand Down Expand Up @@ -75,6 +81,21 @@ describe('Testing trace view', () => {
cy.contains(`"${SPAN_ID}"`).should('exist');
});

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

it('Renders data grid, flyout and filters', () => {
cy.get('.euiToggle__input[title="Span list"]').click({ force: true });
cy.contains('2 columns hidden').should('exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import {
EuiHorizontalRule,
EuiLink,
EuiPage,
EuiPageBody,
EuiPageHeader,
Expand All @@ -25,18 +24,19 @@ import PPLService from 'public/services/requests/ppl';
import SavedObjects from 'public/services/saved_objects/event_analytics/saved_objects';
import TimestampUtils from 'public/services/timestamp/timestamp';
import React, { ReactChild, useEffect, useState } from 'react';
import { truncate, uniqueId } from 'lodash';
import { uniqueId } from 'lodash';
import { useHistory } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { last } from 'lodash';
import { TracesContent } from '../../../components/trace_analytics/components/traces/traces_content';
import { DashboardContent } from '../../../components/trace_analytics/components/dashboard/dashboard_content';
import { ServicesContent } from '../../trace_analytics/components/services/services_content';
import {
filtersToDsl,
PanelTitle,
} from '../../../../public/components/trace_analytics/components/common/helper_functions';
import { SpanDetailTable } from '../../../../public/components/trace_analytics/components/traces/span_detail_table';
import { Explorer } from '../../explorer/explorer';
import { Traces } from '../../trace_analytics/components/traces';
import { Configuration } from './configuration';
import {
TAB_CONFIG_ID_TXT_PFX,
Expand All @@ -63,7 +63,6 @@ import { ServiceDetailFlyout } from './flyout_components/service_detail_flyout';
import { SpanDetailFlyout } from '../../../../public/components/trace_analytics/components/traces/span_detail_flyout';
import { TraceDetailFlyout } from './flyout_components/trace_detail_flyout';
import { fetchAppById, initializeTabData } from '../helpers/utils';
import { ServicesContent } from '../../trace_analytics/components/services/services_content';

const TAB_OVERVIEW_ID = uniqueId(TAB_OVERVIEW_ID_TXT_PFX);
const TAB_SERVICE_ID = uniqueId(TAB_SERVICE_ID_TXT_PFX);
Expand Down Expand Up @@ -318,18 +317,19 @@ export function Application(props: AppDetailProps) {
setSelectedTab(TAB_TRACE_ID);
};

const traceIdColumnAction = (item: any) => openTraceFlyout(item);

const getTrace = () => {
return (
<>
<Traces
<EuiSpacer size="m" />
<TracesContent
{...props}
page="app"
appId={appId}
appName={application.name}
openTraceFlyout={openTraceFlyout}
childBreadcrumbs={childBreadcrumbs}
traceIdColumnAction={traceIdColumnAction}
setStartTime={setStartTimeForApp}
setEndTime={setEndTimeForApp}
switchToEditViz={switchToEditViz}
/>
<EuiSpacer size="m" />
<EuiPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export const Home = (props: IHomeProps) => {
<EuiPageHeader>
<EuiPageHeaderSection>
<EuiTitle size="l">
<h1>Event Analytics</h1>
<h1>Event analytics</h1>
</EuiTitle>
</EuiPageHeaderSection>
</EuiPageHeader>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports[`Dashboard component renders dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
]
}
Expand All @@ -32,7 +32,7 @@ exports[`Dashboard component renders dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
],
],
Expand Down Expand Up @@ -104,7 +104,7 @@ exports[`Dashboard component renders dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
]
}
Expand All @@ -125,7 +125,7 @@ exports[`Dashboard component renders dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
],
],
Expand Down Expand Up @@ -2096,7 +2096,7 @@ exports[`Dashboard component renders empty dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
]
}
Expand All @@ -2117,7 +2117,7 @@ exports[`Dashboard component renders empty dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
],
],
Expand Down Expand Up @@ -2189,7 +2189,7 @@ exports[`Dashboard component renders empty dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
]
}
Expand All @@ -2210,7 +2210,7 @@ exports[`Dashboard component renders empty dashboard 1`] = `
},
Object {
"href": "#/trace_analytics/home",
"text": "Dashboards",
"text": "Dashboard",
},
],
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('Dashboard component', () => {
href: '#/trace_analytics/home',
},
{
text: 'Dashboards',
text: 'Dashboard',
href: '#/trace_analytics/home',
},
]}
Expand Down Expand Up @@ -78,7 +78,7 @@ describe('Dashboard component', () => {
href: '#/trace_analytics/home',
},
{
text: 'Dashboards',
text: 'Dashboard',
href: '#/trace_analytics/home',
},
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { DashboardContent } from './dashboard_content';

export interface DashboardProps extends TraceAnalyticsComponentDeps {
childBreadcrumbs: EuiBreadcrumb[];
page: 'dashboard' | 'traces' | 'services' | 'app';
page: 'dashboard' | 'app';
}

export function Dashboard(props: DashboardProps) {
Expand Down
Loading

0 comments on commit ed3a3bd

Please sign in to comment.