-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[workspace]Add cypress for breadcrumbs (#1642)
* imporve link verification to support version Signed-off-by: Hailong Cui <[email protected]> * imporve link verification to support version Signed-off-by: Hailong Cui <[email protected]> * add breadcrumbs test Signed-off-by: Hailong Cui <[email protected]> * add breadcrumbs test Signed-off-by: Hailong Cui <[email protected]> * fix link with version Signed-off-by: Hailong Cui <[email protected]> * fix test failure Signed-off-by: Hailong Cui <[email protected]> * fix lint Signed-off-by: Hailong Cui <[email protected]> * fix test Signed-off-by: Hailong Cui <[email protected]> * wait for page load complete Signed-off-by: Hailong Cui <[email protected]> --------- Signed-off-by: Hailong Cui <[email protected]>
- Loading branch information
1 parent
ee2fb80
commit bd7a18f
Showing
4 changed files
with
209 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
...earch-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_breadcrumbs.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
|
||
const miscUtils = new MiscUtils(cy); | ||
const workspaceName = `test_workspace_analytics_${Math.random() | ||
.toString(36) | ||
.substring(7)}`; | ||
let workspaceDescription = 'This is a analytics workspace description.'; | ||
let workspaceId; | ||
let workspaceFeatures = ['use-case-all']; | ||
|
||
if (Cypress.env('WORKSPACE_ENABLED')) { | ||
const createWorkspace = () => { | ||
cy.createWorkspace({ | ||
name: workspaceName, | ||
description: workspaceDescription, | ||
features: workspaceFeatures, | ||
settings: { | ||
permissions: { | ||
library_write: { users: ['%me%'] }, | ||
write: { users: ['%me%'] }, | ||
}, | ||
}, | ||
}).then((value) => { | ||
workspaceId = value; | ||
}); | ||
}; | ||
|
||
describe('Breadcrumbs in workspace', () => { | ||
before(() => { | ||
cy.deleteWorkspaceByName(workspaceName); | ||
createWorkspace(); | ||
}); | ||
|
||
after(() => { | ||
if (workspaceId) { | ||
cy.deleteWorkspaceById(workspaceId); | ||
} | ||
}); | ||
|
||
it('should show workspace name in breadcrumbs', () => { | ||
miscUtils.visitPage(`w/${workspaceId}/app/objects`); | ||
|
||
// get div with class newTopNavHeader | ||
cy.get('.newTopNavHeader').within(() => { | ||
cy.getElementByTestId('breadcrumb first') | ||
.should('exist') | ||
.within(() => { | ||
// Check for the icon | ||
cy.getElementByTestId(`${workspaceId}-icon`).should('exist'); | ||
// Check for the workspace name | ||
cy.contains(workspaceName).should('exist').click(); | ||
// click on breadcrumbs goes to overview page | ||
cy.url().should('include', `w/${workspaceId}/app/all_overview`); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should show breadcrumbs in recent popover', () => { | ||
miscUtils.visitPage(`w/${workspaceId}/app/workspace_detail`); | ||
// wait for page load | ||
cy.contains('h1', 'Workspace details'); | ||
// waiting for page load completely | ||
cy.getElementByTestId('recentItemsSectionButton').should( | ||
'not.have.class', | ||
'headerRecentItemsButton--loadingIndicator', | ||
{ | ||
timeout: 10000, | ||
} | ||
); | ||
cy.wait(1000); | ||
cy.getElementByTestId('recentItemsSectionButton').click({ force: true }); | ||
|
||
cy.get('.euiPopover__panel').within(() => { | ||
cy.getElementByTestId('breadcrumbs').within(() => { | ||
// Check for the icon | ||
cy.getElementByTestId(`${workspaceId}-icon`).should('exist'); | ||
// Check for the workspace name | ||
cy.contains(workspaceName).should('exist'); | ||
// page title exists in breadcrumbs | ||
cy.contains('Workspace details'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('Breadcrumbs out of workspace', () => { | ||
it('breadcrumbs display correctly in settings and setup', () => { | ||
miscUtils.visitPage('app/workspace_list'); | ||
cy.contains('h1', 'Workspaces'); | ||
|
||
cy.get('.newTopNavHeader').within(() => { | ||
cy.getElementByTestId('breadcrumb first') | ||
.should('exist') | ||
.within(() => { | ||
// Check for the use case name | ||
cy.contains('Settings and setup').click(); | ||
cy.url().should('include', 'app/settings_landing'); | ||
}); | ||
}); | ||
|
||
// check breadcrumbs in recent popover | ||
cy.getElementByTestId('recentItemsSectionButton').should( | ||
'not.have.class', | ||
'headerRecentItemsButton--loadingIndicator', | ||
{ | ||
timeout: 10000, | ||
} | ||
); | ||
cy.wait(1000); | ||
cy.getElementByTestId('recentItemsSectionButton').click({ force: true }); | ||
|
||
cy.get('.euiPopover__panel').within(() => { | ||
cy.getElementByTestId('breadcrumbs').within(() => { | ||
cy.contains('Settings and setup'); | ||
cy.contains('Settings and setup overview'); | ||
}); | ||
}); | ||
}); | ||
|
||
it('breadcrumbs display correctly in data administration', () => { | ||
miscUtils.visitPage('app/data_administration_landing'); | ||
cy.contains('h1', 'Data administration overview'); | ||
|
||
cy.get('.newTopNavHeader').within(() => { | ||
cy.getElementByTestId('breadcrumb first') | ||
.should('exist') | ||
.within(() => { | ||
// Check for the use case name | ||
cy.contains('Data administration'); | ||
}); | ||
}); | ||
|
||
// check breadcrumbs in recent popover | ||
cy.getElementByTestId('recentItemsSectionButton').should( | ||
'not.have.class', | ||
'headerRecentItemsButton--loadingIndicator', | ||
{ | ||
timeout: 10000, | ||
} | ||
); | ||
cy.wait(1000); | ||
cy.getElementByTestId('recentItemsSectionButton').click({ force: true }); | ||
|
||
cy.get('.euiPopover__panel').within(() => { | ||
cy.getElementByTestId('breadcrumbs').within(() => { | ||
cy.contains('Data administration'); | ||
cy.contains('Data administration overview'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters