-
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.
Test sample data with multiple data source enabled on local cluster (#…
…756) (#758) Signed-off-by: Kristen Tian <[email protected]> (cherry picked from commit e1bd324) Co-authored-by: Kristen Tian <[email protected]>
- Loading branch information
1 parent
67f740d
commit f52cafe
Showing
1 changed file
with
166 additions
and
0 deletions.
There are no files selected for viewing
166 changes: 166 additions & 0 deletions
166
...opensearch-dashboards/opensearch-dashboards/dashboard_sample_data_with_datasource_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,166 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { | ||
CommonUI, | ||
MiscUtils, | ||
} from '@opensearch-dashboards-test/opensearch-dashboards-test-library'; | ||
|
||
const commonUI = new CommonUI(cy); | ||
const miscUtils = new MiscUtils(cy); | ||
const baseURL = new URL(Cypress.config().baseUrl); | ||
// remove trailing slash | ||
const path = baseURL.pathname.replace(/\/$/, ''); | ||
|
||
if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) { | ||
describe('dashboard local cluster sample data validation', () => { | ||
before(() => {}); | ||
|
||
after(() => {}); | ||
|
||
describe('checking home page', () => { | ||
before(() => { | ||
// Go to the home page | ||
miscUtils.visitPage('app/home#'); | ||
cy.window().then((win) => | ||
win.localStorage.setItem('home:welcome:show', false) | ||
); | ||
cy.reload(true); | ||
}); | ||
|
||
after(() => { | ||
cy.window().then((win) => | ||
win.localStorage.removeItem('home:welcome:show') | ||
); | ||
}); | ||
|
||
it('checking tutorial_directory display', () => { | ||
// Check that tutorial_directory is visible | ||
commonUI.checkElementExists( | ||
`a[href="${path}/app/home#/tutorial_directory"]`, | ||
2 | ||
); | ||
}); | ||
}); | ||
|
||
describe('adding sample data', () => { | ||
before(() => { | ||
miscUtils.addSampleData(); | ||
}); | ||
|
||
after(() => { | ||
miscUtils.removeSampleData(); | ||
}); | ||
|
||
it('checking ecommerce dashboards displayed', () => { | ||
miscUtils.viewData('ecommerce'); | ||
commonUI.checkElementContainsValue( | ||
'span[title="[eCommerce] Revenue Dashboard"]', | ||
1, | ||
'\\[eCommerce\\] Revenue Dashboard' | ||
); | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="markdownBody"] > h3', | ||
1, | ||
'Sample eCommerce Data' | ||
); | ||
}); | ||
|
||
it('checking flights dashboards displayed', () => { | ||
miscUtils.viewData('flights'); | ||
commonUI.checkElementContainsValue( | ||
'span[title="[Flights] Global Flight Dashboard"]', | ||
1, | ||
'\\[Flights\\] Global Flight Dashboard' | ||
); | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="markdownBody"] > h3', | ||
1, | ||
'Sample Flight data' | ||
); | ||
}); | ||
|
||
it('checking web logs dashboards displayed', () => { | ||
miscUtils.viewData('logs'); | ||
commonUI.checkElementContainsValue( | ||
'span[title="[Logs] Web Traffic"]', | ||
1, | ||
'\\[Logs\\] Web Traffic' | ||
); | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="markdownBody"] > h3', | ||
1, | ||
'Sample Logs Data' | ||
); | ||
}); | ||
|
||
describe('checking index patterns', () => { | ||
before(() => { | ||
miscUtils.visitPage( | ||
'app/management/opensearch-dashboards/indexPatterns' | ||
); | ||
}); | ||
|
||
after(() => {}); | ||
|
||
it('checking ecommerce index patterns are added', () => { | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="indexPatternTable"]', | ||
1, | ||
'opensearch_dashboards_sample_data_ecommerce' | ||
); | ||
}); | ||
|
||
it('checking flights index patterns are added', () => { | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="indexPatternTable"]', | ||
1, | ||
'opensearch_dashboards_sample_data_flights' | ||
); | ||
}); | ||
|
||
it('checking web logs index patterns are added', () => { | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="indexPatternTable"]', | ||
1, | ||
'opensearch_dashboards_sample_data_logs' | ||
); | ||
}); | ||
}); | ||
|
||
describe('checking saved objects', () => { | ||
before(() => { | ||
miscUtils.visitPage('app/management/opensearch-dashboards/objects'); | ||
}); | ||
|
||
after(() => {}); | ||
|
||
it('checking ecommerce object is saved', () => { | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="savedObjectsTable"]', | ||
1, | ||
'opensearch_dashboards_sample_data_ecommerce' | ||
); | ||
}); | ||
|
||
it('checking flights object is saved', () => { | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="savedObjectsTable"]', | ||
1, | ||
'opensearch_dashboards_sample_data_flights' | ||
); | ||
}); | ||
|
||
it('checking web logs object is saved', () => { | ||
commonUI.checkElementContainsValue( | ||
'div[data-test-subj="savedObjectsTable"]', | ||
1, | ||
'opensearch_dashboards_sample_data_logs' | ||
); | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |