Skip to content

Commit

Permalink
[TSVB] Remove flakiness on resetPage (elastic#156484)
Browse files Browse the repository at this point in the history
## Summary

Closes elastic#156457
Closes elastic#156452
Closes elastic#156439
Closes elastic#156400
Closes elastic#156599
Closes elastic#156502
Closes elastic#156501

the resetPage function is creating this flakiness. I cant figure out why
but is on the navigateToUrl function. Sometimes it reports #create and
sometimes without the hash. The navigateToUrl is not needed as it is
already done on another function. The only thing that is needed is the
setTimePicker function.

Flaky runer (100 times)
https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/2210
  • Loading branch information
stratoula authored May 4, 2023
1 parent 396a2b6 commit e5f6f96
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
6 changes: 3 additions & 3 deletions test/functional/apps/visualize/group4/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await visualize.navigateToNewVisualization();
await visualize.clickVisualBuilder();
await visualBuilder.checkVisualBuilderIsPresent();
await visualBuilder.resetPage();
await visualBuilder.setTime();
});

describe('metric', () => {
Expand Down Expand Up @@ -430,7 +430,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {

describe('switch panel interval test', () => {
beforeEach(async () => {
await visualBuilder.resetPage();
await visualBuilder.setTime();
await visualBuilder.clickMetric();
await visualBuilder.checkMetricTabIsPresent();
await visualBuilder.clickPanelOptions('metric');
Expand Down Expand Up @@ -551,7 +551,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});

beforeEach(async () => {
await visualBuilder.resetPage();
await visualBuilder.setTime();
await visualBuilder.selectAggType('Average');
await visualBuilder.setFieldForAggregation('bytes');
await visualBuilder.setMetricsGroupByTerms('machine.os.raw');
Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/group5/_tsvb_time_series.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

describe('Time Series', () => {
beforeEach(async () => {
await visualBuilder.resetPage();
await visualBuilder.setTime();
await visualBuilder.clickPanelOptions('timeSeries');
await visualBuilder.setDropLastBucket(true);
await visualBuilder.clickDataTab('timeSeries');
Expand Down
9 changes: 7 additions & 2 deletions test/functional/apps/visualize/group6/_tsvb_markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
describe('markdown', () => {
before(async () => {
await visualize.initTests();
await visualBuilder.resetPage();
await visualize.navigateToNewVisualization();
await visualize.clickVisualBuilder();
await visualBuilder.checkVisualBuilderIsPresent();
await visualBuilder.clickMarkdown();
await timePicker.setAbsoluteRange(
'Sep 22, 2015 @ 06:00:00.000',
Expand Down Expand Up @@ -149,7 +151,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

describe('applying field formats from Advanced Settings for values', () => {
before(async () => {
await visualBuilder.resetPage();
await visualize.navigateToNewVisualization();
await visualize.clickVisualBuilder();
await visualBuilder.checkVisualBuilderIsPresent();
await visualBuilder.setTime();
await visualBuilder.clickMarkdown();
await visualBuilder.markdownSwitchSubTab('markdown');
await visualBuilder.enterMarkdown('{{ average_of_bytes.last.formatted }}');
Expand Down
5 changes: 4 additions & 1 deletion test/functional/apps/visualize/group6/_tsvb_table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});
describe('table', () => {
beforeEach(async () => {
await visualBuilder.resetPage('Sep 22, 2015 @ 06:00:00.000', 'Sep 22, 2015 @ 11:00:00.000');
await visualize.navigateToNewVisualization();
await visualize.clickVisualBuilder();
await visualBuilder.checkVisualBuilderIsPresent();
await visualBuilder.setTime('Sep 22, 2015 @ 06:00:00.000', 'Sep 22, 2015 @ 11:00:00.000');
await visualBuilder.clickTable();

await visualBuilder.checkTableTabIsPresent();
Expand Down
7 changes: 5 additions & 2 deletions test/functional/apps/visualize/group6/_tsvb_tsdb_basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const { visualBuilder } = getPageObjects(['visualBuilder']);
const { visualBuilder, visualize } = getPageObjects(['visualBuilder', 'visualize']);
const log = getService('log');
const kibanaServer = getService('kibanaServer');
const esArchiver = getService('esArchiver');
Expand Down Expand Up @@ -43,7 +43,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

beforeEach(async () => {
await visualBuilder.resetPage();
await visualize.navigateToNewVisualization();
await visualize.clickVisualBuilder();
await visualBuilder.checkVisualBuilderIsPresent();
await visualBuilder.setTime();
});

it('should render from a tsdb dataView regular fields with no issues', async () => {
Expand Down
9 changes: 8 additions & 1 deletion test/functional/page_objects/visual_builder_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,18 @@ export class VisualBuilderPageObject extends FtrService {
this.log.debug('Wait for initializing TSVB editor');
await this.checkVisualBuilderIsPresent();
this.log.debug('Set absolute time range from "' + fromTime + '" to "' + toTime + '"');
await this.timePicker.setAbsoluteRange(fromTime, toTime);
await this.setTime(fromTime, toTime);
// 2 sec sleep until https://github.com/elastic/kibana/issues/46353 is fixed
await this.common.sleep(2000);
}

public async setTime(
fromTime = 'Sep 19, 2015 @ 06:31:44.000',
toTime = 'Sep 22, 2015 @ 18:31:44.000'
) {
await this.timePicker.setAbsoluteRange(fromTime, toTime);
}

public async checkTabIsLoaded(testSubj: string, name: string) {
let isPresent = false;
await this.retry.try(async () => {
Expand Down

0 comments on commit e5f6f96

Please sign in to comment.