Fix visualize point series tests (#46069)

* change interaction with 'select' element

* run ciGroup5 15x times

* Revert "run ciGroup5 15x times"

This reverts commit 9c19d9a135.
This commit is contained in:
Dmitry Lemeshko 2019-09-19 17:40:09 +02:00 committed by GitHub
parent d3fa0a48c0
commit 8cd22b7d54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 19 deletions

View file

@ -106,8 +106,7 @@ export default function ({ getService, getPageObjects }) {
});
describe('multiple chart types', function () {
// FLAKY: https://github.com/elastic/kibana/issues/45970
it.skip('should change average series type to histogram', async function () {
it('should change average series type to histogram', async function () {
await pointSeriesVis.setSeriesType(1, 'histogram');
await PageObjects.visualize.clickGo();
const length = await pointSeriesVis.getHistogramSeries();

View file

@ -24,11 +24,11 @@ export function PointSeriesPageProvider({ getService }) {
class PointSeriesVis {
async clickOptions() {
return await find.clickByPartialLinkText('Panel settings');
return await testSubjects.click('visEditorTaboptions');
}
async clickAxisOptions() {
return await find.clickByPartialLinkText('Metrics & axes');
return await testSubjects.click('visEditorTabadvanced');
}
async clickAddAxis() {
@ -50,17 +50,16 @@ export function PointSeriesPageProvider({ getService }) {
}
async getGridLines() {
const gridLines = await find.allByCssSelector('g.grid > path');
return await Promise.all(gridLines.map(async (gridLine) => {
const dAttribute = await gridLine.getAttribute('d');
const grid = await find.byCssSelector('g.grid');
const $ = await grid.parseDomContent();
return $('path').toArray().map(line => {
const dAttribute = $(line).attr('d');
const firstPoint = dAttribute.split('L')[0].replace('M', '').split(',');
return {
x: parseFloat(firstPoint[0]),
y: parseFloat(firstPoint[1]),
};
}));
});
}
async toggleGridCategoryLines() {
@ -69,15 +68,15 @@ export function PointSeriesPageProvider({ getService }) {
async setGridValueAxis(axis) {
log.debug(`setGridValueAxis(${axis})`);
return await find.clickByCssSelector(`select#gridAxis option[value="${axis}"]`);
await find.selectValue('select#gridAxis', axis);
}
async setSeriesAxis(series, axis) {
await find.clickByCssSelector(`select#seriesValueAxis${series} option[value="${axis}"]`);
await find.selectValue(`select#seriesValueAxis${series}`, axis);
}
async setSeriesType(series, type) {
await find.clickByCssSelector(`select#seriesType${series} option[value="${type}"]`);
await find.selectValue(`select#seriesType${series}`, type);
}
}

View file

@ -546,9 +546,7 @@ export function VisualizePageProvider({ getService, getPageObjects, updateBaseli
}
async selectAggregateWith(fieldValue) {
const sortSelect = await testSubjects.find(`visDefaultEditorAggregateWith`);
const sortMetric = await sortSelect.findByCssSelector(`option[value="${fieldValue}"]`);
await sortMetric.click();
await testSubjects.selectValue('visDefaultEditorAggregateWith', fieldValue);
}
async getInterval() {

View file

@ -114,6 +114,14 @@ export async function FindProvider({ getService }: FtrProviderContext) {
});
}
public async selectValue(selector: string, value: string): Promise<void> {
log.debug(`Find.selectValue('${selector}', option[value="${value}"]')`);
const combobox = await this.byCssSelector(selector);
const $ = await combobox.parseDomContent();
const text = $(`option[value="${value}"]`).text();
await combobox.type(text);
}
public async filterElementIsDisplayed(elements: WebElementWrapper[]) {
if (elements.length === 0) {
return [];

View file

@ -164,6 +164,10 @@ export function TestSubjectsProvider({ getService }: FtrProviderContext) {
});
}
public async selectValue(selector: string, value: string): Promise<void> {
await find.selectValue(`[data-test-subj="${selector}"]`, value);
}
public async isEnabled(selector: string): Promise<boolean> {
return await retry.try(async () => {
log.debug(`TestSubjects.isEnabled(${selector})`);

View file

@ -406,9 +406,7 @@ export function GisPageProvider({ getService, getPageObjects }) {
async setIndexType(indexType) {
log.debug(`Set index type to: ${indexType}`);
await find.clickByCssSelector(
`select[data-test-subj="fileImportIndexSelect"] > option[value="${indexType}"]`
);
await testSubjects.selectValue('fileImportIndexSelect', indexType);
}
async indexTypeOptionExists(indexType) {