19302: updated int test Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox@curii...
[arvados-workbench2.git] / cypress / integration / side-panel.spec.js
index 59e143ee69a2c2b5155ef7eec370631682c8527c..84649f45ffa2b083a56818ad836b1265c5bacc1b 100644 (file)
@@ -62,11 +62,10 @@ describe('Side panel tests', function() {
             {url: '/shared-with-me', label: 'Shared with me'},
             {url: '/public-favorites', label: 'Public Favorites'},
             {url: '/favorites', label: 'My Favorites'},
-            {url: '/workflows', label: 'Workflows'},
             {url: '/all_processes', label: 'All Processes'},
             {url: '/trash', label: 'Trash'},
         ].map(function(section) {
-            cy.goToPath(section.url);
+            cy.waitForDom().goToPath(section.url);
             cy.get('[data-cy=breadcrumb-first]')
                 .should('contain', section.label);
             cy.get('[data-cy=side-panel-button]')
@@ -82,7 +81,6 @@ describe('Side panel tests', function() {
             group_class: 'filter',
             properties: {filters: []},
         }).as('myFavoriteFilterGroup').then(function (myFavoriteFilterGroup) {
-            cy.contains('Refresh').click();
             cy.goToPath(`/projects/${myFavoriteFilterGroup.uuid}`);
             cy.get('[data-cy=breadcrumb-last]').should('contain', 'my-favorite-filter-group');
 
@@ -104,7 +102,7 @@ describe('Side panel tests', function() {
         cy.getAll('@mySharedWritableProject')
             .then(function ([mySharedWritableProject]) {
                 cy.loginAs(activeUser);
-                
+
                 cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
 
                 const newProjectName = `New project name ${mySharedWritableProject.name}`;
@@ -115,36 +113,63 @@ describe('Side panel tests', function() {
     });
 
     it('side panel react to refresh when project data changes', () => {
-        const project1 = 'writableProject1';
-        const project2 = 'writableProject2';
+        const project = 'writableProject';
 
         cy.createProject({
             owningUser: activeUser,
             targetUser: activeUser,
-            projectName: project1,
+            projectName: project,
             canWrite: true,
             addToFavorites: false
         });
 
-        cy.createProject({
-            owningUser: activeUser,
-            targetUser: activeUser,
-            projectName: project2,
-            canWrite: true,
-            addToFavorites: false
+        cy.getAll('@writableProject').then(function ([writableProject]) {
+            cy.loginAs(activeUser);
+            cy.get('[data-cy=side-panel-tree]')
+                .contains('Projects').click();
+            cy.get('[data-cy=side-panel-tree]')
+                .contains(writableProject.name).should('exist');
+            cy.trashGroup(activeUser.token, writableProject.uuid).then(() => {
+                cy.contains('Refresh').click();
+                cy.contains(writableProject.name).should('not.exist');
+            });
         });
+    });
 
-        cy.getAll('@writableProject1', '@writableProject2')
-            .then(function ([writableProject1, writableProject2]) {
-                cy.loginAs(activeUser);
-                
-                cy.get('[data-cy=side-panel-tree]').contains('Projects').click();
-
-                cy.trashGroup(activeUser.token, writableProject2.uuid);
+    it('collapses and un-collapses', () => {
 
-                cy.contains('Refresh').click();
+        cy.loginAs(activeUser)
+        cy.get('[data-cy=side-panel-tree]').should('exist')
+        cy.get('[data-cy=side-panel-toggle]').click()
+        cy.get('[data-cy=side-panel-tree]').should('not.exist')
+        cy.get('[data-cy=side-panel-collapsed]').should('exist')
+        cy.get('[data-cy=side-panel-toggle]').click()
+        cy.get('[data-cy=side-panel-tree]').should('exist')
+        cy.get('[data-cy=side-panel-collapsed]').should('not.exist')
+    })
 
-                cy.contains(writableProject2.name).should('not.exist');
-            });
-    });
+    it.only('can navigate from collapsed panel', () => {
+
+        const collapsedCategories = {
+            'shared-with-me': '/shared-with-me',
+            'public-favorites': '/public-favorites',
+            'my-favorites': '/favorites',
+            'groups': '/groups',
+            'all-processes': '/all_processes',
+            'trash': '/trash',
+            'shell-access': '/virtual-machines-user',
+            'home-projects': `/projects/${activeUser.user.uuid}`,
+        }
+
+        cy.loginAs(activeUser)
+        cy.get('[data-cy=side-panel-tree]').should('exist')
+        cy.get('[data-cy=side-panel-toggle]').click()
+        cy.get('[data-cy=side-panel-collapsed]').should('exist')
+
+        for (const cat in collapsedCategories) {
+            cy.get(`[data-cy=collapsed-${cat}]`).should('exist').click()
+            cy.url().should('include', collapsedCategories[cat])
+        }
+    })
 })
+