[Guided onboarding] Register test guide in the example plugin (#147703)

This PR moves the test guide used for testing and dev work to the guided
onboarding package. It is now being registered when the guided
onboarding example plugin is being setup. For that a server side is
added to the example plugin.
Registering the test guide from the example plugin demonstrates how the
"register guide" function can be used for production guides. The test
config needs to be in the `kbn-guided-onboarding` package because
example plugins have some problems importing files from other plugins.
That way the test config is available to the example plugin and to the
guided onboarding plugin for unit and functional tests.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Yulia Čech 2023-01-20 11:29:25 +01:00 committed by GitHub
parent f90a89a839
commit e7746b24d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 165 additions and 105 deletions

View file

@ -7,7 +7,7 @@
"githubTeam": "platform-onboarding"
},
"description": "Example plugin to consume guidedOnboarding",
"server": false,
"server": true,
"ui": true,
"requiredPlugins": ["navigation", "guidedOnboarding"],
"optionalPlugins": []

View file

@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { PluginInitializerContext } from '@kbn/core/server';
import { GuidedOnboardingExamplePlugin } from './plugin';
export const plugin = (ctx: PluginInitializerContext) => new GuidedOnboardingExamplePlugin(ctx);

View file

@ -0,0 +1,36 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { GuidedOnboardingPluginSetup } from '@kbn/guided-onboarding-plugin/server';
import { PluginInitializerContext, CoreSetup, Plugin, Logger } from '@kbn/core/server';
import { testGuideId, testGuideConfig } from '@kbn/guided-onboarding';
interface PluginsSetup {
guidedOnboarding: GuidedOnboardingPluginSetup;
}
export class GuidedOnboardingExamplePlugin implements Plugin {
private readonly logger: Logger;
constructor(initializerContext: PluginInitializerContext) {
this.logger = initializerContext.logger.get();
}
public setup(coreSetup: CoreSetup, { guidedOnboarding }: PluginsSetup) {
this.logger.debug('guidedOnboardingExample: Setup');
guidedOnboarding.registerGuideConfig(testGuideId, testGuideConfig);
return {};
}
public start() {
this.logger.debug('guidedOnboardingExample: Started');
return {};
}
public stop() {}
}

View file

@ -0,0 +1,13 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface GuidedOnboardingExamplePluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface GuidedOnboardingExamplePluginStart {}