Skip to content

Commit

Permalink
Fix/tsvb functional tests (#45868) (#46073)
Browse files Browse the repository at this point in the history
* [page_objects/visual_builder_page] increase timeout & remove FF sleep

* unskip flaky test suites

* run ciGroup6 12x times

* fix tsvb_markdown tests

* skip aggs test

* fix waiting

* run FF tests 8x times

* Revert "run FF tests 8x times"

This reverts commit 75ef2ce.

* Revert "run ciGroup6 12x times"

This reverts commit 217dbb8.

* Update test/functional/page_objects/visual_builder_page.ts

review fix

Co-Authored-By: Spencer <[email protected]>
  • Loading branch information
dmlemeshko and Spencer authored Sep 18, 2019
1 parent 3381747 commit 4f3a949
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
6 changes: 3 additions & 3 deletions test/functional/apps/visualize/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
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();
Expand All @@ -54,7 +53,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();
Expand Down
24 changes: 13 additions & 11 deletions test/functional/apps/visualize/_tsvb_markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();
Expand Down Expand Up @@ -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);
});
});
});
});
Expand Down
29 changes: 14 additions & 15 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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`);
}
Expand Down Expand Up @@ -191,8 +187,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();
}
}

/**
Expand Down Expand Up @@ -331,13 +330,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) {
Expand Down Expand Up @@ -467,10 +467,9 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
}

public async cloneSeries(nth: number = 0): Promise<void> {
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();
}

/**
Expand Down

0 comments on commit 4f3a949

Please sign in to comment.