Skip to content

Commit

Permalink
Functional tests for ESQL + Dashboard/No-Data
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Oct 3, 2024
1 parent f6ab5d4 commit 9edb0cd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/functional/apps/dashboard/group6/dashboard_esql_no_data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');
const testSubjects = getService('testSubjects');
const { dashboard } = getPageObjects(['dashboard']);

describe('dashboard from esql button on no-data-prompt', () => {
before(async () => {
await kibanaServer.savedObjects.cleanStandardList();
});

it('enables user to create a dashboard with ES|QL from no-data-prompt', async () => {
await dashboard.navigateToApp();

await testSubjects.existOrFail('noDataViewsPrompt');
await testSubjects.click('tryESQLLink');

// ensure we have landed on Discover
await testSubjects.existOrFail('switch-to-dataviews'); // "Switch to Classic" app menu button
await testSubjects.existOrFail('discoverNewButton');
await testSubjects.existOrFail('discoverOpenButton');

const codeEditor = await testSubjects.find('kibanaCodeEditor');
expect(await codeEditor.getAttribute('innerText')).to.contain('FROM logs* | LIMIT 10');
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/dashboard/group6/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./dashboard_snapshots'));
loadTestFile(require.resolve('./embeddable_library'));
loadTestFile(require.resolve('./dashboard_esql_chart'));
loadTestFile(require.resolve('./dashboard_esql_no_data'));
});
}
32 changes: 32 additions & 0 deletions test/functional/apps/management/data_views/_try_esql.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/

import expect from '@kbn/expect';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['settings', 'common']);
const testSubjects = getService('testSubjects');

describe('No Data Views: Try ES|QL', () => {
it('navigates to Discover and presents an ES|QL query', async () => {
await PageObjects.settings.navigateTo();
await PageObjects.settings.clickKibanaIndexPatterns();
await testSubjects.click('tryESQLLink');

// ensure we have landed on Discover
await testSubjects.existOrFail('switch-to-dataviews'); // "Switch to Classic" app menu button
await testSubjects.existOrFail('discoverNewButton');
await testSubjects.existOrFail('discoverOpenButton');

const codeEditor = await testSubjects.find('kibanaCodeEditor');
expect(await codeEditor.getAttribute('innerText')).to.contain('FROM logs* | LIMIT 10');
});
});
}
1 change: 1 addition & 0 deletions test/functional/apps/management/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default function ({ getService, loadTestFile }: FtrProviderContext) {
loadTestFile(require.resolve('./data_views/_legacy_url_redirect'));
loadTestFile(require.resolve('./data_views/_exclude_index_pattern'));
loadTestFile(require.resolve('./data_views/_index_pattern_filter'));
loadTestFile(require.resolve('./data_views/_try_esql'));
loadTestFile(require.resolve('./data_views/_scripted_fields_filter'));
loadTestFile(require.resolve('./_import_objects'));
loadTestFile(require.resolve('./data_views/_test_huge_fields'));
Expand Down

0 comments on commit 9edb0cd

Please sign in to comment.