Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ObsUX] Enable Hosts advanced setting on serverless #170035

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export const OBSERVABILITY_PROJECT_SETTINGS = [
settings.OBSERVABILITY_APM_TRACE_EXPLORER_TAB_ID,
settings.OBSERVABILITY_ENABLE_AWS_LAMBDA_METRICS_ID,
settings.OBSERVABILITY_APM_ENABLE_CRITICAL_PATH_ID,
settings.OBSERVABILITY_ENABLE_INFRASTRUCTURE_HOSTS_VIEW_ID,
];
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@ export function SvlCommonNavigationProvider(ctx: FtrProviderContext) {
expect(await getByVisibleText('~nav-item', by.text)).not.be(null);
}
},
async expectLinkMissing(
by: { deepLinkId: AppDeepLinkId } | { navId: string } | { text: string }
) {
if ('deepLinkId' in by) {
await testSubjects.missingOrFail(`~nav-item-deepLinkId-${by.deepLinkId}`);
} else if ('navId' in by) {
await testSubjects.missingOrFail(`~nav-item-id-${by.navId}`);
} else {
expect(await getByVisibleText('~nav-item', by.text)).be(null);
}
},
async expectLinkActive(
by: { deepLinkId: AppDeepLinkId } | { navId: string } | { text: string }
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('Observability Infra', function () {
loadTestFile(require.resolve('./header_menu'));
loadTestFile(require.resolve('./navigation'));
loadTestFile(require.resolve('./node_details'));
loadTestFile(require.resolve('./hosts_page'));
loadTestFile(require.resolve('./infra'));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { enableInfrastructureHostsView } from '@kbn/observability-plugin/common';
import { FtrProviderContext } from '../../../ftr_provider_context';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const kibanaServer = getService('kibanaServer');
const svlObltNavigation = getService('svlObltNavigation');
const browser = getService('browser');
const pageObjects = getPageObjects(['svlCommonPage', 'svlCommonNavigation', 'header']);

const setHostsSetting = async (value: boolean) => {
await kibanaServer.uiSettings.update({ [enableInfrastructureHostsView]: value });
await browser.refresh();
await pageObjects.svlCommonNavigation.expectExists();
};

const openInfraSection = async () => {
await pageObjects.svlCommonNavigation.sidenav.openSection('observability_project_nav.metrics');
};

describe('Infra Side Navigation', () => {
before(async () => {
await pageObjects.svlCommonPage.login();
await svlObltNavigation.navigateToLandingPage();
});

after(async () => {
await pageObjects.svlCommonPage.forceLogout();
});

describe('when Hosts settings is on', () => {
before(async () => {
await setHostsSetting(true);
await openInfraSection();
});

it("shows the 'Hosts' nav item", async () => {
await pageObjects.svlCommonNavigation.sidenav.expectLinkExists({
deepLinkId: 'metrics:hosts',
});
});
});

describe('when Hosts settings is off', () => {
before(async () => {
await setHostsSetting(false);
await openInfraSection();
});

it("hides the 'Hosts' nav item", async () => {
await pageObjects.svlCommonNavigation.sidenav.expectLinkMissing({
deepLinkId: 'metrics:hosts',
});
});
});
});
};
Loading