Skip to content

Commit

Permalink
[TSVB] Refactor the index pattern mode functional test (#105725)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
stratoula and kibanamachine authored Jul 19, 2021
1 parent df1882e commit 54717eb
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions test/functional/apps/visualize/_tsvb_chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const log = getService('log');
const inspector = getService('inspector');
const retry = getService('retry');
Expand Down Expand Up @@ -198,14 +197,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
});

// FLAKY: https://github.com/elastic/kibana/issues/103252
describe.skip('switch index patterns', () => {
before(async () => {
await esArchiver.loadIfNeeded(
'test/functional/fixtures/es_archiver/index_pattern_without_timefield'
);
});

describe('switch index pattern mode', () => {
beforeEach(async () => {
await PageObjects.visualBuilder.resetPage();
await PageObjects.visualBuilder.clickMetric();
Expand All @@ -215,41 +207,32 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.visualBuilder.setDropLastBucket(true);
await PageObjects.visualBuilder.clickDataTab('metric');
await PageObjects.timePicker.setAbsoluteRange(
'Sep 22, 2019 @ 00:00:00.000',
'Sep 23, 2019 @ 00:00:00.000'
'Sep 19, 2015 @ 06:31:44.000',
'Sep 22, 2015 @ 18:31:44.000'
);
});

after(async () => {
await security.testUser.restoreDefaults();
await esArchiver.load('test/functional/fixtures/es_archiver/empty_kibana');
await PageObjects.visualize.initTests();
});

const switchIndexTest = async (useKibanaIndexes: boolean) => {
await PageObjects.visualBuilder.clickPanelOptions('metric');
await PageObjects.visualBuilder.setIndexPatternValue('', false);

const value = await PageObjects.visualBuilder.getMetricValue();
expect(value).to.eql('0');

// Sometimes popovers take some time to appear in Firefox (#71979)
await retry.tryForTime(20000, async () => {
await PageObjects.visualBuilder.setIndexPatternValue('with-timefield', useKibanaIndexes);
await PageObjects.visualBuilder.setIndexPatternValue('logstash-*', useKibanaIndexes);
await PageObjects.visualBuilder.waitForIndexPatternTimeFieldOptionsLoaded();
await PageObjects.visualBuilder.selectIndexPatternTimeField('timestamp');
await PageObjects.visualBuilder.selectIndexPatternTimeField('@timestamp');
});
const newValue = await PageObjects.visualBuilder.getMetricValue();
expect(newValue).to.eql('1');
expect(newValue).to.eql('156');
};

it('should be able to switch using text mode selection', async () => {
await switchIndexTest(false);
});

it('should be able to switch combo box mode selection', async () => {
await switchIndexTest(true);
});

it('should be able to switch using text mode selection', async () => {
await switchIndexTest(false);
});
});

describe('browser history changes', () => {
Expand Down

0 comments on commit 54717eb

Please sign in to comment.