Skip to content

Commit

Permalink
[Security Solution][Endpoint] Move endpoint management serverless spe…
Browse files Browse the repository at this point in the history
…cific tests (#166669)

## Summary


- Moves the Serverless Endpoint Management tests from
`x-pack/test_serverless/functional/test_suites/security/cypress` to
`x-pack/plugins/security_solution/public/management/cypress` along with
its set of supporting `screens` and `task`'s
- This work is in preparation for enabling tests to be run in a
serverless environment

> ❗❗  NOTE
> Tests for serverless are not currently running. The kibana core team
is working on providing serverless users that have serverless security
roles assigned to them for testing. Also, an effort in underway to also
use a tagging approach to define which existing tests should run in
serverless.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
paul-tavares and kibanamachine authored Sep 20, 2023
1 parent 3f3a27b commit 23b2f3b
Show file tree
Hide file tree
Showing 37 changed files with 444 additions and 383 deletions.
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -1320,9 +1320,6 @@ x-pack/plugins/cloud_integrations/cloud_full_story/server/config.ts @elastic/kib
/x-pack/test/security_solution_endpoint/ @elastic/security-defend-workflows
/x-pack/test/security_solution_endpoint_api_int/ @elastic/security-defend-workflows
/x-pack/test_serverless/shared/lib/security/kibana_roles/ @elastic/security-defend-workflows
/x-pack/test_serverless/functional/test_suites/security/cypress/e2e/endpoint_management @elastic/security-defend-workflows
/x-pack/test_serverless/functional/test_suites/security/cypress/screens/endpoint_management @elastic/security-defend-workflows
/x-pack/test_serverless/functional/test_suites/security/cypress/tasks/endpoint_management @elastic/security-defend-workflows
/x-pack/plugins/security_solution_serverless/public/upselling/sections/endpoint_management @elastic/security-defend-workflows
/x-pack/plugins/security_solution_serverless/server/endpoint @elastic/security-defend-workflows

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/osquery/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export {};
import 'cypress-react-selector';
import registerCypressGrep from '@cypress/grep';

import type { ServerlessRoleName } from './roles';
import { login } from '../../../../test_serverless/functional/test_suites/security/cypress/tasks/login';
import type { ServerlessRoleName } from './roles';

registerCypressGrep();

Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/osquery/cypress/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@
},
"@kbn/security-solution-plugin",
"@kbn/fleet-plugin",
"@kbn/cases-plugin"
"@kbn/cases-plugin",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
*/

