From 5ea93d2e3c077f9cad78f8176a903ced7ceea62e Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Wed, 1 Dec 2021 16:07:16 -0500 Subject: [PATCH] 18123: Add tests for disabling actions on built-in groups. Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- cypress/integration/group-manage.spec.js | 25 +++++++++++++++++++ .../data-explorer/renderers.tsx | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/cypress/integration/group-manage.spec.js b/cypress/integration/group-manage.spec.js index c187320c..d17cefe9 100644 --- a/cypress/integration/group-manage.spec.js +++ b/cypress/integration/group-manage.spec.js @@ -236,4 +236,29 @@ describe('Group manage tests', function() { .should('not.contain', groupName + ' (renamed)'); }); + it('disables group-related controls for built-in groups', function() { + cy.loginAs(adminUser); + + ['All users', 'Anonymous users', 'System group'].forEach((builtInGroup) => { + cy.get('[data-cy=side-panel-tree]').contains('Groups').click(); + cy.get('[data-cy=groups-panel-data-explorer]').contains(builtInGroup).click(); + + // Check group member actions + cy.get('[data-cy=group-members-data-explorer]') + .within(() => { + cy.get('[data-cy=group-member-add]').should('not.exist'); + cy.get('[data-cy=user-hidden-checkbox] input').should('be.disabled'); + cy.get('[data-cy=resource-delete-button]').should('be.disabled'); + cy.get('[data-cy=edit-permission-button]').should('not.exist'); + }); + + // Check permissions actions + cy.get('[data-cy=group-details-permissions-tab]').click(); + cy.get('[data-cy=group-permissions-data-explorer]').within(() => { + cy.get('[data-cy=resource-delete-button]').should('be.disabled'); + cy.get('[data-cy=edit-permission-button]').should('not.exist'); + }); + }); + }); + }); diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index 5040746a..84d5c569 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -463,7 +463,7 @@ const renderPermissionLevel = (dispatch: Dispatch, link: LinkResource, canManage return {formatPermissionLevel(link.name as PermissionLevel)} {canManage ? - dispatch(openPermissionEditContextMenu(event, link))}> + dispatch(openPermissionEditContextMenu(event, link))}> : '' -- 2.30.2