Skip to content

Commit

Permalink
move core provier to NP. allows to run tests on every page (#64929) (#…
Browse files Browse the repository at this point in the history
…65608)

* 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 <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
mshustov and elasticmachine authored May 7, 2020
1 parent a755c2e commit 290f790
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 60 deletions.
36 changes: 0 additions & 36 deletions test/plugin_functional/plugins/core_provider_plugin/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "core_provider_plugin",
"version": "0.0.1",
"kibanaVersion": "kibana",
"optionalPlugins": ["core_plugin_a", "core_plugin_b", "licensing"],
"server": false,
"ui": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
import { npSetup, npStart } from 'ui/new_platform';
import { Plugin, CoreSetup, CoreStart } from 'kibana/public';
import '../types';

window.__coreProvider = {
setup: npSetup,
start: npStart,
testUtils: {
delay: (ms: number) => new Promise(res => setTimeout(res, ms)),
},
};
export const plugin = () => new CoreProviderPlugin();

class CoreProviderPlugin implements Plugin {
private setupDeps?: { core: CoreSetup; plugins: Record<string, any> };
public setup(core: CoreSetup, plugins: Record<string, any>) {
this.setupDeps = {
core,
plugins,
};
}

public start(core: CoreStart, plugins: Record<string, any>) {
window.__coreProvider = {
setup: this.setupDeps!,
start: {
core,
plugins,
},
testUtils: {
delay: (ms: number) => new Promise(res => setTimeout(res, ms)),
},
};
}
public stop() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"index.ts",
"types.ts",
"public/**/*.ts",
"../../../../typings/**/*",
"../../../../typings/**/*"
],
"exclude": []
}
6 changes: 3 additions & 3 deletions test/plugin_functional/plugins/core_provider_plugin/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
import { LegacyCoreSetup, LegacyCoreStart } from 'kibana/public';
import { CoreSetup, CoreStart } from 'kibana/public';

declare global {
interface Window {
__coreProvider: {
setup: {
core: LegacyCoreSetup;
core: CoreSetup;
plugins: Record<string, any>;
};
start: {
core: LegacyCoreStart;
core: CoreStart;
plugins: Record<string, any>;
};
testUtils: {
Expand Down
8 changes: 0 additions & 8 deletions test/plugin_functional/test_suites/core_plugins/ui_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,6 @@ export default function({ getService, getPageObjects }: PluginFunctionalProvider
await PageObjects.common.navigateToApp('settings');
});

it('to injectedMetadata service', async () => {
expect(
await browser.execute(() => {
return window.__coreProvider.setup.core.injectedMetadata.getKibanaBuildNumber();
})
).to.be.a('number');
});

it('to start services via coreSetup.getStartServices', async () => {
expect(
await browser.executeAsync(async cb => {
Expand Down
1 change: 1 addition & 0 deletions test/scripts/jenkins_xpack_build_kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ source src/dev/ci_setup/setup_env.sh

echo " -> building kibana platform plugins"
node scripts/build_kibana_platform_plugins \
--scan-dir "$KIBANA_DIR/test/plugin_functional/plugins" \
--scan-dir "$XPACK_DIR/test/plugin_functional/plugins" \
--scan-dir "$XPACK_DIR/test/functional_with_es_ssl/fixtures/plugins" \
--scan-dir "$XPACK_DIR/test/alerting_api_integration/plugins" \
Expand Down
3 changes: 0 additions & 3 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ export default async function({ readConfigFile }) {
uptime: {
pathname: '/app/uptime',
},
apm: {
pathname: '/app/apm',
},
ml: {
pathname: '/app/ml',
},
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/licensing_plugin/config.public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ export default async function({ readConfigFile }: FtrConfigProviderContext) {
...commonConfig.getAll(),
testFiles: [require.resolve('./public')],
kbnTestServer: {
...commonConfig.get('kbnTestServer'),
serverArgs: [
...commonConfig.get('kbnTestServer.serverArgs'),

// Required to load new platform plugin provider via `--plugin-path` flag.
'--env.name=development',
`--plugin-path=${path.resolve(
Expand Down

0 comments on commit 290f790

Please sign in to comment.