diff --git a/test/functional/apps/visualize/_tsvb_chart.ts b/test/functional/apps/visualize/_tsvb_chart.ts index 3505ec3b1daf41..fdb6a5aa7cb033 100644 --- a/test/functional/apps/visualize/_tsvb_chart.ts +++ b/test/functional/apps/visualize/_tsvb_chart.ts @@ -27,8 +27,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { const inspector = getService('inspector'); const PageObjects = getPageObjects(['visualize', 'visualBuilder', 'timePicker']); - // FLAKY: https://github.com/elastic/kibana/issues/45315 - describe.skip('visual builder', function describeIndexTests() { + describe('visual builder', function describeIndexTests() { this.tags('smoke'); beforeEach(async () => { await PageObjects.visualize.navigateToNewVisualization(); @@ -52,7 +51,8 @@ export default function({ getService, getPageObjects }: FtrProviderContext) { expect(value).to.eql('156'); }); - it('should show correct data with Math Aggregation', async () => { + // FLAKY: https://github.com/elastic/kibana/issues/45315 + it.skip('should show correct data with Math Aggregation', async () => { await PageObjects.visualBuilder.createNewAgg(); await PageObjects.visualBuilder.selectAggType('math', 1); await PageObjects.visualBuilder.fillInVariable(); diff --git a/test/functional/apps/visualize/_tsvb_markdown.ts b/test/functional/apps/visualize/_tsvb_markdown.ts index b433236492dc5e..f7b8415583a396 100644 --- a/test/functional/apps/visualize/_tsvb_markdown.ts +++ b/test/functional/apps/visualize/_tsvb_markdown.ts @@ -21,8 +21,9 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../ftr_provider_context'; // eslint-disable-next-line import/no-default-export -export default function({ getPageObjects }: FtrProviderContext) { +export default function({ getPageObjects, getService }: FtrProviderContext) { const { visualBuilder, timePicker } = getPageObjects(['visualBuilder', 'timePicker']); + const retry = getService('retry'); async function cleanupMarkdownData(variableName: 'variable' | 'label', checkedValue: string) { await visualBuilder.markdownSwitchSubTab('data'); @@ -37,9 +38,7 @@ export default function({ getPageObjects }: FtrProviderContext) { }); } - // FLAKY: https://github.com/elastic/kibana/issues/45323 - // FLAKY: https://github.com/elastic/kibana/issues/45330 - describe.skip('visual builder', function describeIndexTests() { + describe('visual builder', function describeIndexTests() { describe('markdown', () => { before(async () => { await visualBuilder.resetPage(); @@ -115,21 +114,24 @@ export default function({ getPageObjects }: FtrProviderContext) { await cleanupMarkdownData(VARIABLE, VARIABLE); }); - it('series length should be 2 after cloning', async () => { + it('series count should be 2 after cloning', async () => { await visualBuilder.markdownSwitchSubTab('data'); await visualBuilder.cloneSeries(); - const seriesLength = (await visualBuilder.getSeries()).length; - expect(seriesLength).to.be.equal(2); + retry.try(async function seriesCountCheck() { + const seriesLength = (await visualBuilder.getSeries()).length; + expect(seriesLength).to.be.equal(2); + }); }); - it('aggregation length should be 2 after cloning', async () => { + it('aggregation count should be 2 after cloning', async () => { await visualBuilder.markdownSwitchSubTab('data'); - await visualBuilder.createNewAgg(); - const aggregationLength = await visualBuilder.getAggregationCount(); - expect(aggregationLength).to.be.equal(2); + retry.try(async function aggregationCountCheck() { + const aggregationLength = await visualBuilder.getAggregationCount(); + expect(aggregationLength).to.be.equal(2); + }); }); }); }); diff --git a/test/functional/page_objects/visual_builder_page.ts b/test/functional/page_objects/visual_builder_page.ts index 5f34e5c4f86377..ee85c8259ec35c 100644 --- a/test/functional/page_objects/visual_builder_page.ts +++ b/test/functional/page_objects/visual_builder_page.ts @@ -23,7 +23,7 @@ import { WebElementWrapper } from '../services/lib/web_element_wrapper'; export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrProviderContext) { const find = getService('find'); const log = getService('log'); - const browser = getService('browser'); + const retry = getService('retry'); const testSubjects = getService('testSubjects'); const comboBox = getService('comboBox'); const PageObjects = getPageObjects(['common', 'header', 'visualize', 'timePicker']); @@ -49,14 +49,10 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro await PageObjects.common.navigateToUrl('visualize', 'create?type=metrics'); log.debug('Set absolute time range from "' + fromTime + '" to "' + toTime + '"'); await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); - if (browser.isFirefox) { - // https://github.com/elastic/kibana/issues/24058 - await PageObjects.common.sleep(2000); - } } public async checkTabIsLoaded(testSubj: string, name: string) { - const isPresent = await testSubjects.exists(testSubj, { timeout: 5000 }); + const isPresent = await testSubjects.exists(testSubj, { timeout: 10000 }); if (!isPresent) { throw new Error(`TSVB ${name} tab is not loaded`); } @@ -194,8 +190,11 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro * @memberof VisualBuilderPage */ public async markdownSwitchSubTab(subTab: 'data' | 'options' | 'markdown') { - const element = await testSubjects.find(`${subTab}-subtab`); - await element.click(); + const tab = await testSubjects.find(`${subTab}-subtab`); + const isSelected = await tab.getAttribute('aria-selected'); + if (isSelected !== 'true') { + await tab.click(); + } } /** @@ -336,13 +335,14 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro } public async createNewAgg(nth = 0) { + const prevAggs = await testSubjects.findAll('aggSelector'); const elements = await testSubjects.findAll('addMetricAddBtn'); await elements[nth].click(); - await PageObjects.header.waitUntilLoadingHasFinished(); - const aggs = await testSubjects.findAll('aggSelector'); - if (aggs.length < 2) { - throw new Error('there should be atleast 2 aggSelectors'); - } + await PageObjects.visualize.waitForVisualizationRenderingStabilized(); + await retry.waitFor('new agg is added', async () => { + const currentAggs = await testSubjects.findAll('aggSelector'); + return currentAggs.length > prevAggs.length; + }); } public async selectAggType(value: string, nth = 0) { @@ -481,10 +481,9 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro } public async cloneSeries(nth: number = 0): Promise { - const prevRenderingCount = await PageObjects.visualize.getVisualizationRenderingCount(); const cloneBtnArray = await testSubjects.findAll('AddCloneBtn'); await cloneBtnArray[nth].click(); - await PageObjects.visualize.waitForRenderingCount(prevRenderingCount + 1); + await PageObjects.visualize.waitForVisualizationRenderingStabilized(); } /**