Skip to content

Commit b521ab9

Browse files
committed
[Fleet] Bootstrap functional test suite (#91898)
1 parent 854e833 commit b521ab9

11 files changed

Lines changed: 180 additions & 4 deletions

File tree

x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/agent_policy_section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const OverviewPolicySection: React.FC<{ agentPolicies: AgentPolicy[] }> =
3131
});
3232

3333
return (
34-
<EuiFlexItem component="section">
34+
<EuiFlexItem component="section" data-test-subj="fleet-agent-policy-section">
3535
<OverviewPanel
3636
title={i18n.translate('xpack.fleet.overviewPagePoliciesPanelTitle', {
3737
defaultMessage: 'Agent policies',

x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/agent_section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const OverviewAgentSection = () => {
2424
const agentStatusRequest = useGetAgentStatus({});
2525

2626
return (
27-
<EuiFlexItem component="section">
27+
<EuiFlexItem component="section" data-test-subj="fleet-agent-section">
2828
<OverviewPanel
2929
title={i18n.translate('xpack.fleet.overviewPageAgentsPanelTitle', {
3030
defaultMessage: 'Agents',

x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/datastream_section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export const OverviewDatastreamSection: React.FC = () => {
4545
}
4646

4747
return (
48-
<EuiFlexItem component="section">
48+
<EuiFlexItem component="section" data-test-subj="fleet-datastream-section">
4949
<OverviewPanel
5050
title={i18n.translate('xpack.fleet.overviewPageDataStreamsPanelTitle', {
5151
defaultMessage: 'Data streams',

x-pack/plugins/fleet/public/applications/fleet/sections/overview/components/integration_section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const OverviewIntegrationSection: React.FC = () => {
3131
(item) => 'savedObject' in item && item.version > item.savedObject.attributes.version
3232
)?.length ?? 0;
3333
return (
34-
<EuiFlexItem component="section">
34+
<EuiFlexItem component="section" data-test-subj="fleet-integrations-section">
3535
<OverviewPanel
3636
title={i18n.translate('xpack.fleet.overviewPageIntegrationsPanelTitle', {
3737
defaultMessage: 'Integrations',
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { FtrProviderContext } from '../../ftr_provider_context';
9+
10+
export default function (providerContext: FtrProviderContext) {
11+
const { loadTestFile } = providerContext;
12+
13+
describe('endpoint', function () {
14+
this.tags('ciGroup7');
15+
loadTestFile(require.resolve('./overview_page'));
16+
});
17+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { FtrProviderContext } from '../../ftr_provider_context';
9+
10+
export default function ({ getPageObjects, getService }: FtrProviderContext) {
11+
const { overviewPage } = getPageObjects(['overviewPage']);
12+
13+
describe('When in the Fleet application', function () {
14+
this.tags(['ciGroup7']);
15+
16+
describe('and on the Overview page', () => {
17+
before(async () => {
18+
await overviewPage.navigateToOverview();
19+
});
20+
21+
it('should show the Integrations section', async () => {
22+
await overviewPage.integrationsSectionExistsOrFail();
23+
});
24+
25+
it('should show the Agents section', async () => {
26+
await overviewPage.agentSectionExistsOrFail();
27+
});
28+
29+
it('should show the Agent policies section', async () => {
30+
await overviewPage.agentPolicySectionExistsOrFail();
31+
});
32+
33+
it('should show the Data streams section', async () => {
34+
await overviewPage.datastreamSectionExistsOrFail();
35+
});
36+
});
37+
});
38+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { resolve } from 'path';
9+
import { FtrConfigProviderContext } from '@kbn/test/types/ftr';
10+
import { pageObjects } from './page_objects';
11+
import { services } from './services';
12+
13+
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
14+
const xpackFunctionalConfig = await readConfigFile(require.resolve('../functional/config.js'));
15+
16+
return {
17+
...xpackFunctionalConfig.getAll(),
18+
pageObjects,
19+
testFiles: [resolve(__dirname, './apps/fleet')],
20+
junit: {
21+
reportName: 'X-Pack Fleet Functional Tests',
22+
},
23+
services,
24+
apps: {
25+
...xpackFunctionalConfig.get('apps'),
26+
['fleet']: {
27+
pathname: '/app/fleet',
28+
},
29+
},
30+
kbnTestServer: {
31+
...xpackFunctionalConfig.get('kbnTestServer'),
32+
serverArgs: [
33+
...xpackFunctionalConfig.get('kbnTestServer.serverArgs'),
34+
'--xpack.fleet.enabled=true',
35+
],
36+
},
37+
layout: {
38+
fixedHeaderHeight: 200,
39+
},
40+
};
41+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { GenericFtrProviderContext } from '@kbn/test/types/ftr';
9+
10+
import { pageObjects } from './page_objects';
11+
import { services } from './services';
12+
13+
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { pageObjects as xpackFunctionalPageObjects } from '../../functional/page_objects';
9+
import { OverviewPage } from './overview_page';
10+
11+
export const pageObjects = {
12+
...xpackFunctionalPageObjects,
13+
overviewPage: OverviewPage,
14+
};
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import { FtrProviderContext } from '../ftr_provider_context';
9+
import { PLUGIN_ID } from '../../../plugins/fleet/common';
10+
11+
// NOTE: import path below should be the deep path to the actual module - else we get CI errors
12+
import { pagePathGetters } from '../../../plugins/fleet/public/applications/fleet/constants/page_paths';
13+
14+
export function OverviewPage({ getService, getPageObjects }: FtrProviderContext) {
15+
const pageObjects = getPageObjects(['common']);
16+
const testSubjects = getService('testSubjects');
17+
18+
return {
19+
async navigateToOverview() {
20+
await pageObjects.common.navigateToApp(PLUGIN_ID, {
21+
hash: pagePathGetters.overview(),
22+
});
23+
},
24+
25+
async integrationsSectionExistsOrFail() {
26+
await testSubjects.existOrFail('fleet-integrations-section');
27+
},
28+
29+
async agentPolicySectionExistsOrFail() {
30+
await testSubjects.existOrFail('fleet-agent-policy-section');
31+
},
32+
33+
async agentSectionExistsOrFail() {
34+
await testSubjects.existOrFail('fleet-agent-section');
35+
},
36+
37+
async datastreamSectionExistsOrFail() {
38+
await testSubjects.existOrFail('fleet-datastream-section');
39+
},
40+
};
41+
}

0 commit comments

Comments
 (0)