Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding test user to maps functional tests - PR 1 #70649

Merged
merged 4 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions x-pack/test/functional/apps/maps/discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,24 @@ import expect from '@kbn/expect';
export default function ({ getService, getPageObjects }) {
const queryBar = getService('queryBar');
const PageObjects = getPageObjects(['common', 'discover', 'header', 'maps', 'timePicker']);
const security = getService('security');

describe('discover visualize button', () => {
beforeEach(async () => {
await security.testUser.setRoles([
'test_logstash_reader',
'global_maps_all',
'geoshape_data_reader',
'global_discover_read',
'global_visualize_read',
]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the other setRoles added in this PR used the false second parameter so that it doesn't refresh the browser. That could probably also be added here since the next step it to navigate (which always refreshes the browser as well). But I don't think there's any harm leaving this as-is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LeeDr yes visualize_create_menu.js wouln't pass without refreshing the browser. Thanks!

await PageObjects.common.navigateToApp('discover');
});

after(async () => {
await security.testUser.restoreDefaults();
});

it('should link geo_shape fields to Maps application', async () => {
await PageObjects.discover.selectIndexPattern('geo_shapes*');
await PageObjects.discover.clickFieldListItemVisualize('geometry');
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/functional/apps/maps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function ({ loadTestFile, getService }) {
await esArchiver.load('maps/data');
await esArchiver.load('maps/kibana');
await kibanaServer.uiSettings.replace({
defaultIndex: 'logstash-*',
defaultIndex: 'c698b940-e149-11e8-a35a-370a8516603a',
thomasneirynck marked this conversation as resolved.
Show resolved Hide resolved
});
await browser.setWindowSize(1600, 1000);
});
Expand Down
13 changes: 12 additions & 1 deletion x-pack/test/functional/apps/maps/visualize_create_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,25 @@

import expect from '@kbn/expect';

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

const security = getService('security');

describe('visualize create menu', () => {
before(async () => {
await security.testUser.setRoles(
['test_logstash_reader', 'global_maps_all', 'geoshape_data_reader', 'global_visualize_all'],
false
);

await PageObjects.visualize.navigateToNewVisualization();
});

after(async () => {
await security.testUser.restoreDefaults();
});

it('should show maps application in create menu', async () => {
const hasMapsApp = await PageObjects.visualize.hasMapsApp();
expect(hasMapsApp).to.equal(true);
Expand Down
41 changes: 41 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,47 @@ export default async function ({ readConfigFile }) {
},
],
},
global_visualize_read: {
kibana: [
{
feature: {
visualize: ['read'],
},
spaces: ['*'],
},
],
},
global_visualize_all: {
kibana: [
{
feature: {
visualize: ['all'],
},
spaces: ['*'],
},
],
},
global_maps_all: {
kibana: [
{
feature: {
maps: ['all'],
},
spaces: ['*'],
},
],
},

geoshape_data_reader: {
elasticsearch: {
indices: [
{
names: ['geo_shapes*'],
privileges: ['read', 'view_index_metadata'],
},
],
},
},

global_devtools_read: {
kibana: [
Expand Down