-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Search Sessions] Search session example app functional test (#92133)
- Loading branch information
Showing
24 changed files
with
196 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; | ||
import { resolve } from 'path'; | ||
import fs from 'fs'; | ||
import { KIBANA_ROOT } from '@kbn/test'; | ||
|
||
export default async function ({ readConfigFile }: FtrConfigProviderContext) { | ||
const xpackFunctionalConfig = await readConfigFile(require.resolve('../functional/config')); | ||
|
||
// Find all folders in /examples and /x-pack/examples since we treat all them as plugin folder | ||
const examplesFiles = fs.readdirSync(resolve(KIBANA_ROOT, 'examples')); | ||
const examples = examplesFiles.filter((file) => | ||
fs.statSync(resolve(KIBANA_ROOT, 'examples', file)).isDirectory() | ||
); | ||
|
||
const xpackExamplesFiles = fs.readdirSync(resolve(KIBANA_ROOT, 'x-pack/examples')); | ||
const xpackExamples = xpackExamplesFiles.filter((file) => | ||
fs.statSync(resolve(KIBANA_ROOT, 'x-pack/examples', file)).isDirectory() | ||
); | ||
|
||
return { | ||
// default to the xpack functional config | ||
...xpackFunctionalConfig.getAll(), | ||
|
||
junit: { | ||
reportName: 'X-Pack Example plugin functional tests', | ||
}, | ||
|
||
testFiles: [require.resolve('./search_examples')], | ||
|
||
kbnTestServer: { | ||
...xpackFunctionalConfig.get('kbnTestServer'), | ||
|
||
serverArgs: [ | ||
...xpackFunctionalConfig.get('kbnTestServer.serverArgs'), | ||
// Required to load new platform plugins via `--plugin-path` flag. | ||
'--env.name=development', | ||
...examples.map( | ||
(exampleDir) => `--plugin-path=${resolve(KIBANA_ROOT, 'examples', exampleDir)}` | ||
), | ||
...xpackExamples.map( | ||
(exampleDir) => `--plugin-path=${resolve(KIBANA_ROOT, 'x-pack/examples', exampleDir)}` | ||
), | ||
], | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* 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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { PluginFunctionalProviderContext } from 'test/plugin_functional/services'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default function ({ getService, loadTestFile }: PluginFunctionalProviderContext) { | ||
const esArchiver = getService('esArchiver'); | ||
|
||
describe('search examples', function () { | ||
this.tags('ciGroup13'); | ||
before(async () => { | ||
await esArchiver.emptyKibanaIndex(); | ||
await esArchiver.loadIfNeeded('logstash_functional'); | ||
await esArchiver.loadIfNeeded('lens/basic'); // need at least one index pattern | ||
}); | ||
|
||
after(async () => { | ||
await esArchiver.unload('lens/basic'); | ||
}); | ||
|
||
loadTestFile(require.resolve('./search_session_example')); | ||
}); | ||
} |
47 changes: 47 additions & 0 deletions
47
x-pack/test/examples/search_examples/search_session_example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../functional/ftr_provider_context'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default function ({ getService, getPageObjects }: FtrProviderContext) { | ||
const testSubjects = getService('testSubjects'); | ||
const PageObjects = getPageObjects(['common']); | ||
const log = getService('log'); | ||
const es = getService('es'); | ||
const searchSessions = getService('searchSessions'); | ||
|
||
describe('Search session example', () => { | ||
const appId = 'searchExamples'; | ||
|
||
before(async function () { | ||
const { body } = await es.info(); | ||
if (!body.version.number.includes('SNAPSHOT')) { | ||
log.debug('Skipping because this build does not have the required shard_delay agg'); | ||
this.skip(); | ||
return; | ||
} | ||
|
||
await PageObjects.common.navigateToApp(appId, { insertTimestamp: false }); | ||
await testSubjects.click('/search-sessions'); | ||
}); | ||
|
||
after(async () => { | ||
await searchSessions.deleteAllSearchSessions(); | ||
}); | ||
|
||
it('should start search, save session, restore session using "restore" button', async () => { | ||
await testSubjects.clickWhenNotDisabled('startSearch'); | ||
await testSubjects.find('searchResults-1'); | ||
await searchSessions.expectState('completed'); | ||
await searchSessions.save(); | ||
await searchSessions.expectState('backgroundCompleted'); | ||
await testSubjects.click('restoreSearch'); | ||
await testSubjects.find('searchResults-2'); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.