16115: Fixes cypress tests.
[arvados-workbench2.git] / cypress / integration / sharing.spec.js
index 4f4c2eb3b32f6974f629cff05d975f0362fbd404..df7c74363bc1c4c188a210784e022819ebe81280 100644 (file)
@@ -46,7 +46,8 @@ 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').contains('Save changes').click();
+            cy.get('@sharingDialog').contains('Close').click();
         });
 
         cy.createGroup(adminUser.token, {
@@ -61,7 +62,8 @@ 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').contains('Save changes').click();
+            cy.get('@sharingDialog').contains('Close').click();
         });
 
         cy.getAll('@mySharedWritableProject', '@mySharedReadonlyProject')
@@ -74,6 +76,10 @@ 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');
             });
@@ -91,13 +97,13 @@ describe('Sharing tests', function () {
         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.editProjectOrCollection('main', mySharedWritableProject.name, newProjectName, newProjectDescription);
+                cy.testEditProjectOrCollection('main', mySharedWritableProject.name, newProjectName, newProjectDescription);
             });
     });
 });
\ No newline at end of file