[Fleet] Bootstrap functional test suite (#91898)
This commit is contained in:
parent
da25d2753b
commit
0760bfb870
|
@ -31,7 +31,7 @@ export const OverviewPolicySection: React.FC<{ agentPolicies: AgentPolicy[] }> =
|
|||
});
|
||||
|
||||
return (
|
||||
<EuiFlexItem component="section">
|
||||
<EuiFlexItem component="section" data-test-subj="fleet-agent-policy-section">
|
||||
<OverviewPanel
|
||||
title={i18n.translate('xpack.fleet.overviewPagePoliciesPanelTitle', {
|
||||
defaultMessage: 'Agent policies',
|
||||
|
|
|
@ -24,7 +24,7 @@ export const OverviewAgentSection = () => {
|
|||
const agentStatusRequest = useGetAgentStatus({});
|
||||
|
||||
return (
|
||||
<EuiFlexItem component="section">
|
||||
<EuiFlexItem component="section" data-test-subj="fleet-agent-section">
|
||||
<OverviewPanel
|
||||
title={i18n.translate('xpack.fleet.overviewPageAgentsPanelTitle', {
|
||||
defaultMessage: 'Agents',
|
||||
|
|
|
@ -45,7 +45,7 @@ export const OverviewDatastreamSection: React.FC = () => {
|
|||
}
|
||||
|
||||
return (
|
||||
<EuiFlexItem component="section">
|
||||
<EuiFlexItem component="section" data-test-subj="fleet-datastream-section">
|
||||
<OverviewPanel
|
||||
title={i18n.translate('xpack.fleet.overviewPageDataStreamsPanelTitle', {
|
||||
defaultMessage: 'Data streams',
|
||||
|
|
|
@ -31,7 +31,7 @@ export const OverviewIntegrationSection: React.FC = () => {
|
|||
(item) => 'savedObject' in item && item.version > item.savedObject.attributes.version
|
||||
)?.length ?? 0;
|
||||
return (
|
||||
<EuiFlexItem component="section">
|
||||
<EuiFlexItem component="section" data-test-subj="fleet-integrations-section">
|
||||
<OverviewPanel
|
||||
title={i18n.translate('xpack.fleet.overviewPageIntegrationsPanelTitle', {
|
||||
defaultMessage: 'Integrations',
|
||||
|
|
17
x-pack/test/fleet_functional/apps/fleet/index.ts
Normal file
17
x-pack/test/fleet_functional/apps/fleet/index.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* 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 { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function (providerContext: FtrProviderContext) {
|
||||
const { loadTestFile } = providerContext;
|
||||
|
||||
describe('endpoint', function () {
|
||||
this.tags('ciGroup7');
|
||||
loadTestFile(require.resolve('./overview_page'));
|
||||
});
|
||||
}
|
38
x-pack/test/fleet_functional/apps/fleet/overview_page.ts
Normal file
38
x-pack/test/fleet_functional/apps/fleet/overview_page.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* 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 { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const { overviewPage } = getPageObjects(['overviewPage']);
|
||||
|
||||
describe('When in the Fleet application', function () {
|
||||
this.tags(['ciGroup7']);
|
||||
|
||||
describe('and on the Overview page', () => {
|
||||
before(async () => {
|
||||
await overviewPage.navigateToOverview();
|
||||
});
|
||||
|
||||
it('should show the Integrations section', async () => {
|
||||
await overviewPage.integrationsSectionExistsOrFail();
|
||||
});
|
||||
|
||||
it('should show the Agents section', async () => {
|
||||
await overviewPage.agentSectionExistsOrFail();
|
||||
});
|
||||
|
||||
it('should show the Agent policies section', async () => {
|
||||
await overviewPage.agentPolicySectionExistsOrFail();
|
||||
});
|
||||
|
||||
it('should show the Data streams section', async () => {
|
||||
await overviewPage.datastreamSectionExistsOrFail();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
41
x-pack/test/fleet_functional/config.ts
Normal file
41
x-pack/test/fleet_functional/config.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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 { resolve } from 'path';
|
||||
import { FtrConfigProviderContext } from '@kbn/test/types/ftr';
|
||||
import { pageObjects } from './page_objects';
|
||||
import { services } from './services';
|
||||
|
||||
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
|
||||
const xpackFunctionalConfig = await readConfigFile(require.resolve('../functional/config.js'));
|
||||
|
||||
return {
|
||||
...xpackFunctionalConfig.getAll(),
|
||||
pageObjects,
|
||||
testFiles: [resolve(__dirname, './apps/fleet')],
|
||||
junit: {
|
||||
reportName: 'X-Pack Fleet Functional Tests',
|
||||
},
|
||||
services,
|
||||
apps: {
|
||||
...xpackFunctionalConfig.get('apps'),
|
||||
['fleet']: {
|
||||
pathname: '/app/fleet',
|
||||
},
|
||||
},
|
||||
kbnTestServer: {
|
||||
...xpackFunctionalConfig.get('kbnTestServer'),
|
||||
serverArgs: [
|
||||
...xpackFunctionalConfig.get('kbnTestServer.serverArgs'),
|
||||
'--xpack.fleet.enabled=true',
|
||||
],
|
||||
},
|
||||
layout: {
|
||||
fixedHeaderHeight: 200,
|
||||
},
|
||||
};
|
||||
}
|
13
x-pack/test/fleet_functional/ftr_provider_context.d.ts
vendored
Normal file
13
x-pack/test/fleet_functional/ftr_provider_context.d.ts
vendored
Normal file
|
@ -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/types/ftr';
|
||||
|
||||
import { pageObjects } from './page_objects';
|
||||
import { services } from './services';
|
||||
|
||||
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;
|
14
x-pack/test/fleet_functional/page_objects/index.ts
Normal file
14
x-pack/test/fleet_functional/page_objects/index.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*
|
||||
* 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 { pageObjects as xpackFunctionalPageObjects } from '../../functional/page_objects';
|
||||
import { OverviewPage } from './overview_page';
|
||||
|
||||
export const pageObjects = {
|
||||
...xpackFunctionalPageObjects,
|
||||
overviewPage: OverviewPage,
|
||||
};
|
41
x-pack/test/fleet_functional/page_objects/overview_page.ts
Normal file
41
x-pack/test/fleet_functional/page_objects/overview_page.ts
Normal file
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* 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 { FtrProviderContext } from '../ftr_provider_context';
|
||||
import { PLUGIN_ID } from '../../../plugins/fleet/common';
|
||||
|
||||
// NOTE: import path below should be the deep path to the actual module - else we get CI errors
|
||||
import { pagePathGetters } from '../../../plugins/fleet/public/applications/fleet/constants/page_paths';
|
||||
|
||||
export function OverviewPage({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const pageObjects = getPageObjects(['common']);
|
||||
const testSubjects = getService('testSubjects');
|
||||
|
||||
return {
|
||||
async navigateToOverview() {
|
||||
await pageObjects.common.navigateToApp(PLUGIN_ID, {
|
||||
hash: pagePathGetters.overview(),
|
||||
});
|
||||
},
|
||||
|
||||
async integrationsSectionExistsOrFail() {
|
||||
await testSubjects.existOrFail('fleet-integrations-section');
|
||||
},
|
||||
|
||||
async agentPolicySectionExistsOrFail() {
|
||||
await testSubjects.existOrFail('fleet-agent-policy-section');
|
||||
},
|
||||
|
||||
async agentSectionExistsOrFail() {
|
||||
await testSubjects.existOrFail('fleet-agent-section');
|
||||
},
|
||||
|
||||
async datastreamSectionExistsOrFail() {
|
||||
await testSubjects.existOrFail('fleet-datastream-section');
|
||||
},
|
||||
};
|
||||
}
|
12
x-pack/test/fleet_functional/services/index.ts
Normal file
12
x-pack/test/fleet_functional/services/index.ts
Normal file
|
@ -0,0 +1,12 @@
|
|||
/*
|
||||
* 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 xPackFunctionalServices } from '../../functional/services';
|
||||
|
||||
export const services = {
|
||||
...xPackFunctionalServices,
|
||||
};
|
Loading…
Reference in a new issue