Skip to content

Commit

Permalink
tests for SOC Manager, Platform Engineer and Endpoint Operations Manager
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-tavares committed Jul 25, 2023
1 parent d143f27 commit 63af698
Showing 1 changed file with 64 additions and 27 deletions.
Expand Up @@ -12,11 +12,13 @@ import {
getEndpointManagementPageList,
getEndpointManagementPageMap,
} from '../../../lib';
import { getNoPrivilegesPage } from '../../../screens/endpoint_management/common';
import {
getNoPrivilegesPage,
visitEndpointList,
getArtifactListEmptyStateAddButton,
} from '../../../screens/endpoint_management';
import { ensurePermissionDeniedScreen, visitFleetAgentList } from '../../../screens';
import { visitEndpointList } from '../../../screens/endpoint_management/endpoint_list';
import { ServerlessRoleName } from '../../../../../../../shared/lib';
import { getArtifactListEmptyStateAddButton } from '../../../screens/endpoint_management/artifacts';
import { visitPolicyList } from '../../../screens/endpoint_management';

describe(
Expand Down Expand Up @@ -181,39 +183,74 @@ describe(
});

describe('for role: soc_manager', () => {
const artifactPagesFullAccess = [
pageById.trustedApps,
pageById.eventFilters,
pageById.blocklist,
pageById.hostIsolationExceptions,
];
const grantedAccessPages = [pageById.endpointList, pageById.policyList];

before(() => {
login('soc_manager');
});

// FIXME:PT implement
it('should do something', () => {});
});

describe('for role: detections_admin', () => {
before(() => {
login('detections_admin');
});
for (const { id, url, title } of artifactPagesFullAccess) {
it(`should have CRUD access to: ${title}`, () => {
cy.visit(url);
getArtifactListEmptyStateAddButton(id as EndpointArtifactPageId).should('exist');
});
}

// FIXME:PT implement
it('should do something', () => {});
});
for (const { url, title } of grantedAccessPages) {
it(`should have access to: ${title}`, () => {
cy.visit(url);
getNoPrivilegesPage().should('not.exist');
});
}

describe('for role: platform_engineer', () => {
before(() => {
login('platform_engineer');
it('should NOT have access to Fleet', () => {
visitFleetAgentList();
ensurePermissionDeniedScreen();
});

// FIXME:PT implement
it('should do something', () => {});
});

describe('for role: endpoint_operations_manager', () => {
before(() => {
login('endpoint_operations_manager');
});
// Endpoint Operations Manager and Platform Engineer currently have the same level of access
(['platform_engineer', `endpoint_operations_manager`] as ServerlessRoleName[]).forEach(
(roleName) => {
describe(`for role: ${roleName}`, () => {
const artifactPagesFullAccess = [
pageById.trustedApps,
pageById.eventFilters,
pageById.blocklist,
pageById.hostIsolationExceptions,
];
const grantedAccessPages = [pageById.endpointList, pageById.policyList];

before(() => {
login('platform_engineer');
});

// FIXME:PT implement
it('should do something', () => {});
});
for (const { id, url, title } of artifactPagesFullAccess) {
it(`should have CRUD access to: ${title}`, () => {
cy.visit(url);
getArtifactListEmptyStateAddButton(id as EndpointArtifactPageId).should('exist');
});
}

for (const { url, title } of grantedAccessPages) {
it(`should have access to: ${title}`, () => {
cy.visit(url);
getNoPrivilegesPage().should('not.exist');
});
}

it('should have access to Fleet', () => {
visitFleetAgentList();
ensurePermissionDeniedScreen();
});
});
}
);
}
);

0 comments on commit 63af698

Please sign in to comment.