mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[SECURITY SOLUTION][INGEST] Task/endpoint list tests (#69419)
endpoint func tests for endpoint details to ingest, edit datasource to policy, bug fix for security link
This commit is contained in:
parent
1d60c35a3f
commit
1daa2f4a54
10 changed files with 121 additions and 49 deletions
|
@ -242,7 +242,7 @@ export const EditDatasourcePage: React.FunctionComponent = () => {
|
|||
};
|
||||
|
||||
return (
|
||||
<CreateDatasourcePageLayout {...layoutProps}>
|
||||
<CreateDatasourcePageLayout {...layoutProps} data-test-subj="editDataSource">
|
||||
{isLoadingData ? (
|
||||
<Loading />
|
||||
) : loadingError || !agentConfig || !packageInfo ? (
|
||||
|
|
|
@ -489,6 +489,7 @@ export const AgentListPage: React.FunctionComponent<{}> = () => {
|
|||
<EuiSpacer size="m" />
|
||||
<EuiBasicTable<Agent>
|
||||
className="fleet__agentList__table"
|
||||
data-test-subj="fleetAgentListTable"
|
||||
loading={isLoading && agentsRequest.isInitialRequest}
|
||||
hasActions={true}
|
||||
noItemsMessage={
|
||||
|
|
|
@ -35,9 +35,13 @@ export const ConfigureEndpointDatasource = memo<CustomConfigureDatasourceContent
|
|||
<p>
|
||||
{from === 'edit' ? (
|
||||
<LinkToApp
|
||||
appId="securitySolution"
|
||||
data-test-subj="editLinkToPolicyDetails"
|
||||
appId="securitySolution:management"
|
||||
appPath={policyUrl}
|
||||
href={`${services.application.getUrlForApp('securitySolution')}${policyUrl}`}
|
||||
// Cannot use formalUrl here since the code is called in Ingest, which does not use redux
|
||||
href={`${services.application.getUrlForApp(
|
||||
'securitySolution:management'
|
||||
)}${policyUrl}`}
|
||||
>
|
||||
<FormattedMessage
|
||||
id="xpack.securitySolution.endpoint.ingestManager.editDatasource.stepConfigure"
|
||||
|
|
|
@ -26,7 +26,7 @@ import {
|
|||
import { InfraOpsSourceConfigurationProvider } from './infraops_source_configuration';
|
||||
import { InfraLogSourceConfigurationProvider } from './infra_log_source_configuration';
|
||||
import { MachineLearningProvider } from './ml';
|
||||
import { IngestManagerProvider } from './ingest_manager';
|
||||
import { IngestManagerProvider } from '../../common/services/ingest_manager';
|
||||
import { ResolverGeneratorProvider } from './resolver';
|
||||
import { TransformProvider } from './transform';
|
||||
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
*/
|
||||
|
||||
import { services as kibanaCommonServices } from '../../../../test/common/services';
|
||||
import { services as kibanaApiIntegrationServices } from '../../../../test/api_integration/services';
|
||||
|
||||
import { SpacesServiceProvider } from './spaces';
|
||||
|
||||
export const services = {
|
||||
...kibanaCommonServices,
|
||||
supertest: kibanaApiIntegrationServices.supertest,
|
||||
|
||||
spaces: SpacesServiceProvider,
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
import expect from '@kbn/expect';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
import { deleteMetadataStream } from '../../../api_integration/apis/endpoint/data_stream_helper';
|
||||
|
||||
export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
||||
const pageObjects = getPageObjects(['common', 'endpoint', 'header', 'endpointPageUtils']);
|
||||
|
@ -17,11 +18,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
this.tags('ciGroup7');
|
||||
const sleep = (ms = 100) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
before(async () => {
|
||||
await esArchiver.load('endpoint/metadata/api_feature');
|
||||
await esArchiver.load('endpoint/metadata/api_feature', { useCreate: true });
|
||||
await pageObjects.endpoint.navigateToEndpointList();
|
||||
});
|
||||
|
||||
it('finds title', async () => {
|
||||
it('finds page title', async () => {
|
||||
const title = await testSubjects.getVisibleText('pageViewHeaderLeftTitle');
|
||||
expect(title).to.equal('Endpoints');
|
||||
});
|
||||
|
@ -77,54 +78,61 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
expect(tableData).to.eql(expectedData);
|
||||
});
|
||||
|
||||
it('no details flyout when endpoint page displayed', async () => {
|
||||
it('does not show the details flyout initially', async () => {
|
||||
await testSubjects.missingOrFail('hostDetailsFlyout');
|
||||
});
|
||||
|
||||
it('display details flyout when the hostname is clicked on', async () => {
|
||||
await (await testSubjects.find('hostnameCellLink')).click();
|
||||
await testSubjects.existOrFail('hostDetailsUpperList');
|
||||
await testSubjects.existOrFail('hostDetailsLowerList');
|
||||
describe('when the hostname is clicked on,', () => {
|
||||
it('display the details flyout', async () => {
|
||||
await (await testSubjects.find('hostnameCellLink')).click();
|
||||
await testSubjects.existOrFail('hostDetailsUpperList');
|
||||
await testSubjects.existOrFail('hostDetailsLowerList');
|
||||
});
|
||||
|
||||
it('updates the details flyout when a new hostname is selected from the list', async () => {
|
||||
// display flyout for the first host in the list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[0].click();
|
||||
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
|
||||
const hostDetailTitle0 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
// select the 2nd host in the host list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
|
||||
await pageObjects.endpoint.waitForVisibleTextToChange(
|
||||
'hostDetailsFlyoutTitle',
|
||||
hostDetailTitle0
|
||||
);
|
||||
const hostDetailTitle1 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
expect(hostDetailTitle1).to.not.eql(hostDetailTitle0);
|
||||
});
|
||||
|
||||
it('has the same flyout info when the same hostname is selected', async () => {
|
||||
// display flyout for the first host in the list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
|
||||
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
|
||||
const hostDetailTitleInitial = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
// select the same host in the host list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
|
||||
await sleep(500); // give page time to refresh and verify it did not change
|
||||
const hostDetailTitleNew = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
expect(hostDetailTitleNew).to.equal(hostDetailTitleInitial);
|
||||
});
|
||||
|
||||
it('navigates to ingest fleet when the Reassign Policy link is clicked', async () => {
|
||||
await (await testSubjects.find('hostDetailsLinkToIngest')).click();
|
||||
await testSubjects.existOrFail('fleetAgentListTable');
|
||||
});
|
||||
});
|
||||
|
||||
it('update details flyout when new hostname is clicked on', async () => {
|
||||
// display flyout for the first host in the list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[0].click();
|
||||
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
|
||||
const hostDetailTitle0 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
// select the 2nd host in the host list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
|
||||
await pageObjects.endpoint.waitForVisibleTextToChange(
|
||||
'hostDetailsFlyoutTitle',
|
||||
hostDetailTitle0
|
||||
);
|
||||
const hostDetailTitle1 = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
expect(hostDetailTitle1).to.not.eql(hostDetailTitle0);
|
||||
});
|
||||
|
||||
it('details flyout remains the same when current hostname is clicked on', async () => {
|
||||
// display flyout for the first host in the list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
|
||||
await testSubjects.existOrFail('hostDetailsFlyoutTitle');
|
||||
const hostDetailTitleInitial = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
// select the same host in the host list
|
||||
await (await testSubjects.findAll('hostnameCellLink'))[1].click();
|
||||
await sleep(500); // give page time to refresh and verify it did not change
|
||||
const hostDetailTitleNew = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
|
||||
expect(hostDetailTitleNew).to.equal(hostDetailTitleInitial);
|
||||
});
|
||||
|
||||
describe('no data', () => {
|
||||
describe('when there is no data,', () => {
|
||||
before(async () => {
|
||||
// clear out the data and reload the page
|
||||
await esArchiver.unload('endpoint/metadata/api_feature');
|
||||
await deleteMetadataStream(getService);
|
||||
await pageObjects.endpoint.navigateToEndpointList();
|
||||
});
|
||||
after(async () => {
|
||||
// reload the data so the other tests continue to pass
|
||||
await esArchiver.load('endpoint/metadata/api_feature');
|
||||
await esArchiver.load('endpoint/metadata/api_feature', { useCreate: true });
|
||||
});
|
||||
it('displays no items found when empty', async () => {
|
||||
it('displays No items found when empty', async () => {
|
||||
// get the endpoint list table data and verify message
|
||||
const [, [noItemsFoundMessage]] = await pageObjects.endpointPageUtils.tableData(
|
||||
'hostListTable'
|
||||
|
@ -166,7 +174,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
'Windows 10',
|
||||
'',
|
||||
'0',
|
||||
'00000000-0000-0000-0000-000000000000',
|
||||
'Default',
|
||||
'Unknown',
|
||||
'10.101.149.262606:a000:ffc0:39:11ef:37b9:3371:578c',
|
||||
'rezzani-7.example.com',
|
||||
|
@ -175,7 +183,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
|
|||
});
|
||||
});
|
||||
after(async () => {
|
||||
await esArchiver.unload('endpoint/metadata/api_feature');
|
||||
await deleteMetadataStream(getService);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -9,7 +9,13 @@ import { FtrProviderContext } from '../../ftr_provider_context';
|
|||
import { PolicyTestResourceInfo } from '../../services/endpoint_policy';
|
||||
|
||||
export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
||||
const pageObjects = getPageObjects(['common', 'endpoint', 'policy', 'endpointPageUtils']);
|
||||
const pageObjects = getPageObjects([
|
||||
'common',
|
||||
'endpoint',
|
||||
'policy',
|
||||
'endpointPageUtils',
|
||||
'ingestManagerCreateDatasource',
|
||||
]);
|
||||
const testSubjects = getService('testSubjects');
|
||||
const policyTestResources = getService('policyTestResources');
|
||||
|
||||
|
@ -185,5 +191,38 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when on Ingest Configurations Edit Datasource page', async () => {
|
||||
let policyInfo: PolicyTestResourceInfo;
|
||||
beforeEach(async () => {
|
||||
// Create a policy and navigate to Ingest app
|
||||
policyInfo = await policyTestResources.createPolicy();
|
||||
await pageObjects.ingestManagerCreateDatasource.navigateToAgentConfigEditDatasource(
|
||||
policyInfo.agentConfig.id,
|
||||
policyInfo.datasource.id
|
||||
);
|
||||
});
|
||||
afterEach(async () => {
|
||||
if (policyInfo) {
|
||||
await policyInfo.cleanup();
|
||||
}
|
||||
});
|
||||
it('should show a link to Policy Details', async () => {
|
||||
await testSubjects.existOrFail('editLinkToPolicyDetails');
|
||||
});
|
||||
it('should navigate to Policy Details when the link is clicked', async () => {
|
||||
const linkToPolicy = await testSubjects.find('editLinkToPolicyDetails');
|
||||
await linkToPolicy.click();
|
||||
await pageObjects.policy.ensureIsOnDetailsPage();
|
||||
});
|
||||
it('should allow the user to navigate, edit and save Policy Details', async () => {
|
||||
await (await testSubjects.find('editLinkToPolicyDetails')).click();
|
||||
await pageObjects.policy.ensureIsOnDetailsPage();
|
||||
await pageObjects.endpointPageUtils.clickOnEuiCheckbox('policyWindowsEvent_dns');
|
||||
await pageObjects.policy.confirmAndSave();
|
||||
|
||||
await testSubjects.existOrFail('policyDetailsSuccessMessage');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
export function IngestManagerCreateDatasource({ getService }: FtrProviderContext) {
|
||||
export function IngestManagerCreateDatasource({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const testSubjects = getService('testSubjects');
|
||||
const find = getService('find');
|
||||
const pageObjects = getPageObjects(['common']);
|
||||
|
||||
return {
|
||||
/**
|
||||
* Validates that the page shown is the Datasource Craete Page
|
||||
* Validates that the page shown is the Datasource Create Page
|
||||
*/
|
||||
async ensureOnCreatePageOrFail() {
|
||||
await testSubjects.existOrFail('createDataSource_header');
|
||||
|
@ -75,5 +76,22 @@ export function IngestManagerCreateDatasource({ getService }: FtrProviderContext
|
|||
async waitForSaveSuccessNotification() {
|
||||
await testSubjects.existOrFail('datasourceCreateSuccessToast');
|
||||
},
|
||||
|
||||
/**
|
||||
* Validates that the page shown is the Datasource Edit Page
|
||||
*/
|
||||
async ensureOnEditPageOrFail() {
|
||||
await testSubjects.existOrFail('editDataSource_header');
|
||||
},
|
||||
|
||||
/**
|
||||
* Navigates to the Ingest Agent configuration Edit Datasource page
|
||||
*/
|
||||
async navigateToAgentConfigEditDatasource(agentConfigId: string, datasourceId: string) {
|
||||
await pageObjects.common.navigateToApp('ingestManager', {
|
||||
hash: `/configs/${agentConfigId}/edit-datasource/${datasourceId}`,
|
||||
});
|
||||
await this.ensureOnEditPageOrFail();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
import { services as apiIntegrationServices } from '../../api_integration/services';
|
||||
import { services as xPackFunctionalServices } from '../../functional/services';
|
||||
import { EndpointPolicyTestResourcesProvider } from './endpoint_policy';
|
||||
import { IngestManagerProvider } from '../../common/services/ingest_manager';
|
||||
|
||||
export const services = {
|
||||
...xPackFunctionalServices,
|
||||
ingestManager: apiIntegrationServices.ingestManager,
|
||||
policyTestResources: EndpointPolicyTestResourcesProvider,
|
||||
ingestManager: IngestManagerProvider,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue