Skip to content

Commit

Permalink
Speed up dashboard add panel (#22278) (#22339)
Browse files Browse the repository at this point in the history
* Rebuild modulePath correctly if on Windows

* Change how we find dashboard add panel is loaded

* Add and use find.byClassName instead of remote

* cleanup a comment
  • Loading branch information
Lee Drengenberg authored Aug 27, 2018
1 parent b3b2747 commit 1b408ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/functional/services/dashboard/add_panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function DashboardAddPanelProvider({ getService, getPageObjects }) {
const testSubjects = getService('testSubjects');
const flyout = getService('flyout');
const PageObjects = getPageObjects(['header', 'common']);
const find = getService('find');

return new class DashboardAddPanel {
async clickOpenAddPanel() {
Expand Down Expand Up @@ -94,8 +95,10 @@ export function DashboardAddPanelProvider({ getService, getPageObjects }) {
}

async waitForEuiTableLoading() {
const addPanel = await testSubjects.find('dashboardAddPanel');
await addPanel.waitForDeletedByClassName('euiBasicTable-loading');
await retry.waitFor('dashboard add panel loading to complete', async () => {
const table = await find.byClassName('euiBasicTable');
return !((await table.getAttribute('class')).includes('loading'));
});
}

async closeAddPanel() {
Expand Down Expand Up @@ -169,8 +172,6 @@ export function DashboardAddPanelProvider({ getService, getPageObjects }) {
async addVisualization(vizName) {
log.debug(`DashboardAddPanel.addVisualization(${vizName})`);
await this.ensureAddPanelIsShowing();
// workaround for timing issue with slideout animation
await PageObjects.common.sleep(500);
await this.filterEmbeddableNames(`"${vizName.replace('-', ' ')}"`);
await testSubjects.click(`addPanel${vizName.split(' ').join('-')}`);
await this.closeAddPanel();
Expand Down
7 changes: 7 additions & 0 deletions test/functional/services/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ export function FindProvider({ getService }) {
});
}

async byClassName(selector, timeout = defaultFindTimeout) {
log.debug(`findByCssSelector ${selector}`);
return await this._ensureElementWithTimeout(timeout, async remote => {
return await remote.findByClassName(selector);
});
}

async setValue(selector, text) {
return await retry.try(async () => {
const element = await this.byCssSelector(selector);
Expand Down

0 comments on commit 1b408ed

Please sign in to comment.