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

[Cypress Updates] Trace analytics updates #2251

Merged
merged 7 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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 @@ -5,7 +5,7 @@

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

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

suppressResizeObserverIssue();//needs to be in file once
Expand Down Expand Up @@ -102,15 +102,15 @@ describe('Testing dashboard table', () => {
});

it('Adds the percentile filters', () => {
cy.contains(' >= 95 percentile').click({ force: true });
cy.contains(' >= 95 percentile').click({ force: true });

cy.get('[data-test-subj="dashboardTable"]').should('be.visible');
cy.get('[data-test-subj="dashboard-table-percentile-button-2"]').click();

cy.contains('Latency percentile within trace group: >= 95th').should('exist');
cy.contains(' (7)').should('exist');
cy.contains('318.69').should('exist');

cy.contains(' < 95 percentile').click({ force: true });
cy.contains(' < 95 percentile').click({ force: true });
cy.get('[data-test-subj="dashboard-table-percentile-button-1"]').click();

cy.contains('Latency percentile within trace group: < 95th').should('exist');
cy.contains(' (8)').should('exist');
Expand Down Expand Up @@ -148,6 +148,7 @@ describe('Testing plots', () => {

it('Renders service map', () => {
// plotly scale texts are in attribute "data-unformatted"
cy.get('.euiSideNavItemButton__label').contains('Services').click();
cy.get('text.ytitle[data-unformatted="Average duration (ms)"]').should('exist');
cy.get('text[data-unformatted="200"]').should('exist');
cy.get('.vis-network').should('exist');
Expand Down Expand Up @@ -218,7 +219,6 @@ describe('Latency by trace group table', () =>{
it('Verify Search engine on Trace dashboard', () => {
cy.get('.euiFieldSearch.euiFieldSearch--fullWidth').click().type('client_pay_order');
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.wait(delay);//Fails without
cy.get('.euiTableCellContent.euiTableCellContent--alignRight.euiTableCellContent--overflowingContent').contains('211.04').should('exist');
cy.get('button[data-test-subj="dashboard-table-trace-group-name-button"]').eq(0).click();
cy.get('.euiBadge.euiBadge--hollow.euiBadge--iconRight.globalFilterItem').click();
Expand Down Expand Up @@ -250,25 +250,22 @@ describe('Testing filters on trace analytics page', { scrollBehavior: false }, (
});

it('Verify Change all filters', () =>{
cy.wait(delay);//Needed after removing waits from setTimeFilter()
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');
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');
cy.get('.euiContextMenuItem__text').eq(1).contains('Enable all');
cy.get('.euiContextMenuItem__text').eq(2).contains('Disable all');
cy.get('.euiContextMenuItem__text').eq(3).contains('Invert inclusion');
cy.get('.euiContextMenuItem__text').eq(4).contains('Invert enabled/disabled');
cy.get('.euiContextMenuItem__text').eq(5).contains('Remove all');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not a blocker, however, I was wondering if we can do something like this:

const menuSelector = '.euiContextMenuItem__text';
const expectedMenuItems = [
  'Enable all',
  'Disable all',
  'Invert inclusion',
  'Invert enabled/disabled',
  'Remove all',
];

cy.verifyContextMenuItems(menuSelector, expectedMenuItems);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like cypress can do something like that by iterating through each menu item to check but I think it might be more clear to have the order of the menu items laid out so holding off on this for now

})

it('Verify Add filter section', () => {
cy.wait(delay);//Needed after removing waits from setTimeFilter()
cy.get('[data-test-subj="addfilter"]').contains('+ Add filter').click();
cy.get('.euiPopoverTitle').contains('Add filter').should('exist');
cy.wait(delay);//drop down won't open without
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('[data-test-subj="global-filter-button"]').click();
cy.get('.euiContextMenuItem__text').contains('Add filter').click();
cy.get('[data-test-subj="field-selector-filter-panel"]').click();
cy.get('[data-test-subj="field-selector-filter-panel"]').type('traceId{enter}');
cy.get('[data-test-subj="operator-selector-filter-panel"]').click();
cy.get('[data-test-subj="operator-selector-filter-panel"]').type('exists{enter}');
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});

Expand All @@ -44,13 +46,13 @@

it('Searches correctly', () => {
cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}{enter}`);
cy.get('.euiButton__text').contains('Refresh').click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
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('.euiFlexItem.euiFlexItem--flexGrowZero .panel-title').contains('Services').should('exist');
cy.get('.euiTableCellContent__text[title="Name"]').should('exist');
cy.get('.euiTableCellContent__text[title="Average duration (ms)"]').should('exist');
cy.get('.euiTableCellContent__text[title="Error rate"]').should('exist');
Expand Down Expand Up @@ -95,23 +97,27 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
cy.get('input[type="search"]').first().focus().type(`${SERVICE_NAME}`);
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.get('.euiTableRow').should('have.length.lessThan', 3);//Replaces wait
cy.get('[data-test-subj="service-link"]').eq(0).click();
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
RyanL1997 marked this conversation as resolved.
Show resolved Hide resolved
cy.get('[data-test-subj="viewServiceButton"]').click();
});

it('Renders service view', () => {
cy.get('h2.euiTitle').contains(SERVICE_NAME).should('exist');
cy.get('h1.overview-content').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.get('h2.euiTitle').contains(SERVICE_NAME).should('exist');
cy.get('h1.overview-content').contains(SERVICE_NAME).should('exist');
cy.get('.euiBreadcrumb').contains('Services').click();
cy.get('.euiBreadcrumb').contains('Trace analytics').click();
cy.get('.euiBreadcrumb').contains('Observability').click();
Expand All @@ -119,14 +125,14 @@
});

it('Renders spans data grid, flyout, filters', () => {
cy.get("[data-test-subj='spanId-link']").contains(SERVICE_SPAN_ID).trigger('mouseover', { force: true });

Check warning on line 128 in .cypress/integration/trace_analytics_test/trace_analytics_services.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });

Check warning on line 129 in .cypress/integration/trace_analytics_test/trace_analytics_services.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
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 });

Check warning on line 133 in .cypress/integration/trace_analytics_test/trace_analytics_services.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.euiBadge__text').contains('spanId: ').should('exist');
cy.get('[data-test-subj="euiFlyoutCloseButton"]').click({ force: true });

Check warning on line 135 in .cypress/integration/trace_analytics_test/trace_analytics_services.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.contains('Spans (1)').should('exist');
});
});
Expand All @@ -138,6 +144,8 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});

Expand All @@ -149,7 +157,7 @@
cy.contains('60%');
cy.get('[data-text = "Duration"]').click();
cy.contains('100');
cy.get('.euiText.euiText--medium').contains('Focus on').should('exist');
cy.get('.euiFormLabel.euiFormControlLayout__prepend').contains('Focus on').should('exist');
cy.get('[placeholder="Service name"]').focus().type('database{enter}');
})
});
Expand All @@ -161,36 +169,51 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});

it('Renders the spans table and verify columns headers', () => {
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('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').click();
cy.get('.panel-title').contains('Spans').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('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').click();
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click({ force: true });

Check warning on line 194 in .cypress/integration/trace_analytics_test/trace_analytics_services.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('.panel-title-count').contains('8').should('exist');
cy.get('.euiSwitch.euiSwitch--compressed.euiSwitch--mini .euiSwitch__button').eq(3).click();
cy.get('[data-test-subj = "dataGridColumnSelectorButton"]').click().should('have.text', '2 columns hidden');
count_table_row(8);
});

it('Show all button Spans table', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').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('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').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();
Expand All @@ -199,7 +222,10 @@
});

it('Render Spans table and change data table Density', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').click();
verify_traces_spans_data_grid_cols_exists();
cy.get('.euiButtonEmpty__text').contains('Density').click();
cy.get('.euiButtonContent__icon').eq(5).click();
Expand All @@ -208,7 +234,10 @@
});

it('Render Spans table and and click on sort', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').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();
Expand All @@ -233,14 +262,19 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});

it('Renders the spans table and click on first span to verify details', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').click();
verify_traces_spans_data_grid_cols_exists();
cy.contains(AUTH_SERVICE_SPAN_ID).click();
cy.get('[data-test-subj="spanDetailFlyout"] .euiTitle.euiTitle--medium').contains('Span detail').should('exist');
cy.get('[data-test-subj="spanDetailFlyout"]').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('[data-test-subj="parentSpanId"]').contains('d03fecfa0f55b77c').should('exist');
Expand All @@ -251,11 +285,15 @@
cy.get('.euiBadge__content .euiBadge__text').contains('spanId: 277a5934acf55dcf').should('exist');
count_table_row(1);
cy.get('[aria-label="remove current filter"]').click();
cy.get('.panel-title-count').contains('8').should('exist');
count_table_row(8);
});

it('Render Spans table and verify Column functionality', () => {
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist').click();
cy.get('.euiLink.euiLink--primary').contains('authentication').should('exist');
cy.get('*[data-test-subj^="service-flyout-action-btntrace_service"]').eq(1).click();
cy.get('[data-test-subj="ActionContextMenu"]').click();
cy.get('[data-test-subj="viewServiceButton"]').click();
verify_traces_spans_data_grid_cols_exists();
cy.get('.euiDataGridHeaderCell__content').contains('Span ID').click();
cy.get('.euiListGroupItem__label').contains('Hide column').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});

it('Renders the traces table', () => {
cy.contains(' (108)').should('exist');
cy.contains('03/25/2021 10:23:45').should('exist');
cy.contains('03f9c770db5ee2f1caac0...').should('exist');
cy.contains('03f9c770db5ee2f1caac0afc36db49ba').should('exist');
cy.contains('224.99').should('exist');

// test data contains output from data-prepper 0.8, which doesn't have fields denormalized
Expand All @@ -52,7 +54,7 @@

it('Searches correctly', () => {
cy.get('input[type="search"]').focus().type(`${TRACE_ID}{enter}`);
cy.get('.euiButton__text').contains('Refresh').click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.contains(' (1)').should('exist');
cy.contains('03/25/2021 10:21:22').should('exist');
});
Expand All @@ -65,9 +67,11 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
cy.get('input[type="search"]').focus().type(`${TRACE_ID}`);
cy.get('.euiButton__text').contains('Refresh').click();
cy.get('[data-test-subj="superDatePickerApplyTimeButton"]').click();
cy.get('.euiTableRow').should('have.length.lessThan', 3);//Replaces wait
cy.get('[data-test-subj="trace-link"]').eq(0).click();
});
Expand All @@ -84,26 +88,25 @@
});

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

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

Check warning on line 99 in .cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.contains('2 columns hidden').should('exist');

cy.get('.euiLink').contains(SPAN_ID).trigger('mouseover', { force: true });

Check warning on line 102 in .cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true });

Check warning on line 103 in .cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
cy.get('button[data-datagrid-interactable="true"]').eq(0).click({ force: true }); // first click doesn't go through eui data grid

Check warning on line 104 in .cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls

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

Check warning on line 109 in .cypress/integration/trace_analytics_test/trace_analytics_traces.spec.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls

cy.get('.euiBadge__text').contains('spanId: ').should('exist');
cy.contains('Spans (1)').should('exist');
Expand All @@ -117,6 +120,8 @@
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
});

Expand All @@ -132,8 +137,8 @@
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('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');
Expand Down
Loading
Loading