[8.6] [Guided onboarding] Fix home redirect when on Cloud (#145539) (#146032)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Guided onboarding] Fix home redirect when on Cloud
(#145539)](https://github.com/elastic/kibana/pull/145539)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Yulia
Čech","email":"6585477+yuliacech@users.noreply.github.com"},"sourceCommit":{"committedDate":"2022-11-22T17:11:46Z","message":"[Guided
onboarding] Fix home redirect when on Cloud
(#145539)","sha":"f0670b0a0ed5860397921002022e9650c387c648","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["loe:hours","release_note:skip","impact:critical","backport:prev-minor","Team:Journey/Onboarding","ci:cloud-deploy","v8.6.0","v8.7.0"],"number":145539,"url":"https://github.com/elastic/kibana/pull/145539","mergeCommit":{"message":"[Guided
onboarding] Fix home redirect when on Cloud
(#145539)","sha":"f0670b0a0ed5860397921002022e9650c387c648"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/145539","number":145539,"mergeCommit":{"message":"[Guided
onboarding] Fix home redirect when on Cloud
(#145539)","sha":"f0670b0a0ed5860397921002022e9650c387c648"}}]}]
BACKPORT-->

Co-authored-by: Yulia Čech <6585477+yuliacech@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2022-11-22 13:47:14 -05:00 committed by GitHub
parent cc1a155cd6
commit 1cb283ef89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 22 additions and 3 deletions

View file

@ -21,6 +21,7 @@ exports[`getting started should render getting started component 1`] = `
"toString": [Function],
}
}
data-test-subj="onboarding--landing-page"
hasShadow={true}
>
<EuiTitle

View file

@ -183,7 +183,12 @@ export const GettingStarted = () => {
return (
<KibanaPageTemplate panelled={false} grow>
<EuiPageTemplate.Section alignment="center">
<EuiPanel color="plain" hasShadow css={paddingCss}>
<EuiPanel
color="plain"
hasShadow
css={paddingCss}
data-test-subj="onboarding--landing-page"
>
<EuiTitle size="l" className="eui-textCenter">
<h1>{title}</h1>
</EuiTitle>

View file

@ -198,7 +198,7 @@ export class Home extends Component<HomeProps, State> {
if (isNewKibanaInstance) {
if (isCloudEnabled) {
application.navigateToUrl('./home#/getting_started');
return;
return null;
}
return this.renderWelcome();
}

View file

@ -13,9 +13,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const esArchiver = getService('esArchiver');
const PageObjects = getPageObjects(['common', 'home']);
const deployment = getService('deployment');
describe('Welcome interstitial', () => {
before(async () => {
beforeEach(async () => {
// Need to navigate to page first to clear storage before test can be run
await PageObjects.common.navigateToUrl('home', undefined);
await browser.clearLocalStorage();
@ -32,5 +33,13 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
expect(await PageObjects.home.isWelcomeInterstitialDisplayed()).to.be(true);
await PageObjects.common.clickAndValidate('skipWelcomeScreen', 'homeApp');
});
it('redirects to guided onboarding landing page when on Cloud', async () => {
const isCloud = await deployment.isCloud();
if (isCloud) {
await PageObjects.common.navigateToUrl('home', '', { disableWelcomePrompt: false });
expect(await PageObjects.home.isGuidedOnboardingLandingDisplayed()).to.be(true);
}
});
});
}

View file

@ -45,6 +45,10 @@ export class HomePageObject extends FtrService {
return await this.testSubjects.isDisplayed('homeWelcomeInterstitial');
}
async isGuidedOnboardingLandingDisplayed() {
return await this.testSubjects.isDisplayed('onboarding--landing-page');
}
async getVisibileSolutions() {
const solutionPanels = await this.testSubjects.findAll('~homSolutionPanel', 2000);
const panelAttributes = await Promise.all(