Skip to content

Commit

Permalink
[7.x] [Endpoint] Functional Tests cleanup (#68756) (#68822)
Browse files Browse the repository at this point in the history
* [Endpoint] Functional Tests cleanup (#68756)

* Removed several unnecessary disabled eslint rules
* moved common pageobject from endpoint_list to page_utils
* Rename functional_endpoint to security_solution_endpoint
* Delete `functional_endpoint_ingest_failure` no longer applicable

# Conflicts:
#	.github/CODEOWNERS
#	x-pack/test/security_solution_endpoint/apps/endpoint/resolver.ts

* Sync Endpoint Alerts page objects with master

- PR #64704 was never
  backported, thus this change is needed to ensure build is
  successful.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
paul-tavares and elasticmachine committed Jun 12, 2020
1 parent bd980f8 commit 521493f
Show file tree
Hide file tree
Showing 26 changed files with 473 additions and 198 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export const ManagementPageView = memo<Omit<PageViewProps, 'tabs'>>((options) =>
href: getManagementUrl({ name: 'policyList' }),
},
];
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tabName]);
}, [options.viewType, tabName]);
return <PageView {...options} tabs={tabs} />;
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,14 @@ export const HostDetails = memo(({ details }: { details: HostMetadata }) => {
description: details.agent.version,
},
];
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [
details.agent.version,
details.endpoint.policy.id,
details.host.hostname,
details.host.ip,
policyResponseUri.search,
policyStatusClickHandler,
details.host.hostname,
details.agent.version,
policyStatus,
policyResponseUri,
policyStatusClickHandler,
]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,5 @@ export const mockManagementState: Immutable<ManagementState> = {
export const managementReducer = immutableCombineReducers({
[MANAGEMENT_STORE_POLICY_LIST_NAMESPACE]: policyListReducer,
[MANAGEMENT_STORE_POLICY_DETAILS_NAMESPACE]: policyDetailsReducer,
// @ts-ignore
[MANAGEMENT_STORE_ENDPOINTS_NAMESPACE]: hostListReducer,
});
2 changes: 1 addition & 1 deletion x-pack/scripts/functional_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require('@kbn/plugin-helpers').babelRegister();

require('@kbn/test').runTestsCli([
require.resolve('../test/functional/config.js'),
require.resolve('../test/functional_endpoint/config.ts'),
require.resolve('../test/security_solution_endpoint/config.ts'),
require.resolve('../test/functional_with_es_ssl/config.ts'),
require.resolve('../test/functional/config_security_basic.ts'),
require.resolve('../test/functional/config_security_trial.ts'),
Expand Down

This file was deleted.

30 changes: 0 additions & 30 deletions x-pack/test/functional_endpoint/page_objects/page_utils.ts

This file was deleted.

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions x-pack/test/functional_endpoint_ingest_failure/config.ts

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion x-pack/test/plugin_functional/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { pageObjects } from './page_objects';
/* eslint-disable import/no-default-export */
export default async function ({ readConfigFile }: FtrConfigProviderContext) {
const xpackFunctionalConfig = await readConfigFile(
require.resolve('../functional_endpoint/config.ts')
require.resolve('../security_solution_endpoint/config.ts')
);

// Find all folders in ./plugins since we treat all them as plugin folder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default ({ getPageObjects, getService }: FtrProviderContext) => {
const pageObjects = getPageObjects(['common', 'endpoint', 'header']);
const pageObjects = getPageObjects(['common', 'endpoint', 'header', 'endpointPageUtils']);
const esArchiver = getService('esArchiver');
const testSubjects = getService('testSubjects');

Expand Down Expand Up @@ -73,7 +73,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
'Jan 24, 2020 @ 16:06:09.541',
],
];
const tableData = await pageObjects.endpoint.getEndpointAppTableData('hostListTable');
const tableData = await pageObjects.endpointPageUtils.tableData('hostListTable');
expect(tableData).to.eql(expectedData);
});

Expand Down Expand Up @@ -126,7 +126,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
});
it('displays no items found when empty', async () => {
// get the endpoint list table data and verify message
const [, [noItemsFoundMessage]] = await pageObjects.endpoint.getEndpointAppTableData(
const [, [noItemsFoundMessage]] = await pageObjects.endpointPageUtils.tableData(
'hostListTable'
);
expect(noItemsFoundMessage).to.equal('No items found');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
import { PolicyTestResourceInfo } from '../../services/endpoint_policy';

export default function ({ getPageObjects, getService }: FtrProviderContext) {
const pageObjects = getPageObjects(['common', 'endpoint', 'policy']);
const pageObjects = getPageObjects(['common', 'endpoint', 'policy', 'endpointPageUtils']);
const testSubjects = getService('testSubjects');
const policyTestResources = getService('policyTestResources');
const RELATIVE_DATE_FORMAT = /\d (?:seconds|minutes) ago/i;
Expand All @@ -31,7 +31,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
expect(policyTotal).to.equal('0 Policies');
});
it('has correct table headers', async () => {
const allHeaderCells = await pageObjects.endpoint.tableHeaderVisibleText('policyTable');
const allHeaderCells = await pageObjects.endpointPageUtils.tableHeaderVisibleText(
'policyTable'
);
expect(allHeaderCells).to.eql([
'Policy Name',
'Created By',
Expand All @@ -43,7 +45,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
]);
});
it('should show empty table results message', async () => {
const [, [noItemsFoundMessage]] = await pageObjects.endpoint.getEndpointAppTableData(
const [, [noItemsFoundMessage]] = await pageObjects.endpointPageUtils.tableData(
'policyTable'
);
expect(noItemsFoundMessage).to.equal('No items found');
Expand All @@ -65,7 +67,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
});

it('should show policy on the list', async () => {
const [, policyRow] = await pageObjects.endpoint.getEndpointAppTableData('policyTable');
const [, policyRow] = await pageObjects.endpointPageUtils.tableData('policyTable');
// Validate row data with the exception of the Date columns - since those are initially
// shown as relative.
expect([policyRow[0], policyRow[1], policyRow[3], policyRow[5], policyRow[6]]).to.eql([
Expand Down
Loading

0 comments on commit 521493f

Please sign in to comment.