-
Notifications
You must be signed in to change notification settings - Fork 114
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
Add cypress test for workspace overview page #1633
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6216927
cypress test for use case overview page
Hailong-am c121643
add cypress test for analytics overview page
Hailong-am fe0f9f8
add sample data cleanup
Hailong-am 04e3abf
support mds is not enabled
Hailong-am ff68b7a
remove alerts cards
Hailong-am e30f305
fix failed test case
Hailong-am File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
151 changes: 151 additions & 0 deletions
151
...shboards/opensearch-dashboards/workspace-plugin/mds_workspace_analytics_overviews.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,151 @@ | ||
/* | ||
* 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 datasourceId; | ||
let workspaceFeatures = ['use-case-all']; | ||
|
||
const MDSEnabled = Cypress.env('DATASOURCE_MANAGEMENT_ENABLED'); | ||
|
||
if (Cypress.env('WORKSPACE_ENABLED')) { | ||
const createWorkspace = (dsId) => { | ||
cy.createWorkspace({ | ||
name: workspaceName, | ||
description: workspaceDescription, | ||
features: workspaceFeatures, | ||
settings: { | ||
permissions: { | ||
library_write: { users: ['%me%'] }, | ||
write: { users: ['%me%'] }, | ||
}, | ||
...(dsId ? { dataSources: [dsId] } : {}), | ||
}, | ||
}).then((value) => { | ||
workspaceId = value; | ||
// load sample data | ||
cy.loadSampleDataForWorkspace('ecommerce', value, dsId); | ||
}); | ||
}; | ||
|
||
describe('Analytics workspace overview', () => { | ||
before(() => { | ||
cy.deleteWorkspaceByName(workspaceName); | ||
if (MDSEnabled) { | ||
cy.deleteAllDataSources(); | ||
cy.createDataSourceNoAuth().then((result) => { | ||
datasourceId = result[0]; | ||
expect(datasourceId).to.be.a('string').that.is.not.empty; | ||
createWorkspace(datasourceId); | ||
}); | ||
} else { | ||
createWorkspace(); | ||
} | ||
}); | ||
|
||
after(() => { | ||
if (workspaceId) { | ||
cy.removeSampleDataForWorkspace('ecommerce', workspaceId, datasourceId); | ||
cy.deleteWorkspaceById(workspaceId); | ||
} | ||
cy.deleteAllDataSources(); | ||
}); | ||
|
||
beforeEach(() => { | ||
// Visit workspace update page | ||
miscUtils.visitPage(`w/${workspaceId}/app/all_overview`); | ||
// wait for page load | ||
cy.contains('h1', 'Overview'); | ||
}); | ||
|
||
it('should display get started sections', () => { | ||
cy.get('.euiCard__footer').contains('Observability').should('be.visible'); | ||
// this is depends on observability plugin been installed | ||
// cy.url().should('include', 'app/observability-overview'); | ||
|
||
cy.get('.euiCard__footer') | ||
.contains('Security Analytics') | ||
.should('be.visible'); | ||
// this is depends on security analytics plugin been installed | ||
// cy.url().should('include', 'app/sa_overview'); | ||
|
||
cy.get('.euiCard__footer') | ||
.contains('Search') | ||
.should('be.visible') | ||
.click(); | ||
cy.url().should('include', 'app/search_overview'); | ||
}); | ||
|
||
it('should display asset section correctly', () => { | ||
// no recently view assets | ||
cy.contains('No assets to display'); | ||
|
||
// recentlyCard | ||
cy.contains('Recently updated').should('be.visible').click(); | ||
// should have 6 elements | ||
cy.getElementByTestId('recentlyCard').should('have.length', 6); | ||
|
||
// filter by dashboard | ||
cy.getElementByTestId('comboBoxInput').click(); | ||
cy.get('span.euiComboBoxOption__content').contains('dashboard').click(); | ||
|
||
// click dashboard card | ||
cy.getElementByTestId('recentlyCard').first().click(); | ||
|
||
// verify url has /app/dashboards | ||
cy.url().should('include', 'app/dashboards'); | ||
|
||
cy.go('back'); | ||
|
||
// view all | ||
cy.contains('View all').click(); | ||
// verify url has /app/objects | ||
cy.url().should('include', 'app/objects'); | ||
}); | ||
|
||
// Alerts and threat Alerts cards are depends on plugins | ||
|
||
it('should display OpenSearch Documentation panel', () => { | ||
cy.contains('OpenSearch Documentation').should('be.visible'); | ||
cy.get('.euiLink') | ||
.contains('Quickstart guide') | ||
.should('be.visible') | ||
.and( | ||
'have.attr', | ||
'href', | ||
'https://opensearch.org/docs/latest/dashboards/quickstart/' | ||
); | ||
cy.get('.euiLink') | ||
.contains('Building data visualizations') | ||
.should('be.visible') | ||
.and( | ||
'have.attr', | ||
'href', | ||
'https://opensearch.org/docs/latest/dashboards/visualize/viz-index/' | ||
); | ||
cy.get('.euiLink') | ||
.contains('Creating dashboards') | ||
.should('be.visible') | ||
.and( | ||
'have.attr', | ||
'href', | ||
'https://opensearch.org/docs/latest/dashboards/dashboard/index/' | ||
); | ||
cy.contains('Learn more in Documentation') | ||
.should('be.visible') | ||
.and( | ||
'have.attr', | ||
'href', | ||
'https://opensearch.org/docs/latest/dashboards/index/' | ||
); | ||
}); | ||
}); | ||
} |
153 changes: 153 additions & 0 deletions
153
...shboards/opensearch-dashboards/workspace-plugin/mds_workspace_essential_overviews.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,153 @@ | ||
/* | ||
* 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_${Math.random() | ||
.toString(36) | ||
.substring(7)}`; | ||
let workspaceDescription = 'This is a workspace description.'; | ||
let workspaceId; | ||
let datasourceId; | ||
let workspaceFeatures = ['use-case-essentials']; | ||
|
||
const MDSEnabled = Cypress.env('DATASOURCE_MANAGEMENT_ENABLED'); | ||
|
||
if (Cypress.env('WORKSPACE_ENABLED')) { | ||
const createWorkspace = (datasourceId) => { | ||
cy.createWorkspace({ | ||
name: workspaceName, | ||
description: workspaceDescription, | ||
features: workspaceFeatures, | ||
settings: { | ||
permissions: { | ||
library_write: { users: ['%me%'] }, | ||
write: { users: ['%me%'] }, | ||
}, | ||
...(datasourceId ? { dataSources: [datasourceId] } : {}), | ||
}, | ||
}).then((value) => { | ||
workspaceId = value; | ||
// load sample data | ||
cy.loadSampleDataForWorkspace('ecommerce', value, datasourceId); | ||
}); | ||
}; | ||
|
||
describe('Essential workspace overview', () => { | ||
before(() => { | ||
cy.deleteWorkspaceByName(workspaceName); | ||
if (MDSEnabled) { | ||
cy.deleteAllDataSources(); | ||
cy.createDataSourceNoAuth().then((result) => { | ||
datasourceId = result[0]; | ||
expect(datasourceId).to.be.a('string').that.is.not.empty; | ||
createWorkspace(datasourceId); | ||
}); | ||
} else { | ||
createWorkspace(); | ||
} | ||
}); | ||
|
||
after(() => { | ||
if (workspaceId) { | ||
cy.removeSampleDataForWorkspace('ecommerce', workspaceId, datasourceId); | ||
cy.deleteWorkspaceById(workspaceId); | ||
} | ||
cy.deleteAllDataSources(); | ||
}); | ||
|
||
beforeEach(() => { | ||
// Visit workspace update page | ||
miscUtils.visitPage(`w/${workspaceId}/app/essentials_overview`); | ||
// wait for page load | ||
cy.contains('h1', 'Overview'); | ||
}); | ||
|
||
it('Get started cards display correctly', () => { | ||
// verify four get started cards exist | ||
cy.contains('Install sample data to experiment with OpenSearch.').click(); | ||
// verify url has app/import_sample_data | ||
cy.url().should('include', 'app/import_sample_data'); | ||
|
||
// browser back | ||
cy.go('back'); | ||
cy.contains('Explore data to uncover and discover insights.').click(); | ||
// verify url has app/data-explorer/discover | ||
cy.url().should('include', 'app/data-explorer/discover'); | ||
|
||
// browser back | ||
cy.go('back'); | ||
cy.contains( | ||
'Gain deeper insights by visualizing and aggregating your data.' | ||
).click(); | ||
// verify url has app/visualize | ||
cy.url().should('include', 'app/visualize'); | ||
|
||
cy.go('back'); | ||
cy.contains( | ||
'Monitor and explore your data using dynamic data visualization tools.' | ||
).click(); | ||
// verify url has app/dashboards | ||
cy.url().should('include', 'app/dashboards'); | ||
}); | ||
|
||
it('Assets cards display correctly', () => { | ||
// no recently view assets | ||
cy.contains('No assets to display'); | ||
|
||
// recentlyCard | ||
cy.contains('Recently updated').should('be.visible').click(); | ||
// should have 6 elements | ||
cy.getElementByTestId('recentlyCard').should('have.length', 6); | ||
|
||
// filter by dashboard | ||
cy.getElementByTestId('comboBoxInput').click(); | ||
cy.get('span.euiComboBoxOption__content').contains('dashboard').click(); | ||
|
||
// click dashboard card | ||
cy.getElementByTestId('recentlyCard').first().click(); | ||
|
||
// verify url has /app/dashboards | ||
cy.url().should('include', 'app/dashboards'); | ||
|
||
cy.go('back'); | ||
|
||
// view all | ||
cy.contains('View all').click(); | ||
// verify url has /app/objects | ||
cy.url().should('include', 'app/objects'); | ||
}); | ||
|
||
it('Opensearch documentation cards display correctly', () => { | ||
cy.contains('OpenSearch Documentation'); | ||
|
||
// get a link with text as Quickstart guide | ||
cy.get('a') | ||
.contains('Quickstart guide') | ||
.should( | ||
'have.attr', | ||
'href', | ||
'https://opensearch.org/docs/latest/dashboards/quickstart/' | ||
); | ||
|
||
cy.get('a') | ||
.contains('Building data visualizations') | ||
.should( | ||
'have.attr', | ||
'href', | ||
'https://opensearch.org/docs/latest/dashboards/visualize/viz-index/' | ||
); | ||
|
||
cy.get('a') | ||
.contains('Creating dashboards') | ||
.should( | ||
'have.attr', | ||
'href', | ||
'https://opensearch.org/docs/latest/dashboards/dashboard/index/' | ||
); | ||
}); | ||
}); | ||
} |
92 changes: 92 additions & 0 deletions
92
...-dashboards/opensearch-dashboards/workspace-plugin/mds_workspace_search_overviews.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,92 @@ | ||
/* | ||
* 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_search_${Math.random() | ||
.toString(36) | ||
.substring(7)}`; | ||
let workspaceDescription = 'This is a search workspace description.'; | ||
let workspaceId; | ||
let datasourceId; | ||
let workspaceFeatures = ['use-case-search']; | ||
|
||
const MDSEnabled = Cypress.env('DATASOURCE_MANAGEMENT_ENABLED'); | ||
|
||
if (Cypress.env('WORKSPACE_ENABLED')) { | ||
const createWorkspace = (datasourceId) => { | ||
cy.createWorkspace({ | ||
name: workspaceName, | ||
description: workspaceDescription, | ||
features: workspaceFeatures, | ||
settings: { | ||
permissions: { | ||
library_write: { users: ['%me%'] }, | ||
write: { users: ['%me%'] }, | ||
}, | ||
...(datasourceId ? { dataSources: [datasourceId] } : {}), | ||
}, | ||
}).then((value) => { | ||
workspaceId = value; | ||
}); | ||
}; | ||
|
||
describe('Search workspace overview', () => { | ||
before(() => { | ||
cy.deleteWorkspaceByName(workspaceName); | ||
if (MDSEnabled) { | ||
cy.deleteAllDataSources(); | ||
cy.createDataSourceNoAuth().then((result) => { | ||
datasourceId = result[0]; | ||
expect(datasourceId).to.be.a('string').that.is.not.empty; | ||
createWorkspace(datasourceId); | ||
}); | ||
} else { | ||
createWorkspace(); | ||
} | ||
}); | ||
|
||
after(() => { | ||
if (workspaceId) { | ||
cy.deleteWorkspaceById(workspaceId); | ||
} | ||
cy.deleteAllDataSources(); | ||
}); | ||
|
||
beforeEach(() => { | ||
// Visit workspace update page | ||
miscUtils.visitPage(`w/${workspaceId}/app/search_overview`); | ||
// wait for page load | ||
cy.contains('h1', 'Overview'); | ||
}); | ||
|
||
it('Set up search cards display correctly', () => { | ||
cy.contains( | ||
'Explore search capabilities and functionality of OpenSearch.' | ||
); | ||
cy.contains( | ||
'Create a document collection (an index) to query your data.' | ||
); | ||
|
||
cy.contains('Explore data to uncover and discover insights.').click(); | ||
// verify url has app/data-explorer/discover | ||
cy.url().should('include', 'app/data-explorer/discover'); | ||
}); | ||
|
||
it('Different search techniques section display correctly', () => { | ||
cy.contains('h3', 'Text search').should('be.visible'); | ||
cy.contains('h3', 'Analyzers').should('be.visible'); | ||
cy.contains('h3', 'Semantic vector search').should('be.visible'); | ||
cy.contains('h3', 'Neural sparse search').should('be.visible'); | ||
cy.contains('h3', 'Hybrid search').should('be.visible'); | ||
}); | ||
|
||
it('Configure and evaluate search cards display correctly', () => { | ||
cy.contains('Compare search results').should('be.visible').click(); | ||
cy.url().should('contains', 'app/searchRelevance'); | ||
}); | ||
}); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can move the function to a util function maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cy.createWorkspace
already been a util function, and thiscreateWorkspace
function just utilized thecy.createWorkspace
to create workspace with and without datasource. To move it to a common place as util function may not benefits other test cases.