X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/5385afcada8666051658c6889c83848702497759..7b5bf320c400a44d3e8b0cd962256c0ab9d872bf:/cypress/integration/sharing.spec.js diff --git a/cypress/integration/sharing.spec.js b/cypress/integration/sharing.spec.js index 5786c41d..1d3112c2 100644 --- a/cypress/integration/sharing.spec.js +++ b/cypress/integration/sharing.spec.js @@ -14,13 +14,11 @@ describe('Sharing tests', function () { cy.getUser('admin', 'Admin', 'User', true, true) .as('adminUser').then(function () { adminUser = this.adminUser; - } - ); + }); cy.getUser('collectionuser1', 'Collection', 'User', false, true) .as('activeUser').then(function () { activeUser = this.activeUser; - } - ); + }); }) beforeEach(function () { @@ -28,6 +26,38 @@ describe('Sharing tests', function () { cy.clearLocalStorage() }); + it('can create and delete sharing URLs on collections', () => { + const collName = 'shared-collection ' + new Date().getTime(); + cy.createCollection(adminUser.token, { + name: collName, + owner_uuid: adminUser.uuid, + }).as('sharedCollection').then(function (sharedCollection) { + cy.loginAs(adminUser); + + cy.get('main').contains(sharedCollection.name).rightclick(); + cy.get('[data-cy=context-menu]').within(() => { + cy.contains('Share').click(); + }); + cy.get('.sharing-dialog').within(() => { + cy.contains('Sharing URLs').click(); + cy.contains('Create sharing URL'); + cy.contains('No sharing URLs'); + cy.should('not.contain', 'Token'); + cy.should('not.contain', 'expiring at:'); + + cy.contains('Create sharing URL').click(); + cy.should('not.contain', 'No sharing URLs'); + cy.contains('Token'); + cy.contains('expiring at:'); + + cy.get('[data-cy=remove-url-btn]').find('button').click(); + cy.contains('No sharing URLs'); + cy.should('not.contain', 'Token'); + cy.should('not.contain', 'expiring at:'); + }) + }) + }); + it('can share projects to other users', () => { cy.loginAs(adminUser); @@ -46,7 +76,10 @@ describe('Sharing tests', function () { cy.get('.sharing-dialog').as('sharingDialog'); cy.get('[data-cy=invite-people-field]').find('input').type(activeUser.user.email); cy.get('[role=tooltip]').click(); - cy.get('@sharingDialog').contains('Save').click(); + cy.get('@sharingDialog').within(() => { + cy.contains('Save changes').click(); + cy.contains('Close').click(); + }); }); cy.createGroup(adminUser.token, { @@ -61,7 +94,10 @@ describe('Sharing tests', function () { cy.get('.sharing-dialog').as('sharingDialog'); cy.get('[data-cy=invite-people-field]').find('input').type(activeUser.user.email); cy.get('[role=tooltip]').click(); - cy.get('@sharingDialog').contains('Save').click(); + cy.get('@sharingDialog').within(() => { + cy.contains('Save changes').click(); + cy.contains('Close').click(); + }); }); cy.getAll('@mySharedWritableProject', '@mySharedReadonlyProject') @@ -74,8 +110,34 @@ describe('Sharing tests', function () { cy.get('[data-cy=context-menu]').should('contain', 'Move to trash'); cy.get('[data-cy=context-menu]').contains('Move to trash').click(); + // GUARD: Let's wait for the above removed project to disappear + // before continuing, to avoid intermittent failures. + cy.get('main').should('not.contain', mySharedWritableProject.name); + cy.get('main').contains(mySharedReadonlyProject.name).rightclick(); cy.get('[data-cy=context-menu]').should('not.contain', 'Move to trash'); }); }); + + it('can edit project in shared with me', () => { + cy.createProject({ + owningUser: adminUser, + targetUser: activeUser, + projectName: 'mySharedWritableProject', + canWrite: true, + addToFavorites: true + }); + + cy.getAll('@mySharedWritableProject') + .then(function ([mySharedWritableProject]) { + cy.loginAs(activeUser); + + cy.get('[data-cy=side-panel-tree]').contains('Shared with me').click(); + + const newProjectName = `New project name ${mySharedWritableProject.name}`; + const newProjectDescription = `New project description ${mySharedWritableProject.name}`; + + cy.testEditProjectOrCollection('main', mySharedWritableProject.name, newProjectName, newProjectDescription); + }); + }); }); \ No newline at end of file