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

[TSVB] Refactor the index pattern mode functional test #105725

Merged
merged 2 commits into from
Jul 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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