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

[Search][FTR] Solution Nav #195327

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
1 change: 1 addition & 0 deletions .buildkite/ftr_platform_stateful_configs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ enabled:
- x-pack/test/functional/config.upgrade_assistant.ts
- x-pack/test/functional_cloud/config.ts
- x-pack/test/functional_solution_sidenav/config.ts
- x-pack/test/functional_search/config.ts
- x-pack/test/kubernetes_security/basic/config.ts
- x-pack/test/licensing_plugin/config.public.ts
- x-pack/test/licensing_plugin/config.ts
Expand Down
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -1480,6 +1480,7 @@ x-pack/test/api_integration/apis/management/index_management/inference_endpoints
/x-pack/test_serverless/api_integration/test_suites/search @elastic/search-kibana
/x-pack/test_serverless/functional/page_objects/svl_api_keys.ts @elastic/search-kibana
/x-pack/test_serverless/functional/page_objects/svl_search_* @elastic/search-kibana
/x-pack/test/functional_search/ @elastic/search-kibana

# Management Experience - Deployment Management
/x-pack/test_serverless/**/test_suites/common/index_management/ @elastic/kibana-management
Expand Down
12 changes: 12 additions & 0 deletions test/functional/page_objects/solution_navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@ export function SolutionNavigationProvider(ctx: Pick<FtrProviderContext, 'getSer
});
}
},
async expectOnlyDefinedLinks(navItemIds: string[]) {
const navItemIdRegEx = /nav-item-id-[^\s]+/g;
const allSideNavLinks = await testSubjects.findAll('*nav-item-id-');
for (const sideNavItem of allSideNavLinks) {
const dataTestSubjs = await sideNavItem.getAttribute('data-test-subj');
const navItemIdMatch = dataTestSubjs?.match(navItemIdRegEx);
expect(navItemIdMatch).to.be.ok();
const navItemId = navItemIdMatch![0].replace('nav-item-id-', '');
expect(navItemIds).to.contain(navItemId);
}
expect(allSideNavLinks.length).to.equal(navItemIds.length);
},
async clickPanelLink(deepLinkId: string) {
await testSubjects.click(`~panelNavItem-id-${deepLinkId}`);
},
Expand Down
14 changes: 11 additions & 3 deletions x-pack/plugins/enterprise_search/public/navigation_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const getNavigationTreeDefinition = ({
return pathNameSerialized.startsWith(prepend('/app/dev_tools'));
},
id: 'dev_tools',
link: 'dev_tools:console',
link: 'dev_tools',
title: i18n.translate('xpack.enterpriseSearch.searchNav.devTools', {
defaultMessage: 'Dev Tools',
}),
Expand Down Expand Up @@ -218,7 +218,11 @@ export const getNavigationTreeDefinition = ({
{
children: [
{
getIsActive: () => false,
getIsActive: ({ pathNameSerialized, prepend }) => {
return pathNameSerialized.startsWith(
prepend('/app/enterprise_search/app_search')
);
},
link: 'appSearch:engines',
title: i18n.translate(
'xpack.enterpriseSearch.searchNav.entsearch.appSearch',
Expand All @@ -235,7 +239,11 @@ export const getNavigationTreeDefinition = ({
: {}),
},
{
getIsActive: () => false,
getIsActive: ({ pathNameSerialized, prepend }) => {
return pathNameSerialized.startsWith(
prepend('/app/enterprise_search/workplace_search')
);
},
link: 'workplaceSearch',
...(workplaceSearch
? {
Expand Down
31 changes: 31 additions & 0 deletions x-pack/test/functional_search/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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 { FtrConfigProviderContext } from '@kbn/test';

/**
* NOTE: The solution view is currently only available in the cloud environment.
* This test suite fakes a cloud environement by setting the cloud.id and cloud.base_url
*/

export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const functionalConfig = await readConfigFile(require.resolve('../functional/config.base.js'));

return {
...functionalConfig.getAll(),
testFiles: [require.resolve('.')],
kbnTestServer: {
...functionalConfig.get('kbnTestServer'),
serverArgs: [
...functionalConfig.get('kbnTestServer.serverArgs'),
// Note: the base64 string in the cloud.id config contains the ES endpoint required in the functional tests
'--xpack.cloud.id=ftr_fake_cloud_id:aGVsbG8uY29tOjQ0MyRFUzEyM2FiYyRrYm4xMjNhYmM=',
'--xpack.cloud.base_url=https://cloud.elastic.co',
],
},
};
}
13 changes: 13 additions & 0 deletions x-pack/test/functional_search/ftr_provider_context.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* 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 { GenericFtrProviderContext } from '@kbn/test';
import { pageObjects } from '../functional/page_objects';
import { services } from './services';

export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;
export { pageObjects };
15 changes: 15 additions & 0 deletions x-pack/test/functional_search/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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.
*/
/* eslint-disable import/no-default-export */

import { FtrProviderContext } from './ftr_provider_context';

export default ({ loadTestFile }: FtrProviderContext): void => {
describe('Search solution tests', function () {
loadTestFile(require.resolve('./tests/solution_navigation'));
});
};
10 changes: 10 additions & 0 deletions x-pack/test/functional_search/services.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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 { services as functionalServices } from '../functional/services';

export const services = functionalServices;
Loading