Skip to content

Commit

Permalink
Fix sserverless role names
Browse files Browse the repository at this point in the history
  • Loading branch information
Ikuni17 committed Sep 28, 2023
1 parent 432e7b7 commit 2590b82
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { ServerlessRoleName } from '../../../../../../../shared/lib';
import { login } from '../../../tasks/login';
import { getNoPrivilegesPage } from '../../../screens/endpoint_management/common';
import { getEndpointManagementPageList } from '../../../screens/endpoint_management';
Expand All @@ -30,7 +31,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
login(ServerlessRoleName.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 @@ -6,6 +6,7 @@
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { ServerlessRoleName } from '../../../../../../../shared/lib';
import { login } from '../../../tasks/login';
import { getAgentListTable, visitFleetAgentList } from '../../../screens';
import { getEndpointManagementPageList } from '../../../screens/endpoint_management';
Expand All @@ -29,7 +30,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
login(ServerlessRoleName.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 @@ -6,6 +6,7 @@
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { ServerlessRoleName } from '../../../../../../../shared/lib';
import { login } from '../../../tasks/login';
import { getNoPrivilegesPage } from '../../../screens/endpoint_management/common';
import { ensureResponseActionAuthzAccess } from '../../../tasks/endpoint_management';
Expand All @@ -32,7 +33,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
login(ServerlessRoleName.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 @@ -6,6 +6,7 @@
*/

import { RESPONSE_ACTION_API_COMMANDS_NAMES } from '@kbn/security-solution-plugin/common/endpoint/service/response_actions/constants';
import { ServerlessRoleName } from '../../../../../../../shared/lib';
import { login } from '../../../tasks/login';
import { getAgentListTable, visitFleetAgentList } from '../../../screens';
import { getEndpointManagementPageMap } from '../../../screens/endpoint_management';
Expand Down Expand Up @@ -37,7 +38,7 @@ describe(
let password: string;

beforeEach(() => {
login('endpoint_operations_analyst').then((response) => {
login(ServerlessRoleName.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 @@ -130,7 +130,7 @@ describe(
const deniedResponseActions = pick(consoleHelpPanelResponseActionsTestSubj, 'execute');

beforeEach(() => {
login('t3_analyst');
login(ServerlessRoleName.T3_ANALYST);
});

it('should have access to Endpoint list page', () => {
Expand Down Expand Up @@ -182,7 +182,7 @@ describe(
const deniedPages = allPages.filter(({ id }) => id !== 'blocklist' && id !== 'endpointList');

beforeEach(() => {
login('threat_intelligence_analyst');
login(ServerlessRoleName.THREAT_INTELLIGENCE_ANALYST);
});

it('should have access to Endpoint list page', () => {
Expand Down Expand Up @@ -227,7 +227,7 @@ describe(
];

beforeEach(() => {
login('rule_author');
login(ServerlessRoleName.RULE_AUTHOR);
});

for (const { id, title } of artifactPagesFullAccess) {
Expand Down Expand Up @@ -278,7 +278,7 @@ describe(
const grantedAccessPages = [pageById.endpointList, pageById.policyList];

beforeEach(() => {
login('soc_manager');
login(ServerlessRoleName.SOC_MANAGER);
});

for (const { id, title } of artifactPagesFullAccess) {
Expand Down Expand Up @@ -325,7 +325,7 @@ describe(
const grantedAccessPages = [pageById.endpointList, pageById.policyList];

beforeEach(() => {
login('endpoint_operations_analyst');
login(ServerlessRoleName.ENDPOINT_OPERATIONS_ANALYST);
});

for (const { id, title } of artifactPagesFullAccess) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { request } from '@kbn/security-solution-plugin/public/management/cypress/tasks/common';
import { isLocalhost } from '@kbn/security-solution-plugin/scripts/endpoint/common/is_localhost';
import type { ServerlessRoleName } from '../../../../../shared/lib';
import { ServerlessRoleName as RoleName } from '../../../../../shared/lib/security/types';
import { STANDARD_HTTP_HEADERS } from '../../../../../shared/lib/security/default_http_headers';

/**
Expand Down Expand Up @@ -65,7 +66,7 @@ interface CyLoginTask {
* @param user Defaults to `soc_manager`
*/
export const login: CyLoginTask = (
user: ServerlessRoleName | 'elastic' = 'soc_manager'
user: ServerlessRoleName | 'elastic' = RoleName.SOC_MANAGER
): ReturnType<typeof sendApiLoginRequest> => {
let username = Cypress.env('KIBANA_USERNAME');
let password = Cypress.env('KIBANA_PASSWORD');
Expand Down

0 comments on commit 2590b82

Please sign in to comment.