Change implementation on TSVB functional when testing the indexPattern switch (#78754)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Stratoula Kalafateli 2020-10-01 13:30:10 +03:00 committed by GitHub
parent 8f89ef571c
commit 36814aa1ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View file

@ -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();

View file

@ -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');

View file

@ -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
*