16971: Added tests to cover more places
[arvados-workbench2.git] / cypress / integration / favorites.spec.js
index 22514beb1e73f0b56694942653196b07bb729fb3..d81ad811434e4c563f643de49a4a31576b203e9a 100644 (file)
@@ -132,7 +132,56 @@ describe('Favorites tests', function () {
             });
     });
 
-    it('can view favourites in workflow', () => {
+    it('can edit project and collections in favorites', () => {
+        cy.createProject({
+            owningUser: adminUser,
+            targetUser: activeUser,
+            projectName: 'mySharedWritableProject',
+            canWrite: true,
+            addToFavorites: true
+        });
+
+        cy.createCollection(adminUser.token, {
+            owner_uuid: activeUser.user.uuid,
+            name: `Test target collection ${Math.floor(Math.random() * 999999)}`,
+        }).as('testTargetCollection').then(function (testTargetCollection) {
+            cy.addToFavorites(activeUser.token, activeUser.user.uuid, testTargetCollection.uuid);
+        });
+
+        cy.getAll('@mySharedWritableProject', '@testTargetCollection')
+            .then(function ([mySharedWritableProject, testTargetCollection]) {
+                cy.loginAs(activeUser);
+                
+                cy.get('[data-cy=side-panel-tree]').contains('My Favorites').click();
+
+                const newProjectName = `New project name ${mySharedWritableProject.name}`;
+                const newProjectDescription = `New project description ${mySharedWritableProject.name}`;
+                const newCollectionName = `New collection name ${testTargetCollection.name}`;
+                const newCollectionDescription = `New collection description ${testTargetCollection.name}`;
+
+                cy.editProjectOrCollection('main', mySharedWritableProject.name, newProjectName, newProjectDescription);
+                cy.editProjectOrCollection('main', testTargetCollection.name, newCollectionName, newCollectionDescription, false);
+
+                cy.get('main').contains(newProjectName).rightclick();
+                cy.contains('Remove from favorites').click();
+                cy.get('main').contains(newCollectionName).rightclick();
+                cy.contains('Remove from favorites').click();
+
+                cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
+
+                cy.get('main').contains(newProjectName).rightclick();
+                cy.contains('Add to public favorites').click();
+                cy.get('main').contains(newCollectionName).rightclick();
+                cy.contains('Add to public favorites').click();
+
+                cy.get('[data-cy=side-panel-tree]').contains('Public Favorites').click();
+
+                cy.editProjectOrCollection('main', newProjectName, mySharedWritableProject.name, 'newProjectDescription');
+                cy.editProjectOrCollection('main', newCollectionName, testTargetCollection.name, 'newCollectionDescription', false); 
+            });
+    });
+
+    it('can view favorites in workflow', () => {
         cy.createProject({
             owningUser: adminUser,
             targetUser: activeUser,
@@ -204,4 +253,4 @@ describe('Favorites tests', function () {
                     });
             });
     });
-});
\ No newline at end of file
+});