Skip to content

Commit 8bac394

Browse files
committed
Merge branch 'workspace_create' of github.com:Kapian1234/opensearch-dashboards-functional-test into workspace_create
2 parents 76d487f + 559e388 commit 8bac394

File tree

5 files changed

+424
-1
lines changed

5 files changed

+424
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';
7+
8+
const miscUtils = new MiscUtils(cy);
9+
const workspaceName = `test_workspace_analytics_${Math.random()
10+
.toString(36)
11+
.substring(7)}`;
12+
let workspaceDescription = 'This is a analytics workspace description.';
13+
let workspaceId;
14+
let datasourceId;
15+
let workspaceFeatures = ['use-case-all'];
16+
17+
const MDSEnabled = Cypress.env('DATASOURCE_MANAGEMENT_ENABLED');
18+
19+
if (Cypress.env('WORKSPACE_ENABLED')) {
20+
const createWorkspace = (dsId) => {
21+
cy.createWorkspace({
22+
name: workspaceName,
23+
description: workspaceDescription,
24+
features: workspaceFeatures,
25+
settings: {
26+
permissions: {
27+
library_write: { users: ['%me%'] },
28+
write: { users: ['%me%'] },
29+
},
30+
...(dsId ? { dataSources: [dsId] } : {}),
31+
},
32+
}).then((value) => {
33+
workspaceId = value;
34+
// load sample data
35+
cy.loadSampleDataForWorkspace('ecommerce', value, dsId);
36+
});
37+
};
38+
39+
describe('Analytics workspace overview', () => {
40+
before(() => {
41+
cy.deleteWorkspaceByName(workspaceName);
42+
if (MDSEnabled) {
43+
cy.deleteAllDataSources();
44+
cy.createDataSourceNoAuth().then((result) => {
45+
datasourceId = result[0];
46+
expect(datasourceId).to.be.a('string').that.is.not.empty;
47+
createWorkspace(datasourceId);
48+
});
49+
} else {
50+
createWorkspace();
51+
}
52+
});
53+
54+
after(() => {
55+
if (workspaceId) {
56+
cy.removeSampleDataForWorkspace('ecommerce', workspaceId, datasourceId);
57+
cy.deleteWorkspaceById(workspaceId);
58+
}
59+
cy.deleteAllDataSources();
60+
});
61+
62+
beforeEach(() => {
63+
// Visit workspace update page
64+
miscUtils.visitPage(`w/${workspaceId}/app/all_overview`);
65+
// wait for page load
66+
cy.contains('h1', 'Overview');
67+
});
68+
69+
it('should display get started sections', () => {
70+
cy.get('.euiCard__footer').contains('Observability').should('be.visible');
71+
// this is depends on observability plugin been installed
72+
// cy.url().should('include', 'app/observability-overview');
73+
74+
cy.get('.euiCard__footer')
75+
.contains('Security Analytics')
76+
.should('be.visible');
77+
// this is depends on security analytics plugin been installed
78+
// cy.url().should('include', 'app/sa_overview');
79+
80+
cy.get('.euiCard__footer')
81+
.contains('Search')
82+
.should('be.visible')
83+
.click();
84+
cy.url().should('include', 'app/search_overview');
85+
});
86+
87+
it('should display asset section correctly', () => {
88+
// no recently view assets
89+
cy.contains('No assets to display');
90+
91+
// recentlyCard
92+
cy.contains('Recently updated').should('be.visible').click();
93+
// should have 6 elements
94+
cy.getElementByTestId('recentlyCard').should('have.length', 6);
95+
96+
// filter by dashboard
97+
cy.getElementByTestId('comboBoxInput').click();
98+
cy.get('span.euiComboBoxOption__content').contains('dashboard').click();
99+
100+
// click dashboard card
101+
cy.getElementByTestId('recentlyCard').first().click();
102+
103+
// verify url has /app/dashboards
104+
cy.url().should('include', 'app/dashboards');
105+
106+
cy.go('back');
107+
108+
// view all
109+
cy.contains('View all').click();
110+
// verify url has /app/objects
111+
cy.url().should('include', 'app/objects');
112+
});
113+
114+
// Alerts and threat Alerts cards are depends on plugins
115+
116+
it('should display OpenSearch Documentation panel', () => {
117+
cy.contains('OpenSearch Documentation').should('be.visible');
118+
cy.get('.euiLink')
119+
.contains('Quickstart guide')
120+
.should('be.visible')
121+
.and(
122+
'have.attr',
123+
'href',
124+
'https://opensearch.org/docs/latest/dashboards/quickstart/'
125+
);
126+
cy.get('.euiLink')
127+
.contains('Building data visualizations')
128+
.should('be.visible')
129+
.and(
130+
'have.attr',
131+
'href',
132+
'https://opensearch.org/docs/latest/dashboards/visualize/viz-index/'
133+
);
134+
cy.get('.euiLink')
135+
.contains('Creating dashboards')
136+
.should('be.visible')
137+
.and(
138+
'have.attr',
139+
'href',
140+
'https://opensearch.org/docs/latest/dashboards/dashboard/index/'
141+
);
142+
cy.contains('Learn more in Documentation')
143+
.should('be.visible')
144+
.and(
145+
'have.attr',
146+
'href',
147+
'https://opensearch.org/docs/latest/dashboards/index/'
148+
);
149+
});
150+
});
151+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';
7+
8+
const miscUtils = new MiscUtils(cy);
9+
const workspaceName = `test_workspace_${Math.random()
10+
.toString(36)
11+
.substring(7)}`;
12+
let workspaceDescription = 'This is a workspace description.';
13+
let workspaceId;
14+
let datasourceId;
15+
let workspaceFeatures = ['use-case-essentials'];
16+
17+
const MDSEnabled = Cypress.env('DATASOURCE_MANAGEMENT_ENABLED');
18+
19+
if (Cypress.env('WORKSPACE_ENABLED')) {
20+
const createWorkspace = (datasourceId) => {
21+
cy.createWorkspace({
22+
name: workspaceName,
23+
description: workspaceDescription,
24+
features: workspaceFeatures,
25+
settings: {
26+
permissions: {
27+
library_write: { users: ['%me%'] },
28+
write: { users: ['%me%'] },
29+
},
30+
...(datasourceId ? { dataSources: [datasourceId] } : {}),
31+
},
32+
}).then((value) => {
33+
workspaceId = value;
34+
// load sample data
35+
cy.loadSampleDataForWorkspace('ecommerce', value, datasourceId);
36+
});
37+
};
38+
39+
describe('Essential workspace overview', () => {
40+
before(() => {
41+
cy.deleteWorkspaceByName(workspaceName);
42+
if (MDSEnabled) {
43+
cy.deleteAllDataSources();
44+
cy.createDataSourceNoAuth().then((result) => {
45+
datasourceId = result[0];
46+
expect(datasourceId).to.be.a('string').that.is.not.empty;
47+
createWorkspace(datasourceId);
48+
});
49+
} else {
50+
createWorkspace();
51+
}
52+
});
53+
54+
after(() => {
55+
if (workspaceId) {
56+
cy.removeSampleDataForWorkspace('ecommerce', workspaceId, datasourceId);
57+
cy.deleteWorkspaceById(workspaceId);
58+
}
59+
cy.deleteAllDataSources();
60+
});
61+
62+
beforeEach(() => {
63+
// Visit workspace update page
64+
miscUtils.visitPage(`w/${workspaceId}/app/essentials_overview`);
65+
// wait for page load
66+
cy.contains('h1', 'Overview');
67+
});
68+
69+
it('Get started cards display correctly', () => {
70+
// verify four get started cards exist
71+
cy.contains('Install sample data to experiment with OpenSearch.').click();
72+
// verify url has app/import_sample_data
73+
cy.url().should('include', 'app/import_sample_data');
74+
75+
// browser back
76+
cy.go('back');
77+
cy.contains('Explore data to uncover and discover insights.').click();
78+
// verify url has app/data-explorer/discover
79+
cy.url().should('include', 'app/data-explorer/discover');
80+
81+
// browser back
82+
cy.go('back');
83+
cy.contains(
84+
'Gain deeper insights by visualizing and aggregating your data.'
85+
).click();
86+
// verify url has app/visualize
87+
cy.url().should('include', 'app/visualize');
88+
89+
cy.go('back');
90+
cy.contains(
91+
'Monitor and explore your data using dynamic data visualization tools.'
92+
).click();
93+
// verify url has app/dashboards
94+
cy.url().should('include', 'app/dashboards');
95+
});
96+
97+
it('Assets cards display correctly', () => {
98+
// no recently view assets
99+
cy.contains('No assets to display');
100+
101+
// recentlyCard
102+
cy.contains('Recently updated').should('be.visible').click();
103+
// should have 6 elements
104+
cy.getElementByTestId('recentlyCard').should('have.length', 6);
105+
106+
// filter by dashboard
107+
cy.getElementByTestId('comboBoxInput').click();
108+
cy.get('span.euiComboBoxOption__content').contains('dashboard').click();
109+
110+
// click dashboard card
111+
cy.getElementByTestId('recentlyCard').first().click();
112+
113+
// verify url has /app/dashboards
114+
cy.url().should('include', 'app/dashboards');
115+
116+
cy.go('back');
117+
118+
// view all
119+
cy.contains('View all').click();
120+
// verify url has /app/objects
121+
cy.url().should('include', 'app/objects');
122+
});
123+
124+
it('Opensearch documentation cards display correctly', () => {
125+
cy.contains('OpenSearch Documentation');
126+
127+
// get a link with text as Quickstart guide
128+
cy.get('a')
129+
.contains('Quickstart guide')
130+
.should(
131+
'have.attr',
132+
'href',
133+
'https://opensearch.org/docs/latest/dashboards/quickstart/'
134+
);
135+
136+
cy.get('a')
137+
.contains('Building data visualizations')
138+
.should(
139+
'have.attr',
140+
'href',
141+
'https://opensearch.org/docs/latest/dashboards/visualize/viz-index/'
142+
);
143+
144+
cy.get('a')
145+
.contains('Creating dashboards')
146+
.should(
147+
'have.attr',
148+
'href',
149+
'https://opensearch.org/docs/latest/dashboards/dashboard/index/'
150+
);
151+
});
152+
});
153+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import { MiscUtils } from '@opensearch-dashboards-test/opensearch-dashboards-test-library';
7+
8+
const miscUtils = new MiscUtils(cy);
9+
const workspaceName = `test_workspace_search_${Math.random()
10+
.toString(36)
11+
.substring(7)}`;
12+
let workspaceDescription = 'This is a search workspace description.';
13+
let workspaceId;
14+
let datasourceId;
15+
let workspaceFeatures = ['use-case-search'];
16+
17+
const MDSEnabled = Cypress.env('DATASOURCE_MANAGEMENT_ENABLED');
18+
19+
if (Cypress.env('WORKSPACE_ENABLED')) {
20+
const createWorkspace = (datasourceId) => {
21+
cy.createWorkspace({
22+
name: workspaceName,
23+
description: workspaceDescription,
24+
features: workspaceFeatures,
25+
settings: {
26+
permissions: {
27+
library_write: { users: ['%me%'] },
28+
write: { users: ['%me%'] },
29+
},
30+
...(datasourceId ? { dataSources: [datasourceId] } : {}),
31+
},
32+
}).then((value) => {
33+
workspaceId = value;
34+
});
35+
};
36+
37+
describe('Search workspace overview', () => {
38+
before(() => {
39+
cy.deleteWorkspaceByName(workspaceName);
40+
if (MDSEnabled) {
41+
cy.deleteAllDataSources();
42+
cy.createDataSourceNoAuth().then((result) => {
43+
datasourceId = result[0];
44+
expect(datasourceId).to.be.a('string').that.is.not.empty;
45+
createWorkspace(datasourceId);
46+
});
47+
} else {
48+
createWorkspace();
49+
}
50+
});
51+
52+
after(() => {
53+
if (workspaceId) {
54+
cy.deleteWorkspaceById(workspaceId);
55+
}
56+
cy.deleteAllDataSources();
57+
});
58+
59+
beforeEach(() => {
60+
// Visit workspace update page
61+
miscUtils.visitPage(`w/${workspaceId}/app/search_overview`);
62+
// wait for page load
63+
cy.contains('h1', 'Overview');
64+
});
65+
66+
it('Set up search cards display correctly', () => {
67+
cy.contains(
68+
'Explore search capabilities and functionality of OpenSearch.'
69+
);
70+
cy.contains(
71+
'Create a document collection (an index) to query your data.'
72+
);
73+
74+
cy.contains('Explore data to uncover and discover insights.').click();
75+
// verify url has app/data-explorer/discover
76+
cy.url().should('include', 'app/data-explorer/discover');
77+
});
78+
79+
it('Different search techniques section display correctly', () => {
80+
cy.contains('h3', 'Text search').should('be.visible');
81+
cy.contains('h3', 'Analyzers').should('be.visible');
82+
cy.contains('h3', 'Semantic vector search').should('be.visible');
83+
cy.contains('h3', 'Neural sparse search').should('be.visible');
84+
cy.contains('h3', 'Hybrid search').should('be.visible');
85+
});
86+
87+
it('Configure and evaluate search cards display correctly', () => {
88+
cy.contains('Compare search results').should('be.visible').click();
89+
cy.url().should('contains', 'app/searchRelevance');
90+
});
91+
});
92+
}

0 commit comments

Comments
 (0)