[Fleet] Bootstrap functional test suite (#91898)

This commit is contained in:
Zacqary Adam Xeper 2021-02-18 15:34:50 -06:00 committed by GitHub
parent da25d2753b
commit 0760bfb870
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 180 additions and 4 deletions

View file

@ -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',

View file

@ -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',

View file

@ -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',

View file

@ -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',

View 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'));
});
}

View 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();
});
});
});
}

View 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,
},
};
}

View 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>;

View 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,
};

View 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');
},
};
}

View 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,
};