Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/tsvb functional tests #45868

Merged
merged 12 commits into from
Sep 18, 2019
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 @@ -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();
Expand All @@ -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();
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);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue was fixed so I decided to remove it

}

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

/**
Expand Down Expand Up @@ -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 > prevAggs;
dmlemeshko marked this conversation as resolved.
Show resolved Hide resolved
});
}

public async selectAggType(value: string, nth = 0) {
Expand Down Expand Up @@ -481,10 +481,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