Skip to content

Commit

Permalink
Fix flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
VladLasitsa committed Oct 25, 2022
1 parent d6533d6 commit 00a7b8d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -662,13 +662,23 @@ export class VisualBuilderPageObject extends FtrService {
public async setFieldForAggregateBy(field: string): Promise<void> {
const aggregateBy = await this.testSubjects.find('aggregateBy');

await this.comboBox.setElement(aggregateBy, field);
await this.retry.try(async () => {
await this.comboBox.setElement(aggregateBy, field);
if (!(await this.comboBox.isOptionSelected(aggregateBy, field))) {
throw new Error('aggregate by field is not selected');
}
});
}

public async setFunctionForAggregateFunction(func: string): Promise<void> {
const aggregateFunction = await this.testSubjects.find('aggregateFunction');

await this.comboBox.setElement(aggregateFunction, func);
await this.retry.try(async () => {
await this.comboBox.setElement(aggregateFunction, func);
if (!(await this.comboBox.isOptionSelected(aggregateFunction, func))) {
throw new Error('aggregate function is not selected');
}
});
}

public async checkFieldForAggregationValidity(aggNth: number = 0): Promise<boolean> {
Expand Down
6 changes: 3 additions & 3 deletions x-pack/test/functional/apps/lens/open_in_lens/tsvb/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await visualBuilder.setStaticValue(10);
await visualBuilder.clickSeriesOption();
await visualBuilder.setFieldForAggregateBy('bytes');
await visualBuilder.setFunctionForAggregateFunction('sum');
await visualBuilder.setFunctionForAggregateFunction('Sum');
await visualBuilder.clickSeriesOption(1);
await visualBuilder.setFieldForAggregateBy('bytes');
await visualBuilder.setFunctionForAggregateFunction('min');
await visualBuilder.setFunctionForAggregateFunction('Min');
await header.waitUntilLoadingHasFinished();
expect(await visualize.hasNavigateToLensButton()).to.be(false);
});
Expand Down Expand Up @@ -143,7 +143,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
it('should convert aggregate by to split row dimension', async () => {
await visualBuilder.clickSeriesOption();
await visualBuilder.setFieldForAggregateBy('clientip');
await visualBuilder.setFunctionForAggregateFunction('sum');
await visualBuilder.setFunctionForAggregateFunction('Sum');
await header.waitUntilLoadingHasFinished();

await visualize.navigateToLensFromAnotherVisulization();
Expand Down

0 comments on commit 00a7b8d

Please sign in to comment.