Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move core provier to NP. allows to run tests on every page #64929

Merged
merged 10 commits into from
May 7, 2020
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"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see we reference any x-pack plugins here. They are used only if present in the codebase. In the future, we might automate the generation of the optional plugins list.

"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/plugin_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',
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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