16971: Fixed project edit issues and added tests
[arvados-workbench2.git] / cypress / integration / favorites.spec.js
index 6e9091e1b76e63e3329df636af5279cabd9d47a1..506cd251e9db52d3afa8d21122790dfafebb44cb 100644 (file)
@@ -132,7 +132,46 @@ describe('Favorites tests', function () {
             });
     });
 
-    it('can view favourites in workflow', () => {
+    it.only('can edit project in favorites', () => {
+        cy.createProject({
+            owningUser: adminUser,
+            targetUser: activeUser,
+            projectName: 'mySharedWritableProject',
+            description: 'test 123123',
+            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();
+
+                cy.get('main').contains(mySharedWritableProject.name).rightclick();
+                cy.get('[data-cy=context-menu]').contains('Edit project').click();
+                cy.get('[data-cy=form-dialog]').within(() => {
+                    cy.get('input[name=name]').should('have.value', mySharedWritableProject.name);
+                    cy.get('[data-cy=form-cancel-btn]').click();
+                });
+
+                cy.get('main').contains(testTargetCollection.name).rightclick();
+                cy.get('[data-cy=context-menu]').contains('Edit collection').click();
+                cy.get('[data-cy=form-dialog]').within(() => {
+                    cy.get('input[name=name]').should('have.value', testTargetCollection.name);
+                    cy.get('[data-cy=form-cancel-btn]').click();
+                });
+            });
+    });
+
+    it('can view favorites in workflow', () => {
         cy.createProject({
             owningUser: adminUser,
             targetUser: activeUser,