Skip to content

Commit

Permalink
Launch sample data from home (#129146)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
liza-mae and kibanamachine authored Apr 4, 2022
1 parent 3020fcf commit 0e490e7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 61 deletions.
10 changes: 10 additions & 0 deletions test/functional/page_objects/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,16 @@ export class HomePageObject extends FtrService {
await this.find.clickByLinkText('Dashboard');
}

async launchSampleCanvas(id: string) {
await this.launchSampleDataSet(id);
await this.find.clickByLinkText('Canvas');
}

async launchSampleMap(id: string) {
await this.launchSampleDataSet(id);
await this.find.clickByLinkText('Map');
}

async launchSampleDataSet(id: string) {
await this.addSampleDataSet(id);
await this.common.closeToastIfExists();
Expand Down
66 changes: 26 additions & 40 deletions x-pack/test/upgrade/apps/canvas/canvas_smoke_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { FtrProviderContext } from '../../ftr_provider_context';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const retry = getService('retry');
const PageObjects = getPageObjects(['common', 'header']);
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'header', 'home']);
const testSubjects = getService('testSubjects');
const browser = getService('browser');

describe('canvas smoke tests', function describeIndexTests() {
const spaces = [
Expand All @@ -21,49 +21,35 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
];

const canvasTests = [
{
name: 'flights',
id: 'workpad-a474e74b-aedc-47c3-894a-db77e62c41e0/page/1',
altId: '',
numElements: 35,
},
{
name: 'logs',
id: 'workpad-5563cc40-5760-4afe-bf33-9da72fac53b7/page/1',
altId: 'workpad-ad72a4e9-b422-480c-be6d-a64a0b79541d',
numElements: 57,
},
{
name: 'ecommerce',
id: 'workpad-e08b9bdb-ec14-4339-94c4-063bddfd610e/page/1',
altId: '',
numElements: 16,
},
{
name: 'ecommerce',
id: 'workpad-e08b9bdb-ec14-4339-94c4-063bddfd610e/page/2',
altId: '',
numElements: 9,
},
{ name: 'flights', page: 1, numElements: 35 },
{ name: 'logs', page: 1, numElements: 57 },
{ name: 'ecommerce', page: 1, numElements: 16 },
{ name: 'ecommerce', page: 2, numElements: 9 },
];

spaces.forEach(({ space, basePath }) => {
canvasTests.forEach(({ name, id, altId, numElements }) => {
describe('space ' + space + ' name ' + name, () => {
beforeEach(async () => {
await PageObjects.common.navigateToActualUrl('canvas', 'workpad/' + id, {
basePath,
});
describe('space ' + space, () => {
beforeEach(async () => {
await PageObjects.common.navigateToActualUrl('home', '/tutorial_directory/sampleData', {
basePath,
});
await PageObjects.header.waitUntilLoadingHasFinished();
});
canvasTests.forEach(({ name, numElements, page }) => {
it('renders elements on workpad ' + name + ' page ' + page, async () => {
await PageObjects.home.launchSampleCanvas(name);
await PageObjects.header.waitUntilLoadingHasFinished();
const url = await browser.getCurrentUrl();
if (!url.includes(id) && altId.length > 0) {
await PageObjects.common.navigateToActualUrl('canvas', 'workpad/' + altId, {
basePath,
});
const currentUrl = await browser.getCurrentUrl();
const [, hash] = currentUrl.split('#/');
if (hash.length === 0) {
throw new Error('Did not launch canvas sample data for ' + name);
}
if (name === 'ecommerce') {
if (!currentUrl.includes('page/' + page)) {
await browser.get(currentUrl.replace(/\/[^\/]*$/, '/' + page), false);
await PageObjects.header.waitUntilLoadingHasFinished();
}
}
await PageObjects.header.waitUntilLoadingHasFinished();
});
it('renders elements on workpad', async () => {
await retry.try(async () => {
const elements = await testSubjects.findAll(
'canvasWorkpadPage > canvasWorkpadPageElementContent'
Expand Down
36 changes: 15 additions & 21 deletions x-pack/test/upgrade/apps/maps/maps_smoke_tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,11 @@ export default function ({
spaces.forEach(({ space, basePath }) => {
describe('space ' + space + ' ecommerce', () => {
before(async () => {
await PageObjects.common.navigateToActualUrl(
'maps',
'map/' + '2c9c1f60-1909-11e9-919b-ffe5949a18d2',
{
basePath,
}
);
await PageObjects.common.navigateToActualUrl('home', '/tutorial_directory/sampleData', {
basePath,
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.home.launchSampleMap('ecommerce');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
await mapsHelper.toggleLayerVisibilityRoadMap();
Expand All @@ -133,13 +131,11 @@ export default function ({
});
describe('space ' + space + ' flights', () => {
before(async () => {
await PageObjects.common.navigateToActualUrl(
'maps',
'map/' + '5dd88580-1906-11e9-919b-ffe5949a18d2',
{
basePath,
}
);
await PageObjects.common.navigateToActualUrl('home', '/tutorial_directory/sampleData', {
basePath,
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.home.launchSampleMap('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
await mapsHelper.toggleLayerVisibilityRoadMap();
Expand All @@ -159,13 +155,11 @@ export default function ({
});
describe('space ' + space + ' web logs', () => {
before(async () => {
await PageObjects.common.navigateToActualUrl(
'maps',
'map/' + 'de71f4f0-1902-11e9-919b-ffe5949a18d2',
{
basePath,
}
);
await PageObjects.common.navigateToActualUrl('home', '/tutorial_directory/sampleData', {
basePath,
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.home.launchSampleMap('logs');
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
await mapsHelper.toggleLayerVisibilityRoadMap();
Expand Down

0 comments on commit 0e490e7

Please sign in to comment.