diff --git a/test/functional/apps/visualize/_point_series_options.js b/test/functional/apps/visualize/_point_series_options.js index 69c874d618cf4..d175acbd6c02e 100644 --- a/test/functional/apps/visualize/_point_series_options.js +++ b/test/functional/apps/visualize/_point_series_options.js @@ -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(); diff --git a/test/functional/page_objects/point_series_page.js b/test/functional/page_objects/point_series_page.js index f45fa5f5bf334..45626d03a5f00 100644 --- a/test/functional/page_objects/point_series_page.js +++ b/test/functional/page_objects/point_series_page.js @@ -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); } } diff --git a/test/functional/page_objects/visualize_page.js b/test/functional/page_objects/visualize_page.js index d4b5c820a0d5b..994a4d4a989c3 100644 --- a/test/functional/page_objects/visualize_page.js +++ b/test/functional/page_objects/visualize_page.js @@ -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() { diff --git a/test/functional/services/find.ts b/test/functional/services/find.ts index 29713304cd5cb..9723e3b745502 100644 --- a/test/functional/services/find.ts +++ b/test/functional/services/find.ts @@ -114,6 +114,14 @@ export async function FindProvider({ getService }: FtrProviderContext) { }); } + public async selectValue(selector: string, value: string): Promise { + 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 []; diff --git a/test/functional/services/test_subjects.ts b/test/functional/services/test_subjects.ts index aaad4f7c238ff..c5e360d093957 100644 --- a/test/functional/services/test_subjects.ts +++ b/test/functional/services/test_subjects.ts @@ -164,6 +164,10 @@ export function TestSubjectsProvider({ getService }: FtrProviderContext) { }); } + public async selectValue(selector: string, value: string): Promise { + await find.selectValue(`[data-test-subj="${selector}"]`, value); + } + public async isEnabled(selector: string): Promise { return await retry.try(async () => { log.debug(`TestSubjects.isEnabled(${selector})`); diff --git a/x-pack/test/functional/page_objects/gis_page.js b/x-pack/test/functional/page_objects/gis_page.js index 49860fd9a313b..2da9b1d8e874c 100644 --- a/x-pack/test/functional/page_objects/gis_page.js +++ b/x-pack/test/functional/page_objects/gis_page.js @@ -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) {