Skip to content

Commit 8a33424

Browse files
move core provier to NP. allows to run tests on every page (#64929)
* move core provier to NP. allows to run tests on every page * remove no-base-path * pass whole KbnTestServer config * fix build path * another id * np * build kibana tests plugins. it is used in xpack tests Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent 4619b47 commit 8a33424

File tree

9 files changed

+40
-60
lines changed

9 files changed

+40
-60
lines changed

test/plugin_functional/plugins/core_provider_plugin/index.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "core_provider_plugin",
3+
"version": "0.0.1",
4+
"kibanaVersion": "kibana",
5+
"optionalPlugins": ["core_plugin_a", "core_plugin_b", "licensing"],
6+
"server": false,
7+
"ui": true
8+
}

test/plugin_functional/plugins/core_provider_plugin/public/index.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,31 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { npSetup, npStart } from 'ui/new_platform';
19+
import { Plugin, CoreSetup, CoreStart } from 'kibana/public';
2020
import '../types';
2121

22-
window.__coreProvider = {
23-
setup: npSetup,
24-
start: npStart,
25-
testUtils: {
26-
delay: (ms: number) => new Promise(res => setTimeout(res, ms)),
27-
},
28-
};
22+
export const plugin = () => new CoreProviderPlugin();
23+
24+
class CoreProviderPlugin implements Plugin {
25+
private setupDeps?: { core: CoreSetup; plugins: Record<string, any> };
26+
public setup(core: CoreSetup, plugins: Record<string, any>) {
27+
this.setupDeps = {
28+
core,
29+
plugins,
30+
};
31+
}
32+
33+
public start(core: CoreStart, plugins: Record<string, any>) {
34+
window.__coreProvider = {
35+
setup: this.setupDeps!,
36+
start: {
37+
core,
38+
plugins,
39+
},
40+
testUtils: {
41+
delay: (ms: number) => new Promise(res => setTimeout(res, ms)),
42+
},
43+
};
44+
}
45+
public stop() {}
46+
}

test/plugin_functional/plugins/core_provider_plugin/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"index.ts",
99
"types.ts",
1010
"public/**/*.ts",
11-
"../../../../typings/**/*",
11+
"../../../../typings/**/*"
1212
],
1313
"exclude": []
1414
}

test/plugin_functional/plugins/core_provider_plugin/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { LegacyCoreSetup, LegacyCoreStart } from 'kibana/public';
19+
import { CoreSetup, CoreStart } from 'kibana/public';
2020

2121
declare global {
2222
interface Window {
2323
__coreProvider: {
2424
setup: {
25-
core: LegacyCoreSetup;
25+
core: CoreSetup;
2626
plugins: Record<string, any>;
2727
};
2828
start: {
29-
core: LegacyCoreStart;
29+
core: CoreStart;
3030
plugins: Record<string, any>;
3131
};
3232
testUtils: {

test/plugin_functional/test_suites/core_plugins/ui_plugins.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
4747
await PageObjects.common.navigateToApp('settings');
4848
});
4949

50-
it('to injectedMetadata service', async () => {
51-
expect(
52-
await browser.execute(() => {
53-
return window.__coreProvider.setup.core.injectedMetadata.getKibanaBuildNumber();
54-
})
55-
).to.be.a('number');
56-
});
57-
5850
it('to start services via coreSetup.getStartServices', async () => {
5951
expect(
6052
await browser.executeAsync(async cb => {

test/scripts/jenkins_xpack_build_kibana.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ source src/dev/ci_setup/setup_env.sh
55

66
echo " -> building kibana platform plugins"
77
node scripts/build_kibana_platform_plugins \
8+
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
89
--scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \
910
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \
1011
--scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \

x-pack/test/functional/config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ export default async function({ readConfigFile }) {
146146
uptime: {
147147
pathname: '/app/uptime',
148148
},
149-
apm: {
150-
pathname: '/app/apm',
151-
},
152149
ml: {
153150
pathname: '/app/ml',
154151
},

x-pack/test/licensing_plugin/config.public.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {
1414
...commonConfig.getAll(),
1515
testFiles: [require.resolve('./public')],
1616
kbnTestServer: {
17+
...commonConfig.get('kbnTestServer'),
1718
serverArgs: [
1819
...commonConfig.get('kbnTestServer.serverArgs'),
19-
2020
// Required to load new platform plugin provider via `--plugin-path` flag.
2121
'--env.name=development',
2222
`--plugin-path=${path.resolve(

0 commit comments

Comments
 (0)