Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Ritvi Bhatt committed Dec 5, 2024
2 parents 605ded9 + b418d44 commit 22fafa6
Show file tree
Hide file tree
Showing 22 changed files with 3,525 additions and 1,590 deletions.
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 @@ -154,6 +154,102 @@ describe('Testing traces table', () => {
});
});

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 @@ export const DATASOURCES_PATH = {
// 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
Loading

0 comments on commit 22fafa6

Please sign in to comment.