kibana/test/security_functional/insecure_cluster_warning.ts
Rudolf Meijering fd1d965039
Unrevert "Migrations v2: don't auto-create indices + FTR/esArchiver support (#85778)" (#89992)
* Revert "Revert "Migrations v2: don't auto-create indices + FTR/esArchiver support (#85778)""

This reverts commit f97958043f.

* Fix flaky saved objects management test #89953

* If a clone target exists, wait for yellow, not green, index status

* Fix test after master merge

* Fix types

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-02-06 18:45:20 +01:00

78 lines
2.8 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 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.
*/
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
await esArchiver.unload('hamlet');
});
after(async () => {
await esArchiver.unload('hamlet');
});
describe('without user data', () => {
before(async () => {
await browser.setLocalStorageItem('insecureClusterWarningVisibility', '');
await esArchiver.unload('hamlet');
await esArchiver.emptyKibanaIndex();
});
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', '');
await esArchiver.load('hamlet');
});
after(async () => {
await esArchiver.unload('hamlet');
});
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');
});
});
});
}