Skip to content

Commit

Permalink
Change implementation on TSVB functional when testing the indexPatter…
Browse files Browse the repository at this point in the history
…n switch (#78754)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
stratoula and elasticmachine authored Oct 1, 2020
1 parent 8f89ef5 commit 36814aa
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/functional/apps/visualize/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,11 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.visualBuilder.clickPanelOptions('metric');
const fromTime = 'Oct 22, 2018 @ 00:00:00.000';
const toTime = 'Oct 28, 2018 @ 23:59:59.999';
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
// Sometimes popovers take some time to appear in Firefox (#71979)
await retry.tryForTime(20000, async () => {
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime);
await PageObjects.visualBuilder.setIndexPatternValue('kibana_sample_data_flights');
await PageObjects.common.sleep(3000);
await PageObjects.visualBuilder.waitForIndexPatternTimeFieldOptionsLoaded();
await PageObjects.visualBuilder.selectIndexPatternTimeField('timestamp');
});
const newValue = await PageObjects.visualBuilder.getMetricValue();
Expand Down
8 changes: 8 additions & 0 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,14 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
await PageObjects.header.waitUntilLoadingHasFinished();
}

public async waitForIndexPatternTimeFieldOptionsLoaded() {
await retry.waitFor('combobox options loaded', async () => {
const options = await comboBox.getOptions('metricsIndexPatternFieldsSelect');
log.debug(`-- optionsCount=${options.length}`);
return options.length > 0;
});
}

public async selectIndexPatternTimeField(timeField: string) {
await retry.try(async () => {
await comboBox.clearInputField('metricsIndexPatternFieldsSelect');
Expand Down
11 changes: 11 additions & 0 deletions test/functional/services/combo_box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ export function ComboBoxProvider({ getService, getPageObjects }: FtrProviderCont
return isMouseClick ? await element.clickMouseButton() : await element._webElement.click();
}

/**
* Finds combobox element options
*
* @param comboBoxSelector data-test-subj selector
*/
public async getOptions(comboBoxSelector: string) {
const comboBoxElement = await testSubjects.find(comboBoxSelector);
await this.openOptionsList(comboBoxElement);
return await find.allByCssSelector('.euiFilterSelectItem', WAIT_FOR_EXISTS_TIME);
}

/**
* Sets value for specified combobox element
*
Expand Down

0 comments on commit 36814aa

Please sign in to comment.