[Maps] add functional test to ensure visualize create menu only shows Maps app (#58746) (#59210)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2020-03-03 14:29:39 -07:00 committed by GitHub
parent 6dc3fb77c5
commit 3687a6b4f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 4 deletions

View file

@ -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();
@ -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');
}
@ -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');
}
@ -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();
@ -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();

View file

@ -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'));
});
});

View file

@ -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);
});
});
}