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

[Manual Backport 2.x ] 2257 to 2.x Traces - Gantt chart / Span list rework #2283

Merged
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 @@ -5,7 +5,7 @@

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

import { delay, setTimeFilter, SPAN_ID, TRACE_ID } from '../../utils/constants';
import { setTimeFilter, SPAN_ID, TRACE_ID, SPAN_ID_TREE_VIEW } from '../../utils/constants';

describe('Testing traces table empty state', () => {
beforeEach(() => {
Expand Down Expand Up @@ -96,17 +96,17 @@
});

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 Down Expand Up @@ -154,6 +154,102 @@
});
});

describe('Testing traces tree view', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/traces', {
onBeforeLoad: (win) => {
win.sessionStorage.clear();
},
});
cy.get("[data-test-subj='indexPattern-switch-link']").click();
cy.get("[data-test-subj='data_prepper-mode']").click();
setTimeFilter();
cy.contains('02feb3a4f611abd81f2a53244d1278ae').click();
cy.get('h1.overview-content').contains('02feb3a4f611abd81f2a53244d1278ae').should('exist');
});

it('Verifies tree view and table toggle functionality with expand/collapse logic', () => {
cy.get('.euiButtonGroup').contains('Tree view').click();
cy.contains('Expand all').should('exist');
cy.contains("Collapse all").should('exist')
//Waiting time for render to complete
cy.get("[data-test-subj='treeExpandAll']").click();
cy.get("[data-test-subj='treeCollapseAll']").click();

cy.get("[data-test-subj='spanId-link']").then((initialSpanIds) => {
const initialCount = initialSpanIds.length;
expect(initialCount).to.equal(6);

cy.get("[data-test-subj='treeExpandAll']").click();

cy.get("[data-test-subj='spanId-link']").then((expandedSpanIds) => {
const expandedCount = expandedSpanIds.length;
expect(expandedCount).to.equal(10);
});

cy.get("[data-test-subj='treeCollapseAll']").click();

cy.get("[data-test-subj='spanId-link']").then((collapsedSpanIds) => {
const collapsedCount = collapsedSpanIds.length;
expect(collapsedCount).to.equal(6); // Collapsed rows should match the initial count
});
});
});

it('Verifies tree view expand arrow functionality', () => {
cy.get('.euiButtonGroup').contains('Tree view').click();
cy.contains('Expand all').should('exist');
cy.contains("Collapse all").should('exist')
// Waiting time for render to complete
cy.get("[data-test-subj='treeExpandAll']").click();
cy.get("[data-test-subj='treeCollapseAll']").click();

cy.get("[data-test-subj='spanId-link']").then((initialSpanIds) => {
const initialCount = initialSpanIds.length;
expect(initialCount).to.equal(6);

// Find and click the first tree view expand arrow
cy.get("[data-test-subj='treeViewExpandArrow']").first().click();

// Check the number of Span IDs after expanding the arrow (should be 7)
cy.get("[data-test-subj='spanId-link']").then((expandedSpanIds) => {
const expandedCount = expandedSpanIds.length;
expect(expandedCount).to.equal(7);
});
});
});

it('Verifies span flyout', () => {
cy.get('.euiButtonGroup').contains('Tree view').click();
cy.contains('Expand all').should('exist');
cy.contains("Collapse all").should('exist')
// Waiting time for render to complete
cy.get("[data-test-subj='treeExpandAll']").click();
cy.get("[data-test-subj='treeCollapseAll']").click();

// Open flyout for a span
cy.get("[data-test-subj='spanId-link']")
.contains(SPAN_ID_TREE_VIEW)
.click()
cy.contains('Span detail').should('exist');
cy.contains('Span attributes').should('exist');
});

it('Handles toggling between full screen and regular modes', () => {
cy.get('.euiButtonGroup').contains('Tree view').click();
cy.contains('Expand all').should('exist');
cy.contains("Collapse all").should('exist')
// Waiting time for render to complete
cy.get("[data-test-subj='treeExpandAll']").click();
cy.get("[data-test-subj='treeCollapseAll']").click();

cy.get('[data-test-subj="fullScreenButton"]').click();
cy.get('.euiButtonEmpty__text').should('contain.text', 'Exit full screen');
cy.get('[data-test-subj="fullScreenButton"]').click();
cy.get('.euiButtonEmpty__text').should('contain.text', 'Full screen');
});
});

describe('Testing switch mode to jaeger', () => {
beforeEach(() => {
cy.visit('app/observability-traces#/traces', {
Expand Down
1 change: 1 addition & 0 deletions .cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
// trace analytics
export const TRACE_ID = '8832ed6abbb2a83516461960c89af49d';
export const SPAN_ID = 'a673bc074b438374';
export const SPAN_ID_TREE_VIEW = 'fe4076542b41d40b';
export const SERVICE_NAME = 'frontend-client';
export const SERVICE_SPAN_ID = 'e275ac9d21929e9b';
export const AUTH_SERVICE_SPAN_ID = '277a5934acf55dcf';
Expand Down Expand Up @@ -69,13 +70,13 @@
cy.get('.euiQuickSelect__applyButton').click();
cy.get('.euiSuperDatePicker__prettyFormatLink').click();
cy.get('.euiTab__content').contains('Absolute').click();
cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]')

Check warning on line 73 in .cypress/utils/constants.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.focus()
.type('{selectall}' + startTime, { force: true });
if (setEndTime) {
cy.get('button.euiDatePopoverButton--end[data-test-subj="superDatePickerendDatePopoverButton"]').click();
cy.get('.euiTab__content').contains('Absolute').click();
cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]')

Check warning on line 79 in .cypress/utils/constants.js

View workflow job for this annotation

GitHub Actions / Lint

Do not use force on click and type calls
.focus()
.type('{selectall}' + endTime, { force: true });
}
Expand Down
Loading
Loading