mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
# Backport This will backport the following commits from `main` to `9.0`: - [SKA: Relocate "platform" packages that remain on `/packages` (#208704)](https://github.com/elastic/kibana/pull/208704) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Gerard Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-02-24T11:03:30Z","message":"SKA: Relocate \"platform\" packages that remain on `/packages` (#208704)\n\n## Summary\n\nThe `/packages` folder at the root of the Kibana repository used to\ncontain a lot of packages.\nIn the context of SKA, they have been gradually moved to various\nlocations:\n* `src/platform/packages`\n* `x-pack/platform/packages`\n* `src/core/packages`\n\nCurrently, only `devOnly: true` packages are left in this folder. This\ncomprises libraries for CLI scripts as well as testing utilities.\n\nWith this PR, we are moving ~half of these packages under\n`src/platform/packages/(private|shared)/`.\nIn particular, we are moving those packages that are being used from\nplatform and/or solutions.\n\nSince they are `\"devOnly\": true`, this means they are ONLY used from\ntests, cypress tests, storybook configs, ./scripts/ folders inside some\nmodules, or other non-prod-time logic. Nonetheless, they are effectively\nreferenced from platform and/or solutions code, hence I decided they\nshould be placed under `platform` folders.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"6a7c904f921434fe21dfa00eceabfb5e64e915dc","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","ci:project-deploy-observability","Team:obs-ux-infra_services","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"SKA: Relocate \"platform\" packages that remain on `/packages`","number":208704,"url":"https://github.com/elastic/kibana/pull/208704","mergeCommit":{"message":"SKA: Relocate \"platform\" packages that remain on `/packages` (#208704)\n\n## Summary\n\nThe `/packages` folder at the root of the Kibana repository used to\ncontain a lot of packages.\nIn the context of SKA, they have been gradually moved to various\nlocations:\n* `src/platform/packages`\n* `x-pack/platform/packages`\n* `src/core/packages`\n\nCurrently, only `devOnly: true` packages are left in this folder. This\ncomprises libraries for CLI scripts as well as testing utilities.\n\nWith this PR, we are moving ~half of these packages under\n`src/platform/packages/(private|shared)/`.\nIn particular, we are moving those packages that are being used from\nplatform and/or solutions.\n\nSince they are `\"devOnly\": true`, this means they are ONLY used from\ntests, cypress tests, storybook configs, ./scripts/ folders inside some\nmodules, or other non-prod-time logic. Nonetheless, they are effectively\nreferenced from platform and/or solutions code, hence I decided they\nshould be placed under `platform` folders.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"6a7c904f921434fe21dfa00eceabfb5e64e915dc"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208704","number":208704,"mergeCommit":{"message":"SKA: Relocate \"platform\" packages that remain on `/packages` (#208704)\n\n## Summary\n\nThe `/packages` folder at the root of the Kibana repository used to\ncontain a lot of packages.\nIn the context of SKA, they have been gradually moved to various\nlocations:\n* `src/platform/packages`\n* `x-pack/platform/packages`\n* `src/core/packages`\n\nCurrently, only `devOnly: true` packages are left in this folder. This\ncomprises libraries for CLI scripts as well as testing utilities.\n\nWith this PR, we are moving ~half of these packages under\n`src/platform/packages/(private|shared)/`.\nIn particular, we are moving those packages that are being used from\nplatform and/or solutions.\n\nSince they are `\"devOnly\": true`, this means they are ONLY used from\ntests, cypress tests, storybook configs, ./scripts/ folders inside some\nmodules, or other non-prod-time logic. Nonetheless, they are effectively\nreferenced from platform and/or solutions code, hence I decided they\nshould be placed under `platform` folders.\n\n---------\n\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"6a7c904f921434fe21dfa00eceabfb5e64e915dc"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
85 lines
2.9 KiB
Text
85 lines
2.9 KiB
Text
[[external-plugin-functional-tests]]
|
|
== Functional Tests for Plugins outside the {kib} repo
|
|
|
|
Plugins use the `FunctionalTestRunner` by running it out of the {kib} repo. Ensure that your {kib} Development Environment is setup properly before continuing.
|
|
|
|
[discrete]
|
|
=== Writing your own configuration
|
|
|
|
Every project or plugin should have its own `FunctionalTestRunner` config file. Just like {kib}'s, this config file will define all of the test files to load, providers for Services and PageObjects, as well as configuration options for certain services.
|
|
|
|
To get started copy and paste this example to `test/functional/config.js`:
|
|
|
|
["source","js",subs="attributes"]
|
|
-----------
|
|
import { resolve } from 'path';
|
|
import { REPO_ROOT } from '@kbn/utils';
|
|
|
|
import { MyServiceProvider } from './services/my_service';
|
|
import { MyAppPageProvider } from './services/my_app_page';
|
|
|
|
// the default export of config files must be a config provider
|
|
// that returns an object with the projects config values
|
|
export default async function ({ readConfigFile }) {
|
|
|
|
// read the {kib} config file so that we can utilize some of
|
|
// its services and PageObjects
|
|
const kibanaConfig = await readConfigFile(resolve(REPO_ROOT, 'test/functional/config.base.js'));
|
|
|
|
return {
|
|
// list paths to the files that contain your plugins tests
|
|
testFiles: [
|
|
resolve(__dirname, './my_test_file.js'),
|
|
],
|
|
|
|
// define the name and providers for services that should be
|
|
// available to your tests. If you don't specify anything here
|
|
// only the built-in services will be available
|
|
services: {
|
|
...kibanaConfig.get('services'),
|
|
myService: MyServiceProvider,
|
|
},
|
|
|
|
// just like services, PageObjects are defined as a map of
|
|
// names to Providers. Merge in {kib}'s or pick specific ones
|
|
pageObjects: {
|
|
management: kibanaConfig.get('pageObjects.management'),
|
|
myApp: MyAppPageProvider,
|
|
},
|
|
|
|
// the apps section defines the urls that
|
|
// `PageObjects.common.navigateTo(appKey)` will use.
|
|
// Merge urls for your plugin with the urls defined in
|
|
// {kib}'s config in order to use this helper
|
|
apps: {
|
|
...kibanaConfig.get('apps'),
|
|
myApp: {
|
|
pathname: '/app/my_app',
|
|
}
|
|
},
|
|
|
|
// choose where screenshots should be saved
|
|
screenshots: {
|
|
directory: resolve(__dirname, './tmp/screenshots'),
|
|
}
|
|
|
|
// more settings, like timeouts, mochaOpts, etc are
|
|
// defined in the config schema.
|
|
// See {kibana-blob}src/platform/packages/shared/kbn-test/src/functional_test_runner/lib/config/schema.ts
|
|
};
|
|
}
|
|
|
|
-----------
|
|
|
|
From the root of your repo you should now be able to run the `FunctionalTestRunner` script from your plugin project.
|
|
|
|
["source","shell"]
|
|
-----------
|
|
node ../../kibana/scripts/functional_test_runner
|
|
-----------
|
|
|
|
[discrete]
|
|
=== Using esArchiver
|
|
|
|
We're working on documentation for this, but for now the best place to look is the original {kib-repo}issues/10359[pull request].
|
|
|