X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/103a2d417eb9dfae62cb72385de5e8d836bb15e9..4a917782a054773c2cb72f3ee364e2c0b02643e9:/cypress/integration/group-manage.spec.js diff --git a/cypress/integration/group-manage.spec.js b/cypress/integration/group-manage.spec.js index 8f6300336b..c187320ce4 100644 --- a/cypress/integration/group-manage.spec.js +++ b/cypress/integration/group-manage.spec.js @@ -6,6 +6,7 @@ describe('Group manage tests', function() { let activeUser; let adminUser; let otherUser; + const groupName = `Test group (${Math.floor(999999 * Math.random())})`; before(function() { // Only set up common users once. These aren't set up as aliases because @@ -35,7 +36,6 @@ describe('Group manage tests', function() { }); it('creates a new group', function() { - const groupName = `Test group (${Math.floor(999999 * Math.random())})`; cy.loginAs(activeUser); // Navigate to Groups @@ -93,16 +93,9 @@ describe('Group manage tests', function() { cy.get('button').click(); }); }); - cy.get('[data-cy=form-dialog]') - .should('contain', 'Edit permission') - .within(() => { - cy.contains('Read').click(); - }); - cy.get('li span') + cy.get('[data-cy=context-menu]') .contains('Write') - .parents('li') .click(); - cy.get('[data-cy=form-dialog] button[type=submit]').click(); cy.get('[data-cy=group-members-data-explorer]') .contains('Other User') .parents('tr') @@ -111,7 +104,83 @@ describe('Group manage tests', function() { }); }); + it('can unhide and re-hide users', function() { + // Must use admin user to have manage permission on user + cy.loginAs(adminUser); + cy.get('[data-cy=side-panel-tree]').contains('Groups').click(); + cy.get('[data-cy=groups-panel-data-explorer]').contains(groupName).click(); + + // Check that other user is hidden + cy.get('[data-cy=group-details-permissions-tab]').click(); + cy.get('[data-cy=group-permissions-data-explorer]') + .should('not.contain', 'Other User') + cy.get('[data-cy=group-details-members-tab]').click(); + + // Test unhide + cy.get('[data-cy=group-members-data-explorer]') + .contains('Other User') + .parents('tr') + .within(() => { + cy.get('[data-cy=user-hidden-checkbox]').click(); + }); + // Check that other user is visible + cy.get('[data-cy=group-details-permissions-tab]').click(); + cy.get('[data-cy=group-permissions-data-explorer]') + .contains('Other User') + .parents('tr') + .within(() => { + cy.contains('Read'); + }); + // Test re-hide + cy.get('[data-cy=group-details-members-tab]').click(); + cy.get('[data-cy=group-members-data-explorer]') + .contains('Other User') + .parents('tr') + .within(() => { + cy.get('[data-cy=user-hidden-checkbox]').click(); + }); + // Check that other user is hidden + cy.get('[data-cy=group-details-permissions-tab]').click(); + cy.get('[data-cy=group-permissions-data-explorer]') + .should('not.contain', 'Other User') + }); + + it('displays resources shared with the group', function() { + // Switch to activeUser + cy.loginAs(activeUser); + cy.get('[data-cy=side-panel-tree]').contains('Groups').click(); + + // Get groupUuid and create shared project + cy.get('[data-cy=groups-panel-data-explorer]') + .contains(groupName) + .parents('tr') + .find('[data-cy=uuid]') + .invoke('text') + .as('groupUuid') + .then((groupUuid) => { + cy.createProject({ + owningUser: activeUser, + projectName: 'test-project', + }).as('testProject').then((testProject) => { + cy.shareWith(activeUser.token, groupUuid, testProject.uuid, 'can_read'); + }); + }); + + // Check that the project is listed in permissions + cy.get('[data-cy=groups-panel-data-explorer]').contains(groupName).click(); + cy.get('[data-cy=group-details-permissions-tab]').click(); + cy.get('[data-cy=group-permissions-data-explorer]') + .contains('test-project') + .parents('tr') + .within(() => { + cy.contains('Read'); + }); + }); + it('removes users from the group', function() { + cy.get('[data-cy=side-panel-tree]').contains('Groups').click(); + cy.get('[data-cy=groups-panel-data-explorer]').contains(groupName).click(); + // Remove other user cy.get('[data-cy=group-members-data-explorer]') .contains('Other User') @@ -122,6 +191,49 @@ describe('Group manage tests', function() { cy.get('[data-cy=confirmation-dialog-ok-btn]').click(); cy.get('[data-cy=group-members-data-explorer]') .should('not.contain', 'Other User'); + }); + + it('renames the group', function() { + // Navigate to Groups + cy.get('[data-cy=side-panel-tree]').contains('Groups').click(); + + // Open rename dialog + cy.get('[data-cy=groups-panel-data-explorer]') + .contains(groupName) + .rightclick(); + cy.get('[data-cy=context-menu]') + .contains('Rename') + .click(); + + // Rename the group + cy.get('[data-cy=form-dialog]') + .should('contain', 'Edit Project') + .within(() => { + cy.get('input[name=name]').clear().type(groupName + ' (renamed)'); + cy.get('button[type=submit]').click(); + }); + // Check that the group was renamed + cy.get('[data-cy=groups-panel-data-explorer]') + .contains(groupName + ' (renamed)'); }); + + it('deletes the group', function() { + // Navigate to Groups + cy.get('[data-cy=side-panel-tree]').contains('Groups').click(); + + // Delete the group + cy.get('[data-cy=groups-panel-data-explorer]') + .contains(groupName + ' (renamed)') + .rightclick(); + cy.get('[data-cy=context-menu]') + .contains('Remove') + .click(); + cy.get('[data-cy=confirmation-dialog-ok-btn]').click(); + + // Check that the group was deleted + cy.get('[data-cy=groups-panel-data-explorer]') + .should('not.contain', groupName + ' (renamed)'); + }); + });