Skip to content

Commit

Permalink
re-work change to not break jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeDr committed Feb 12, 2020
1 parent 33a2a8b commit 1498c2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
8 changes: 4 additions & 4 deletions test/functional/apps/home/_sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should launch sample flights data set dashboard', async () => {
await PageObjects.home.launchSampleDataSet('flights');
await PageObjects.home.launchSampleDashboard('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
const todayYearMonthDay = moment().format('MMM D, YYYY');
Expand All @@ -96,7 +96,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should render visualizations', async () => {
await PageObjects.home.launchSampleDataSet('flights');
await PageObjects.home.launchSampleDashboard('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
log.debug('Checking pie charts rendered');
Expand All @@ -115,7 +115,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should launch sample logs data set dashboard', async () => {
await PageObjects.home.launchSampleDataSet('logs');
await PageObjects.home.launchSampleDashboard('logs');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
const todayYearMonthDay = moment().format('MMM D, YYYY');
Expand All @@ -127,7 +127,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should launch sample ecommerce data set dashboard', async () => {
await PageObjects.home.launchSampleDataSet('ecommerce');
await PageObjects.home.launchSampleDashboard('ecommerce');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
const todayYearMonthDay = moment().format('MMM D, YYYY');
Expand Down
15 changes: 7 additions & 8 deletions test/functional/page_objects/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,19 @@ export function HomePageProvider({ getService, getPageObjects }: FtrProviderCont
});
}

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.
async launchSampleDashboard(id: string) {
await this.launchSampleDataSet(id);
isOss = await PageObjects.common.isOss();
if (!isOss) {
await find.clickByLinkText('Dashboard');
}
}

async launchSampleDataSet(id: string) {
await this.addSampleDataSet(id);
await testSubjects.click(`launchSampleDataSet${id}`);
}

async loadSavedObjects() {
await retry.try(async () => {
await testSubjects.click('loadSavedObjects');
Expand Down

0 comments on commit 1498c2d

Please sign in to comment.