import type { Agent } from '@kbn/fleet-plugin/common';
import {
AGENT_HOSTNAME_CELL,
AGENT_POLICY_CELL,
TABLE_ROW_ACTIONS,
TABLE_ROW_ACTIONS_MENU,
} from '../../screens';
import type { PolicyData } from '../../../../../common/endpoint/types';
import { APP_ENDPOINTS_PATH } from '../../../../../common/constants';
import {
Expand All @@ -17,16 +23,10 @@ import {
import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy';
import { login } from '../../tasks/login';
import { loadPage } from '../../tasks/common';
import {
AGENT_HOSTNAME_CELL,
TABLE_ROW_ACTIONS,
TABLE_ROW_ACTIONS_MENU,
AGENT_POLICY_CELL,
} from '../../screens/endpoints';
import {
FLEET_REASSIGN_POLICY_MODAL,
FLEET_REASSIGN_POLICY_MODAL_CONFIRM_BUTTON,
} from '../../screens/fleet';
} from '../../screens/fleet/agent_details';
import type { CreateAndEnrollEndpointHostResponse } from '../../../../../scripts/endpoint/common/endpoint_host_services';
import { createEndpointHost } from '../../tasks/create_endpoint_host';
import { deleteAllLoadedEndpointData } from '../../tasks/delete_all_endpoint_data';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* 2.0.
*/

import { navigateToEndpointPolicyResponse } from '../../screens';
import type { CyIndexEndpointHosts } from '../../tasks/index_endpoint_hosts';
import { indexEndpointHosts } from '../../tasks/index_endpoint_hosts';
import { navigateToEndpointPolicyResponse } from '../../screens/endpoints';
import type { HostMetadata } from '../../../../../common/endpoint/types';
import type { IndexedEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_endpoint_policy_response';
import { login } from '../../tasks/login';
import { navigateToFleetAgentDetails } from '../../screens/fleet';
import { navigateToFleetAgentDetails } from '../../screens/fleet/agent_details';
import { EndpointPolicyResponseGenerator } from '../../../../../common/endpoint/data_generators/endpoint_policy_response_generator';
import { descriptions } from '../../../components/policy_response/policy_response_friendly_names';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Serverless only test

Directory contains tests that are only applicable to serverless.
Any other type of tests should be placed instead into the `./endpoint` directory or `./mocked_data` directories and tagged appropriately


Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
* 2.0.
*/

import { login } from '../../tasks/login';
import type { CyIndexEndpointHosts } from '../../tasks/index_endpoint_hosts';
import { indexEndpointHosts } from '../../tasks/index_endpoint_hosts';
import { loginServerless } from '../../tasks/login_serverless';
import {
getConsoleActionMenuItem,
getUnIsolateActionMenuItem,
openRowActionMenu,
visitEndpointList,
} from '../../screens/endpoint_management';
import {
CyIndexEndpointHosts,
indexEndpointHosts,
} from '../../tasks/endpoint_management/index_endpoint_hosts';
} from '../../screens';

describe(
'When on the Endpoint List in Security Essentials PLI',
Expand Down Expand Up @@ -43,7 +41,7 @@ describe(
});

beforeEach(() => {
login();
loginServerless();
visitEndpointList();
openRowActionMenu();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* 2.0.
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { login } from '../../../tasks/login';
import { getNoPrivilegesPage } from '../../../screens/endpoint_management/common';
import { getEndpointManagementPageList } from '../../../screens/endpoint_management';
import { ensureResponseActionAuthzAccess } from '../../../tasks/endpoint_management';
import { ensureResponseActionAuthzAccess } from '../../../tasks/response_actions';
import { loginServerless, ServerlessUser } from '../../../tasks/login_serverless';
import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '../../../../../../common/endpoint/service/response_actions/constants';
import { getNoPrivilegesPage } from '../../../screens/common';
import { getEndpointManagementPageList } from '../../../screens';

describe(
'App Features for Security Complete PLI',
Expand All @@ -30,7 +30,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
loginServerless(ServerlessUser.ENDPOINT_OPERATIONS_ANALYST).then((response) => {
username = response.username;
password = response.password;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
* 2.0.
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { login } from '../../../tasks/login';
import { getAgentListTable, visitFleetAgentList } from '../../../screens';
import { getEndpointManagementPageList } from '../../../screens/endpoint_management';
import { ensureResponseActionAuthzAccess } from '../../../tasks/endpoint_management';
import { ensureResponseActionAuthzAccess } from '../../../tasks/response_actions';
import { loginServerless, ServerlessUser } from '../../../tasks/login_serverless';
import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '../../../../../../common/endpoint/service/response_actions/constants';
import {
getEndpointManagementPageList,
getFleetAgentListTable,
visitFleetAgentList,
} from '../../../screens';

describe(
'App Features for Security Complete PLI with Endpoint Complete Addon',
Expand All @@ -29,7 +32,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
loginServerless(ServerlessUser.ENDPOINT_OPERATIONS_ANALYST).then((response) => {
username = response.username;
password = response.password;
});
Expand All @@ -50,7 +53,7 @@ describe(

it(`should have access to Fleet`, () => {
visitFleetAgentList();
getAgentListTable().should('exist');
getFleetAgentListTable().should('exist');
});
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* 2.0.
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { login } from '../../../tasks/login';
import { getNoPrivilegesPage } from '../../../screens/endpoint_management/common';
import { ensureResponseActionAuthzAccess } from '../../../tasks/endpoint_management';
import { getEndpointManagementPageList } from '../../../screens/endpoint_management';
import { ensureResponseActionAuthzAccess } from '../../../tasks/response_actions';
import { loginServerless, ServerlessUser } from '../../../tasks/login_serverless';
import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '../../../../../../common/endpoint/service/response_actions/constants';
import { getNoPrivilegesPage } from '../../../screens/common';
import { getEndpointManagementPageList } from '../../../screens';

describe(
'App Features for Security Essential PLI',
Expand All @@ -32,7 +32,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
loginServerless(ServerlessUser.ENDPOINT_OPERATIONS_ANALYST).then((response) => {
username = response.username;
password = response.password;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
* 2.0.
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { login } from '../../../tasks/login';
import { getAgentListTable, visitFleetAgentList } from '../../../screens';
import { getEndpointManagementPageMap } from '../../../screens/endpoint_management';
import { ensureResponseActionAuthzAccess } from '../../../tasks/endpoint_management';
import { ensureResponseActionAuthzAccess } from '../../../tasks/response_actions';
import { loginServerless, ServerlessUser } from '../../../tasks/login_serverless';
import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '../../../../../../common/endpoint/service/response_actions/constants';
import {
getEndpointManagementPageMap,
getFleetAgentListTable,
visitFleetAgentList,
} from '../../../screens';

describe(
'App Features for Security Essentials PLI with Endpoint Essentials Addon',
Expand Down Expand Up @@ -37,7 +40,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
loginServerless(ServerlessUser.ENDPOINT_OPERATIONS_ANALYST).then((response) => {
username = response.username;
password = response.password;
});
Expand Down Expand Up @@ -71,7 +74,7 @@ describe(

it(`should have access to Fleet`, () => {
visitFleetAgentList();
getAgentListTable().should('exist');
getFleetAgentListTable().should('exist');
});
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* 2.0.
*/

import { IndexedFleetEndpointPolicyResponse } from '@kbn/security-solution-plugin/common/endpoint/data_loaders/index_fleet_endpoint_policy';
import { login } from '../../tasks/login';
import { visitPolicyDetails } from '../../screens/endpoint_management/policy_details';
import { loginServerless } from '../../tasks/login_serverless';
import { visitPolicyDetailsPage } from '../../screens/policy_details';
import type { IndexedFleetEndpointPolicyResponse } from '../../../../../common/endpoint/data_loaders/index_fleet_endpoint_policy';

describe(
'When displaying the Policy Details in Security Essentials PLI',
Expand All @@ -34,8 +34,8 @@ describe(
});

beforeEach(() => {
login();
visitPolicyDetails(loadedPolicyData.integrationPolicies[0].id);
loginServerless();
visitPolicyDetailsPage(loadedPolicyData.integrationPolicies[0].id);
});

it('should display upselling section for protections', () => {
Expand Down
Loading

0 comments on commit 23b2f3b

Please sign in to comment.