From 009a3895a1d27572486810a196f98d513e203b73 Mon Sep 17 00:00:00 2001 From: John Dorlus Date: Fri, 3 Jun 2022 12:27:32 -0400 Subject: [PATCH 1/2] Added the console CCS test. --- test/functional/apps/console/_console_ccs.ts | 47 ++++++++++++++++++++ test/functional/apps/console/index.js | 12 +++-- test/functional/config.ccs.ts | 6 ++- 3 files changed, 60 insertions(+), 5 deletions(-) create mode 100644 test/functional/apps/console/_console_ccs.ts diff --git a/test/functional/apps/console/_console_ccs.ts b/test/functional/apps/console/_console_ccs.ts new file mode 100644 index 0000000000000..bc296af462bd1 --- /dev/null +++ b/test/functional/apps/console/_console_ccs.ts @@ -0,0 +1,47 @@ +/* + * 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 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 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 retry = getService('retry'); + const log = getService('log'); + const PageObjects = getPageObjects(['common', 'console']); + const remoteEsArchiver = getService('remoteEsArchiver' as 'esArchiver'); + + describe('Console App CCS', function describeIndexTests() { + this.tags('includeFirefox'); + before(async () => { + remoteEsArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); + log.debug('navigateTo console'); + await PageObjects.common.navigateToApp('console'); + await retry.try(async () => { + await PageObjects.console.collapseHelp(); + }); + }); + + after(async () => { + remoteEsArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); + }); + + describe('with kbn: prefix in request', () => { + before(async () => { + await PageObjects.console.clearTextArea(); + }); + it('it should send successful request to Kibana API', async () => { + await PageObjects.console.enterRequest('\nGET ftr-remote:logstash-*/_search'); + await PageObjects.console.clickPlay(); + await retry.try(async () => { + const actualResponse = await PageObjects.console.getResponse(); + expect(actualResponse).to.contain('"extension": "jpg",'); + }); + }); + }); + }); +} diff --git a/test/functional/apps/console/index.js b/test/functional/apps/console/index.js index 1944e10b5239f..4f0c362268b6f 100644 --- a/test/functional/apps/console/index.js +++ b/test/functional/apps/console/index.js @@ -8,14 +8,18 @@ export default function ({ getService, loadTestFile }) { const browser = getService('browser'); + const config = getService('config'); describe('console app', function () { before(async function () { await browser.setWindowSize(1300, 1100); }); - - loadTestFile(require.resolve('./_console')); - loadTestFile(require.resolve('./_autocomplete')); - loadTestFile(require.resolve('./_vector_tile')); + if (config.get('esTestCluster.ccs')) { + loadTestFile(require.resolve('./_console_ccs')); + } else { + loadTestFile(require.resolve('./_console')); + loadTestFile(require.resolve('./_autocomplete')); + loadTestFile(require.resolve('./_vector_tile')); + } }); } diff --git a/test/functional/config.ccs.ts b/test/functional/config.ccs.ts index 81a1438013c55..dfa61f654e092 100644 --- a/test/functional/config.ccs.ts +++ b/test/functional/config.ccs.ts @@ -17,7 +17,11 @@ export default async function ({ readConfigFile }: FtrConfigProviderContext) { return { ...baseConfig.getAll(), - testFiles: [require.resolve('./apps/dashboard/group3'), require.resolve('./apps/discover')], + testFiles: [ + require.resolve('./apps/dashboard/group3'), + require.resolve('./apps/discover'), + require.resolve('./apps/console/_console_ccs'), + ], services: { ...baseConfig.get('services'), From 5650f41871713a7c13736a6f0906af7e4c8c9592 Mon Sep 17 00:00:00 2001 From: John Dorlus Date: Fri, 3 Jun 2022 13:49:25 -0400 Subject: [PATCH 2/2] Forgot some awaits. --- test/functional/apps/console/_console_ccs.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/functional/apps/console/_console_ccs.ts b/test/functional/apps/console/_console_ccs.ts index bc296af462bd1..3ab81e076158b 100644 --- a/test/functional/apps/console/_console_ccs.ts +++ b/test/functional/apps/console/_console_ccs.ts @@ -18,7 +18,9 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { describe('Console App CCS', function describeIndexTests() { this.tags('includeFirefox'); before(async () => { - remoteEsArchiver.loadIfNeeded('test/functional/fixtures/es_archiver/logstash_functional'); + await remoteEsArchiver.loadIfNeeded( + 'test/functional/fixtures/es_archiver/logstash_functional' + ); log.debug('navigateTo console'); await PageObjects.common.navigateToApp('console'); await retry.try(async () => { @@ -27,14 +29,14 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) { }); after(async () => { - remoteEsArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); + await remoteEsArchiver.unload('test/functional/fixtures/es_archiver/logstash_functional'); }); - describe('with kbn: prefix in request', () => { + describe('Perform CCS Search in Console', () => { before(async () => { await PageObjects.console.clearTextArea(); }); - it('it should send successful request to Kibana API', async () => { + it('it should be able to access remote data', async () => { await PageObjects.console.enterRequest('\nGET ftr-remote:logstash-*/_search'); await PageObjects.console.clickPlay(); await retry.try(async () => {