Skip to content

Commit

Permalink
Address comments by adding additional assertion to navigation menu
Browse files Browse the repository at this point in the history
Signed-off-by: Owen Wang <[email protected]>
  • Loading branch information
FriedhelmWS committed Feb 12, 2025
1 parent 20b05ba commit ba9e106
Showing 1 changed file with 52 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if (isWorkspaceEnabled) {
cy.contains(`${workspaceName}_${feature}`).should('exist');
cy.get('.navGroupEnabledHomeIcon').should('exist');
cy.get('input[type="search"]').should('exist');
cy.contains(/Manage workspace/).should('exist');

// additional assertion according to different type of workspace
callbackFn();
Expand Down Expand Up @@ -72,39 +73,42 @@ if (isWorkspaceEnabled) {
}
});

it('features are visible inside left navigation analytics for analytics use case', () => {
it('features are visible inside left navigation for analytics use case', () => {
validateWorkspaceNavMenu('all', () => {
cy.contains('Visualize and report').should('exist');
cy.contains('Search').should('exist');
cy.contains('Manage workspace').should('exist');
cy.contains(/Visualize and report/).should('exist');
cy.contains(/Observability/).should('exist');
cy.contains(/Security Analytics/).should('exist');
cy.contains(/Search/).should('exist');
cy.contains(/Detect/).should('exist');
});
});

it('features are visible inside left navigation analytics for essentials use case', () => {
validateWorkspaceNavMenu('essentials', () => {
cy.contains('Manage workspace').should('exist');
});
it('features are visible inside left navigation for essentials use case', () => {
validateWorkspaceNavMenu('essentials', () => {});
});

it('features are visible inside left navigation analytics for search use case', () => {
it('features are visible inside left navigation for search use case', () => {
validateWorkspaceNavMenu('search', () => {
cy.contains('Visualize and report').should('exist');
cy.contains('Manage workspace').should('exist');
cy.contains(/Visualize and report/).should('exist');
isWorkspaceEnabled &&
cy.contains(/Compare search results/).should('exist');
});
});

it('features are visible inside left navigation analytics for security analytics use case', () => {
it('features are visible inside left navigation for security analytics use case', () => {
validateWorkspaceNavMenu('security-analytics', () => {
cy.contains('Visualize and report').should('exist');
cy.contains('Manage workspace').should('exist');
cy.contains(/Visualize and report/).should('exist');
cy.contains(/Threat detection/).should('exist');
cy.contains(/Detect/).should('exist');
cy.contains(/Alerting/).should('exist');
cy.contains(/Anomaly Detection/).should('exist');
});
});

it('features are visible inside left navigation for observability use case', () => {
validateWorkspaceNavMenu('observability', () => {
cy.contains('Visualize and report').should('exist');
cy.contains('Detect').should('exist');
cy.contains('Manage workspace').should('exist');
cy.contains(/Visualize and report/).should('exist');
cy.contains(/Detect/).should('exist');
});
});

Expand All @@ -127,21 +131,25 @@ if (isWorkspaceEnabled) {
it('navigation search should only search use case related features when inside a workspace', () => {
validateWorkspaceNavMenuSearch('visu', () => {
cy.getElementByTestId('search-result-panel').within(() => {
cy.contains('Visualizations').should('exist');
cy.contains(/Visualizations/).should('exist');
});
});
});

it('navigation search should show be able to search dev tools and open it as modal', () => {
validateWorkspaceNavMenuSearch('dev', () => {
cy.getElementByTestId('search-result-panel').within(() => {
cy.contains('Dev Tools').should('exist');
cy.contains('Console').should('exist').click();
cy.contains(/Dev Tools/).should('exist');
cy.contains(/Console/)
.should('exist')
.click();
cy.document().then((doc) => {
// click on the page to remove welcome message
cy.wrap(doc.body).click('center');
// expect dev tool popover to be opened
cy.wrap(doc.body).contains('Dev Tools').should('exist');
cy.wrap(doc.body)
.contains(/Dev Tools/)
.should('exist');
});
});
});
Expand All @@ -168,15 +176,19 @@ describe('Left navigation menu', () => {
cy.get('.navToggleInLargeScreen').should('exist').click();

// menu section should be able to expand/collapse, with inside items display/hide corectly
cy.contains('Visualizations').should('exist');
cy.contains(/Visualizations/).should('exist');

// collapse the menu section and expect content to be hidden
cy.contains('Visualize and report').should('exist').click();
cy.contains('Visualizations').should('not.exist');
cy.contains(/Visualize and report/)
.should('exist')
.click();
cy.contains(/Visualizations/).should('not.exist');

// expand the menu section and expect content to be visible
cy.contains('Visualize and report').should('exist').click();
cy.contains('Visualizations').should('exist');
cy.contains(/Visualize and report/)
.should('exist')
.click();
cy.contains(/Visualizations/).should('exist');
};
if (isWorkspaceEnabled) {
createWorkspace('all').then(() => {
Expand Down Expand Up @@ -233,7 +245,9 @@ describe('Left navigation menu', () => {
const validateRecentHistory = () => {
// expand the navigation menu
cy.get('.navToggleInLargeScreen').should('exist').click();
cy.contains('Visualizations').should('exist').click();
cy.contains(/Visualizations/)
.should('exist')
.click();

let visualizationName;
cy.getElementByTestId('itemsInMemTable').within(() => {
Expand All @@ -247,31 +261,34 @@ describe('Left navigation menu', () => {
});
});

cy.wait(1000);
// wait for the page to be loaded
cy.get('.visualize').should('exist');
cy.get('.headerRecentItemsButton--loadingIndicator').should('not.exist');

// open recent history dialog
cy.get('.headerRecentItemsButton').should('exist').click();
cy.get('div[role="dialog"]').within(() => {
// dialog displays correct visited content
cy.contains('Recent assets').should('exist');
cy.contains(/Recent assets/).should('exist');
cy.contains(visualizationName).should('exist');
});

// click recent history button again to close the dialog
cy.get('.headerRecentItemsButton').click();

// back to dashboard
cy.get('.left-navigation-wrapper').within(() => {
cy.contains('Dashboards').should('exist').click();
cy.contains(/Dashboards/)
.should('exist')
.click({ force: true });
});

cy.wait(1000);
// wait for the page to be loaded
cy.get('.application').should('exist');
cy.get('.headerRecentItemsButton--loadingIndicator').should('not.exist');

// open recent history dialog again
cy.get('.headerRecentItemsButton').should('exist').click();
cy.get('div[role="dialog"]').within(() => {
// click recent visited visualization in the dialog
cy.contains(visualizationName).should('exist').click();
cy.contains(visualizationName).should('exist').click({ force: true });
});

// should go back to the visualization screen just visited
Expand Down

0 comments on commit ba9e106

Please sign in to comment.