Skip to content

Commit

Permalink
optimize the code
Browse files Browse the repository at this point in the history
Signed-off-by: yubonluo <[email protected]>
  • Loading branch information
yubonluo committed Nov 14, 2024
1 parent 409cfdf commit 1c9f0d0
Showing 1 changed file with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,33 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
});

it('should contain correct content', () => {
// contains initial page title and description
// Contain initial page title and description
cy.contains('Welcome to OpenSearch').should('exist');
cy.contains('My workspaces').should('exist');
cy.contains(
'Collaborate on use-case based projects with workspaces. Select a workspace to get started.'
).should('exist');

// contains five use case title
// Contain five use case title
cy.contains('Observability').should('exist');
cy.contains('Security Analytics').should('exist');
cy.contains('Search').should('exist');
cy.contains('Essentials').should('exist');
cy.contains('Analytics').should('exist');

// contains no workspace message
// Contain no workspace message
cy.contains('No workspaces').should('exist');
cy.contains(
'Create a workspace or request a workspace owner to add you as a collaborator.'
).should('exist');

// contains created workspaces
// Contain created workspaces
cy.contains(workspaceName).should('exist');
cy.contains(
'Gain visibility into system health, performance, and reliability through monitoring of logs, metrics and traces.'
).should('not.exist');

// contains correct link
// Contain correct link
cy.contains('a', 'Learn more from documentation').should('exist');
cy.get(
'a[href="https://opensearch.org/docs/latest/opensearch/index/"]'
Expand All @@ -81,7 +84,7 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
'_blank'
);

// contain left bottom button
// Contain left bottom button
cy.get('[id$="popoverForSettingsIcon"]').should('exist');
cy.getElementByTestId('openDevToolsModal').should('exist');
if (Cypress.env('SECURITY_ENABLED')) {
Expand Down Expand Up @@ -237,12 +240,15 @@ if (Cypress.env('WORKSPACE_ENABLED')) {
});

it('should show correct no workspaces content', () => {
cy.contains('Welcome to OpenSearch').should('exist');

// Contain correct no workspaces message
cy.contains('No workspaces').should('exist');
cy.contains(
'Request a workspace owner to add you as a collaborator.'
).should('exist');
});

it('should not show create workspace button', () => {
// Not contain the create buttons
cy.getElementByTestId(
'workspace-initial-card-createWorkspace-button'
).should('not.exist');
Expand Down

0 comments on commit 1c9f0d0

Please sign in to comment.