Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const EditDatasourcePage: React.FunctionComponent = () => {
};

return (
<CreateDatasourcePageLayout {...layoutProps}>
<CreateDatasourcePageLayout {...layoutProps} data-test-subj="editDataSource">
{isLoadingData ? (
<Loading />
) : loadingError || !agentConfig || !packageInfo ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/api_integration/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
2 changes: 2 additions & 0 deletions x-pack/test/common/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you make these changes or was it from a master merge?

If you did - would like to know why we had to change the common services. was this because the API tests needed supertest? even then - adding it here impacts everyone, so not sure we want to do it this way

Copy link
Contributor Author

@parkiino parkiino Jun 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was a master merge. i just moved this file out of test/api_integrations/services and then imported this file into the test/api_integrations/services/index hopefully thats ok?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to clarify, i needed to add this import since the ingest manager service needs supertest after the merge from master. I moved the file from api_integration/services/ingest_manager to common/services/ingest_manager since api_integration is using ingest and so is security_solution_endpoint. i could also just add that import directly to the ingest_manager service file, if you think thats better

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you - now I understand. I guess for Endpoint UI Functional, we did not have to do that because we import the services from x-pack/test/functional/ which (my guess) is already brings that service in.
Anyway 🙏


spaces: SpacesServiceProvider,
};
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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');
});
Expand Down Expand Up @@ -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('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('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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was being skipped, before right? sleep() in tests make me a bit nervous, just wanna make sure this is run enough times to ensure this isn't flaky

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kevinlog The entire suite is being skipped (see describe on line 17), so I think we're goo for now. @charlie-pichette will take care of fixing the flakiness

const hostDetailTitleNew = await testSubjects.getVisibleText('hostDetailsFlyoutTitle');
expect(hostDetailTitleNew).to.equal(hostDetailTitleInitial);
});

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);
it('navigates to ingest fleet when the Reassign Policy link is clicked', async () => {
await (await testSubjects.find('hostDetailsLinkToIngest')).click();
await testSubjects.existOrFail('fleetAgentListTable');
});
});

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'
Expand Down Expand Up @@ -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',
Expand All @@ -175,7 +183,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
});
after(async () => {
await esArchiver.unload('endpoint/metadata/api_feature');
await deleteMetadataStream(getService);
});
});
};
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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');
});
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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 changes: 2 additions & 2 deletions x-pack/test/security_solution_endpoint/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};