2020-10-06 03:35:23 +02:00
|
|
|
/*
|
2021-01-20 02:54:11 +01:00
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
2021-02-04 03:39:13 +01:00
|
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
|
|
* Side Public License, v 1.
|
2020-10-06 03:35:23 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
import { FtrProviderContext } from 'test/functional/ftr_provider_context';
|
|
|
|
|
|
|
|
// eslint-disable-next-line import/no-default-export
|
|
|
|
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|
|
|
const pageObjects = getPageObjects(['common']);
|
|
|
|
const testSubjects = getService('testSubjects');
|
|
|
|
const browser = getService('browser');
|
|
|
|
const esArchiver = getService('esArchiver');
|
|
|
|
|
|
|
|
describe('Insecure Cluster Warning', () => {
|
|
|
|
before(async () => {
|
|
|
|
await pageObjects.common.navigateToApp('home');
|
|
|
|
await browser.setLocalStorageItem('insecureClusterWarningVisibility', '');
|
|
|
|
// starting without user data
|
2021-06-09 04:45:04 +02:00
|
|
|
await esArchiver.unload('test/functional/fixtures/es_archiver/hamlet');
|
2020-10-06 03:35:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
after(async () => {
|
2021-06-09 04:45:04 +02:00
|
|
|
await esArchiver.unload('test/functional/fixtures/es_archiver/hamlet');
|
2020-10-06 03:35:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('without user data', () => {
|
|
|
|
before(async () => {
|
|
|
|
await browser.setLocalStorageItem('insecureClusterWarningVisibility', '');
|
2021-06-09 04:45:04 +02:00
|
|
|
await esArchiver.unload('test/functional/fixtures/es_archiver/hamlet');
|
2021-02-16 12:56:59 +01:00
|
|
|
await esArchiver.emptyKibanaIndex();
|
2020-10-06 03:35:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should not warn when the cluster contains no user data', async () => {
|
|
|
|
await browser.setLocalStorageItem(
|
|
|
|
'insecureClusterWarningVisibility',
|
|
|
|
JSON.stringify({ show: false })
|
|
|
|
);
|
|
|
|
await pageObjects.common.navigateToApp('home');
|
|
|
|
await testSubjects.missingOrFail('insecureClusterDefaultAlertText');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('with user data', () => {
|
|
|
|
before(async () => {
|
|
|
|
await pageObjects.common.navigateToApp('home');
|
|
|
|
await browser.setLocalStorageItem('insecureClusterWarningVisibility', '');
|
2021-06-09 04:45:04 +02:00
|
|
|
await esArchiver.load('test/functional/fixtures/es_archiver/hamlet');
|
2020-10-06 03:35:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
after(async () => {
|
2021-06-09 04:45:04 +02:00
|
|
|
await esArchiver.unload('test/functional/fixtures/es_archiver/hamlet');
|
2020-10-06 03:35:23 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should warn about an insecure cluster, and hide when dismissed', async () => {
|
|
|
|
await pageObjects.common.navigateToApp('home');
|
|
|
|
await testSubjects.existOrFail('insecureClusterDefaultAlertText');
|
|
|
|
|
|
|
|
await testSubjects.click('defaultDismissAlertButton');
|
|
|
|
|
|
|
|
await testSubjects.missingOrFail('insecureClusterDefaultAlertText');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not warn when local storage is configured to hide', async () => {
|
|
|
|
await browser.setLocalStorageItem(
|
|
|
|
'insecureClusterWarningVisibility',
|
|
|
|
JSON.stringify({ show: false })
|
|
|
|
);
|
|
|
|
await pageObjects.common.navigateToApp('home');
|
|
|
|
await testSubjects.missingOrFail('insecureClusterDefaultAlertText');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|