Skip to content

Commit

Permalink
[Maps] add functional test to ensure visualize create menu only shows…
Browse files Browse the repository at this point in the history
… Maps app (#58746) (#59210)

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
nreese and elasticmachine authored Mar 3, 2020
1 parent 6dc3fb7 commit 3687a6b
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 4 deletions.
28 changes: 24 additions & 4 deletions test/functional/page_objects/visualize_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
await this.waitForVisualizationSelectPage();
}

public async hasVisType(type: string) {
return await testSubjects.exists(`visType-${type}`);
}

public async clickVisType(type: string) {
await testSubjects.click(`visType-${type}`);
await header.waitUntilLoadingHasFinished();
Expand All @@ -100,6 +104,10 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
await this.clickVisType('region_map');
}

public async hasRegionMap() {
return await this.hasVisType('region_map');
}

public async clickMarkdownWidget() {
await this.clickVisType('markdown');
}
Expand All @@ -120,6 +128,10 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
await this.clickVisType('tile_map');
}

public async hasTileMap() {
return await this.hasVisType('tile_map');
}

public async clickTagCloud() {
await this.clickVisType('tagcloud');
}
Expand All @@ -144,6 +156,18 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
await this.clickVisType('input_control_vis');
}

public async clickLensWidget() {
await this.clickVisType('lens');
}

public async clickMapsApp() {
await this.clickVisType('maps');
}

public async hasMapsApp() {
return await this.hasVisType('maps');
}

public async createSimpleMarkdownViz(vizName: string) {
await this.gotoVisualizationLandingPage();
await this.navigateToNewVisualization();
Expand Down Expand Up @@ -315,10 +339,6 @@ export function VisualizePageProvider({ getService, getPageObjects }: FtrProvide
async () => (await globalNav.getLastBreadcrumb()) === vizName
);
}

public async clickLensWidget() {
await this.clickVisType('lens');
}
}

return new VisualizePage();
Expand Down
1 change: 1 addition & 0 deletions x-pack/test/functional/apps/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default function({ loadTestFile, getService }) {
loadTestFile(require.resolve('./import_geojson'));
loadTestFile(require.resolve('./layer_errors'));
loadTestFile(require.resolve('./embeddable'));
loadTestFile(require.resolve('./visualize_create_menu'));
loadTestFile(require.resolve('./discover'));
});
});
Expand Down
40 changes: 40 additions & 0 deletions x-pack/test/functional/apps/maps/visualize_create_menu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import expect from '@kbn/expect';

export default function({ getPageObjects }) {
const PageObjects = getPageObjects(['visualize', 'header', 'maps']);

describe('visualize create menu', () => {
before(async () => {
await PageObjects.visualize.navigateToNewVisualization();
});

it('should show maps application in create menu', async () => {
const hasMapsApp = await PageObjects.visualize.hasMapsApp();
expect(hasMapsApp).to.equal(true);
});

it('should not show legacy region map visualizion in create menu', async () => {
const hasLegecyViz = await PageObjects.visualize.hasRegionMap();
expect(hasLegecyViz).to.equal(false);
});

it('should not show legacy tilemap map visualizion in create menu', async () => {
const hasLegecyViz = await PageObjects.visualize.hasTileMap();
expect(hasLegecyViz).to.equal(false);
});

it('should take users to Maps application when Maps is clicked', async () => {
await PageObjects.visualize.clickMapsApp();
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.maps.waitForLayersToLoad();
const doesLayerExist = await PageObjects.maps.doesLayerExist('Road map');
expect(doesLayerExist).to.equal(true);
});
});
}

0 comments on commit 3687a6b

Please sign in to comment.