mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Guided onboarding] Disable welcome screen on use case click
This commit is contained in:
parent
cc12697404
commit
abc347e741
2 changed files with 14 additions and 5 deletions
|
@ -33,6 +33,7 @@ jest.mock('../../kibana_services', () => {
|
|||
},
|
||||
guidedOnboardingService: {
|
||||
fetchAllGuidesState: jest.fn(),
|
||||
activateGuide: jest.fn(),
|
||||
},
|
||||
}),
|
||||
};
|
||||
|
@ -54,11 +55,17 @@ describe('getting started', () => {
|
|||
expect(component).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('skip button should disable home welcome screen', async () => {
|
||||
const component = mountWithIntl(<GettingStarted />);
|
||||
const skipButton = findTestSubject(component, 'onboarding--skipUseCaseTourLink');
|
||||
skipButton.simulate('click');
|
||||
[
|
||||
{ dataTestSubj: 'onboarding--skipUseCaseTourLink', buttonName: 'skip' },
|
||||
{ dataTestSubj: 'onboarding--guideCard--view--search', buttonName: 'use case' },
|
||||
].map(({ dataTestSubj, buttonName }) => {
|
||||
test(`${buttonName} button should disable home welcome screen`, async () => {
|
||||
localStorage.removeItem(KEY_ENABLE_WELCOME);
|
||||
const component = mountWithIntl(<GettingStarted />);
|
||||
const button = findTestSubject(component, dataTestSubj);
|
||||
button.simulate('click');
|
||||
|
||||
expect(localStorage.getItem(KEY_ENABLE_WELCOME)).toBe('false');
|
||||
expect(localStorage.getItem(KEY_ENABLE_WELCOME)).toBe('false');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -89,6 +89,8 @@ export const GettingStarted = () => {
|
|||
|
||||
const isDarkTheme = uiSettings.get<boolean>('theme:darkMode');
|
||||
const activateGuide = async (useCase: UseCase, guideState?: GuideState) => {
|
||||
// disable welcome screen on the home page
|
||||
localStorage.setItem(KEY_ENABLE_WELCOME, JSON.stringify(false));
|
||||
await guidedOnboardingService?.activateGuide(useCase as GuideId, guideState);
|
||||
// TODO error handling https://github.com/elastic/kibana/issues/139798
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue