Skip to content

Commit

Permalink
using test_user with minimum privileges for canvas functional ui tests (
Browse files Browse the repository at this point in the history
elastic#75917)

* incorporating test_user wth specific roles for the canvas functional ui tests

* additional checks - removed comments

* changes to incorporate code comments

* lint check

* incorporate code reviews

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
rashmivkulkarni and elasticmachine committed Aug 27, 2020
1 parent 0ad490d commit 5d9f89e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
6 changes: 1 addition & 5 deletions x-pack/test/functional/apps/canvas/custom_elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,20 @@ export default function canvasCustomElementTest({
getService,
getPageObjects,
}: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const browser = getService('browser');
const retry = getService('retry');
const PageObjects = getPageObjects(['canvas', 'common']);
const find = getService('find');
const esArchiver = getService('esArchiver');

describe('custom elements', function () {
this.tags('skipFirefox');

before(async () => {
// init data
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('canvas/default');

// open canvas home
await PageObjects.common.navigateToApp('canvas');

// load test workpad
await PageObjects.common.navigateToApp('canvas', {
hash: '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1',
Expand Down
6 changes: 1 addition & 5 deletions x-pack/test/functional/apps/canvas/expression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,18 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function canvasExpressionTest({ getService, getPageObjects }: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
// const browser = getService('browser');
const retry = getService('retry');
const PageObjects = getPageObjects(['canvas', 'common']);
const find = getService('find');
const esArchiver = getService('esArchiver');

describe('expression editor', function () {
// there is an issue with FF not properly clicking on workpad elements
this.tags('skipFirefox');

before(async () => {
// init data
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('canvas/default');

// load test workpad
await PageObjects.common.navigateToApp('canvas', {
hash: '/workpad/workpad-1705f884-6224-47de-ba49-ca224fe6ec31/page/1',
Expand Down
15 changes: 14 additions & 1 deletion x-pack/test/functional/apps/canvas/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,21 @@
* you may not use this file except in compliance with the Elastic License.
*/

export default function canvasApp({ loadTestFile }) {
export default function canvasApp({ loadTestFile, getService }) {
const security = getService('security');
const esArchiver = getService('esArchiver');

describe('Canvas app', function canvasAppTestSuite() {
before(async () => {
// init data
await security.testUser.setRoles(['test_logstash_reader', 'global_canvas_all']);
await esArchiver.loadIfNeeded('logstash_functional');
});

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

this.tags('ciGroup2'); // CI requires tags ヽ(゜Q。)ノ?
loadTestFile(require.resolve('./smoke_test'));
loadTestFile(require.resolve('./expression'));
Expand Down
7 changes: 1 addition & 6 deletions x-pack/test/functional/apps/canvas/smoke_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@ import expect from '@kbn/expect';
import { parse } from 'url';

export default function canvasSmokeTest({ getService, getPageObjects }) {
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');
const browser = getService('browser');
const retry = getService('retry');
const PageObjects = getPageObjects(['common']);
const esArchiver = getService('esArchiver');

describe('smoke test', function () {
this.tags('includeFirefox');
const workpadListSelector = 'canvasWorkpadLoaderTable > canvasWorkpadLoaderWorkpad';
const testWorkpadId = 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31';

before(async () => {
// init data
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('canvas/default');

// load canvas
// see also navigateToUrl(app, hash)
await PageObjects.common.navigateToApp('canvas');
});

Expand Down
11 changes: 11 additions & 0 deletions x-pack/test/functional/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,17 @@ export default async function ({ readConfigFile }) {
kibana: [],
},

global_canvas_all: {
kibana: [
{
feature: {
canvas: ['all'],
},
spaces: ['*'],
},
],
},

global_discover_read: {
kibana: [
{
Expand Down

0 comments on commit 5d9f89e

Please sign in to comment.