Fix console tests on cloud (#138682) (#138755)

* 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 <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit a9a1828a23)

Co-authored-by: liza-mae <liza-mae@users.noreply.github.com>
This commit is contained in:
Kibana Machine 2022-08-17 10:45:52 -04:00 committed by GitHub
parent 57d4764899
commit 9b7dce129a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 2 deletions

View file

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

View file

@ -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,
});
@ -41,6 +43,7 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
});
await PageObjects.header.waitUntilLoadingHasFinished();
await PageObjects.home.removeSampleDataSet('logs');
await security.testUser.restoreDefaults();
});
});
}

View file

@ -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: [],