@grafana/e2e: improvements (#25677)

* Minor changes

* Fixed data source selection issue

… where it appeared as though the wrong one was selected

* Fixed “executing a canceled action” issue

... thrown from RxJS
This commit is contained in:
Steven Vachon 2020-06-17 15:39:39 -04:00 committed by GitHub
parent cf109df887
commit 5b5b247cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,12 +38,21 @@ export const addPanel = (config?: Partial<AddPanelConfig>): any =>
.route('POST', '/api/ds/query')
.as('chartData');
e2e()
.get('.ds-picker')
.click()
.contains('[id^="react-select-"][id*="-option-"]', dataSourceName)
.scrollIntoView()
.click();
e2e.components.DataSourcePicker.container().within(() => {
e2e()
.get('[class$="-input-suffix"]')
.click();
e2e.components.Select.option()
.filter(`:contains("${dataSourceName}")`)
.scrollIntoView()
.click();
e2e()
.root()
.scrollIntoView();
});
// @todo instead wait for '@pluginModule'
e2e().wait(2000);
openOptions();
@ -56,8 +65,7 @@ export const addPanel = (config?: Partial<AddPanelConfig>): any =>
closeOptionsGroup('settings');
openOptionsGroup('type');
e2e()
.get(`[aria-label="Plugin visualization item ${visualizationName}"]`)
e2e.components.PluginVisualization.item(visualizationName)
.scrollIntoView()
.click();
closeOptionsGroup('type');
@ -77,6 +85,11 @@ export const addPanel = (config?: Partial<AddPanelConfig>): any =>
.get('button[title="Apply changes and go back to dashboard"]')
.click();
e2e().wait('@chartData');
// Wait for RxJS
e2e().wait(500);
// @todo remove `wrap` when possible
return e2e().wrap({ config: fullConfig });
});