From 33a2a8b0d6bc1982b8daf264b81c05b49a9a090e Mon Sep 17 00:00:00 2001 From: LeeDr Date: Wed, 12 Feb 2020 15:19:12 -0600 Subject: [PATCH] handle viewing sample dashboards on default dist --- .../components/sample_data_view_data_button.js | 1 + test/functional/page_objects/home_page.ts | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data_view_data_button.js b/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data_view_data_button.js index e6f5c07c94f9fe..cb43c18a8e78b6 100644 --- a/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data_view_data_button.js +++ b/src/legacy/core_plugins/kibana/public/home/np_ready/components/sample_data_view_data_button.js @@ -112,6 +112,7 @@ export class SampleDataViewDataButton extends React.Component { closePopover={this.closePopover} panelPaddingSize="none" anchorPosition="downCenter" + data-test-subj={`launchSampleDataSet${this.props.id}`} > diff --git a/test/functional/page_objects/home_page.ts b/test/functional/page_objects/home_page.ts index a641fbda023c3b..63cb3356de7200 100644 --- a/test/functional/page_objects/home_page.ts +++ b/test/functional/page_objects/home_page.ts @@ -19,9 +19,12 @@ import { FtrProviderContext } from '../ftr_provider_context'; -export function HomePageProvider({ getService }: FtrProviderContext) { +export function HomePageProvider({ getService, getPageObjects }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const retry = getService('retry'); + const find = getService('find'); + const PageObjects = getPageObjects(['common']); + let isOss = true; class HomePage { async clickSynopsis(title: string) { @@ -66,6 +69,15 @@ export function HomePageProvider({ getService }: FtrProviderContext) { async launchSampleDataSet(id: string) { await this.addSampleDataSet(id); await testSubjects.click(`launchSampleDataSet${id}`); + // On OSS there's currently only sample dashboards so the launch button opens the dashboard + // but on default dist there's more items. The only tests that are calling this method are in OSS + // so they always expect Dashboard. isOss isn't really the right test. It should be based on + // the number of items. + // x-pack sample data tests seem to skip this navigation and open the saved objects directly. + isOss = await PageObjects.common.isOss(); + if (!isOss) { + await find.clickByLinkText('Dashboard'); + } } async loadSavedObjects() {