Skip to content

Commit

Permalink
Fix console tests on cloud (#138682)
Browse files Browse the repository at this point in the history
* Fix console test on cloud

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* Fix access to sample data

* Clean up access after test

* Fix restore test

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
liza-mae and kibanamachine authored Aug 12, 2022
1 parent 800cc72 commit a9a1828
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/functional/apps/console/_console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
const browser = getService('browser');
const PageObjects = getPageObjects(['common', 'console', 'header']);
const toasts = getService('toasts');
const security = getService('security');
const testSubjects = getService('testSubjects');

describe('console app', function describeIndexTests() {
this.tags('includeFirefox');
Expand Down Expand Up @@ -151,7 +153,20 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await PageObjects.console.clickPlay();
};

before(async () => {
await security.testUser.setRoles(['kibana_admin', 'test_index']);
});

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

beforeEach(async () => {
// Welcome fly out exists sometimes
const flyOutExists = await testSubjects.exists('euiFlyoutCloseButton');
if (flyOutExists) {
await testSubjects.click('euiFlyoutCloseButton');
}
await PageObjects.console.clearTextArea();
});

Expand All @@ -160,8 +175,8 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await retry.try(async () => {
const response = await PageObjects.console.getResponse();
log.debug(response);
expect(response).to.contain('# PUT test-index 200 OK');
expect(response).to.contain('# DELETE test-index 200 OK');
expect(response).to.contain('# PUT test-index 200');
expect(response).to.contain('# DELETE test-index 200');
});
});

Expand Down
3 changes: 3 additions & 0 deletions test/functional/apps/console/_vector_tile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import { FtrProviderContext } from '../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const PageObjects = getPageObjects(['common', 'console', 'header', 'home']);
const retry = getService('retry');
const security = getService('security');

describe('console vector tiles response validation', function describeIndexTests() {
before(async () => {
await security.testUser.setRoles(['kibana_admin', 'kibana_sample_admin']);
await PageObjects.common.navigateToUrl('home', '/tutorial_directory/sampleData', {
useActualUrl: true,
});
Expand All @@ -41,6 +43,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.home.removeSampleDataSet('logs');
await security.testUser.restoreDefaults();
});
});
}
15 changes: 15 additions & 0 deletions test/functional/config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,21 @@ export default async function ({ readConfigFile }) {
kibana: [],
},

test_index: {
elasticsearch: {
cluster: [],
indices: [
{
names: ['test-index'],
privileges: ['read', 'view_index_metadata', 'manage', 'create_index', 'index'],
field_security: { grant: ['*'], except: [] },
},
],
run_as: [],
},
kibana: [],
},

index_a: {
elasticsearch: {
cluster: [],
Expand Down

0 comments on commit a9a1828

Please sign in to comment.