-
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.
Add functional tests for plugins to x-pack
- Loading branch information
oatkiller
committed
Dec 5, 2019
1 parent
b592417
commit 285b1d6
Showing
7 changed files
with
125 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { resolve } from 'path'; | ||
import fs from 'fs'; | ||
import { FtrConfigProviderContext } from '@kbn/test/types/ftr'; | ||
import { services } from './services'; | ||
import { pageObjects } from './page_objects'; | ||
|
||
// the default export of config files must be a config provider | ||
// that returns an object with the projects config values | ||
|
||
/* eslint-disable import/no-default-export */ | ||
export default async function({ readConfigFile }: FtrConfigProviderContext) { | ||
const xpackFunctionalConfig = await readConfigFile(require.resolve('../functional/config.js')); | ||
|
||
// Find all folders in ./plugins since we treat all them as plugin folder | ||
const allFiles = fs.readdirSync(resolve(__dirname, 'plugins')); | ||
const plugins = allFiles.filter(file => | ||
fs.statSync(resolve(__dirname, 'plugins', file)).isDirectory() | ||
); | ||
|
||
return { | ||
// list paths to the files that contain your plugins tests | ||
testFiles: [resolve(__dirname, './test_suites/resolver')], | ||
|
||
services, | ||
pageObjects, | ||
|
||
servers: xpackFunctionalConfig.get('servers'), | ||
|
||
esTestCluster: xpackFunctionalConfig.get('esTestCluster'), | ||
|
||
kbnTestServer: { | ||
...xpackFunctionalConfig.get('kbnTestServer'), | ||
serverArgs: [ | ||
...xpackFunctionalConfig.get('kbnTestServer.serverArgs'), | ||
...plugins.map(pluginDir => `--plugin-path=${resolve(__dirname, 'plugins', pluginDir)}`), | ||
// Required to load new platform plugins via `--plugin-path` flag. | ||
'--env.name=development', | ||
'--xpack.endpoint.enabled=true', | ||
], | ||
}, | ||
uiSettings: xpackFunctionalConfig.get('uiSettings'), | ||
// the apps section defines the urls that | ||
// `PageObjects.common.navigateTo(appKey)` will use. | ||
// Merge urls for your plugin with the urls defined in | ||
// Kibana's config in order to use this helper | ||
apps: { | ||
...xpackFunctionalConfig.get('apps'), | ||
resolverTest: { | ||
pathname: '/app/resolver_test', | ||
}, | ||
}, | ||
|
||
// choose where esArchiver should load archives from | ||
esArchiver: { | ||
directory: resolve(__dirname, 'es_archives'), | ||
}, | ||
|
||
// choose where screenshots should be saved | ||
screenshots: { | ||
directory: resolve(__dirname, 'screenshots'), | ||
}, | ||
|
||
junit: { | ||
reportName: 'Chrome X-Pack UI Plugin Functional Tests', | ||
}, | ||
}; | ||
} |
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,11 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { GenericFtrProviderContext } from '@kbn/test/types/ftr'; | ||
import { services } from './services'; | ||
import { pageObjects } from './page_objects'; | ||
|
||
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>; |
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,6 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
export { pageObjects } from '../functional/page_objects'; |
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,7 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export { services } from '../functional/services'; |
27 changes: 27 additions & 0 deletions
27
x-pack/test/plugin_functional/test_suites/resolver/index.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,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { FtrProviderContext } from '../../ftr_provider_context'; | ||
|
||
export default function({ getPageObjects, getService }: FtrProviderContext) { | ||
const pageObjects = getPageObjects(['common']); | ||
const testSubjects = getService('testSubjects'); | ||
|
||
describe('Resolver embeddable test app', function() { | ||
this.tags('ciGroup7'); | ||
|
||
beforeEach(async function() { | ||
await pageObjects.common.navigateToApp('resolverTest'); | ||
}); | ||
|
||
it('renders a container div for the embeddable', async function() { | ||
await testSubjects.existOrFail('resolverEmbeddableContainer'); | ||
}); | ||
it('renders resolver', async function() { | ||
await testSubjects.existOrFail('resolverEmbeddable'); | ||
}); | ||
}); | ||
} |