Merge branch '21128-toolbar-context-menu'
[arvados-workbench2.git] / cypress / integration / collection.spec.js
index 35f36e1e0b90d0d21c9684603a383e04d850a704..54c570f7c4453fdafa3fe5bd4cd27795eadcb1e1 100644 (file)
@@ -32,6 +32,45 @@ describe("Collection panel tests", function () {
         cy.clearLocalStorage();
     });
 
+    it('shows the appropriate buttons in the toolbar', () => {
+
+        const msButtonTooltips = [
+            'API Details',
+            'Add to Favorites',
+            'Copy to clipboard',
+            'Edit collection',
+            'Make a copy',
+            'Move to',
+            'Move to trash',
+            'Open in new tab',
+            'Open with 3rd party client',
+            'Share',
+            'View details',
+        ];
+
+        cy.loginAs(activeUser);
+        const name = `Test collection ${Math.floor(Math.random() * 999999)}`;
+        cy.get("[data-cy=side-panel-button]").click({force: true});
+        cy.get("[data-cy=side-panel-new-collection]").click();
+        cy.get("[data-cy=form-dialog]")
+            .should("contain", "New collection")
+            .within(() => {
+                cy.get("[data-cy=name-field]").within(() => {
+                    cy.get("input").type(name);
+                });
+                cy.get("[data-cy=form-submit-btn]").click();
+            });
+            cy.get("[data-cy=side-panel-tree]").contains("Home Projects").click();
+            cy.waitForDom()
+            cy.get('[data-cy=data-table-row]').contains(name).should('exist').parent().parent().parent().parent().click()
+            cy.get('[data-cy=multiselect-button]').should('have.length', msButtonTooltips.length)
+            for (let i = 0; i < msButtonTooltips.length; i++) {
+                cy.get('[data-cy=multiselect-button]').eq(i).trigger('mouseover');
+                cy.get('body').contains(msButtonTooltips[i]).should('exist')
+                cy.get('[data-cy=multiselect-button]').eq(i).trigger('mouseout');
+            }
+    })
+
     it("allows to download mountain duck config for a collection", () => {
         cy.createCollection(adminUser.token, {
             name: `Test collection ${Math.floor(Math.random() * 999999)}`,
@@ -125,6 +164,8 @@ describe("Collection panel tests", function () {
         cy.get("[data-cy=form-dialog]").should("exist").and("contain", "Collection with the same name already exists");
     });
 
+    
+
     it("uses the property editor (from edit dialog) with vocabulary terms", function () {
         cy.createCollection(adminUser.token, {
             name: `Test collection ${Math.floor(Math.random() * 999999)}`,
@@ -168,6 +209,8 @@ describe("Collection panel tests", function () {
             });
     });
 
+    
+
     it("uses the editor (from details panel) with vocabulary terms", function () {
         cy.createCollection(adminUser.token, {
             name: `Test collection ${Math.floor(Math.random() * 999999)}`,
@@ -453,60 +496,6 @@ describe("Collection panel tests", function () {
             });
     });
 
-    it("renames a file to a different directory", function () {
-        // Creates the collection using the admin token so we can set up
-        // a bogus manifest text without block signatures.
-        cy.createCollection(adminUser.token, {
-            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
-            owner_uuid: activeUser.user.uuid,
-            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n",
-        })
-            .as("testCollection")
-            .then(function () {
-                cy.loginAs(activeUser);
-                cy.goToPath(`/collections/${this.testCollection.uuid}`);
-
-                ["subdir", "G%C3%BCnter's%20file", "table%&?*2"].forEach(subdir => {
-                    cy.waitForDom().get("[data-cy=collection-files-panel]").contains("bar").rightclick();
-                    cy.get("[data-cy=context-menu]").contains("Rename").click();
-                    cy.get("[data-cy=form-dialog]")
-                        .should("contain", "Rename")
-                        .within(() => {
-                            cy.get("input").type(`{selectall}{backspace}${subdir}/foo`);
-                        });
-                    cy.get("[data-cy=form-submit-btn]").click();
-                    cy.get("[data-cy=collection-files-panel]").should("not.contain", "bar").and("contain", subdir);
-                    cy.get("[data-cy=collection-files-panel]").contains(subdir).click();
-
-                    // Rename 'subdir/foo' to 'bar'
-                    cy.wait(1000);
-                    cy.get("[data-cy=collection-files-panel]").contains("foo").rightclick();
-                    cy.get("[data-cy=context-menu]").contains("Rename").click();
-                    cy.get("[data-cy=form-dialog]")
-                        .should("contain", "Rename")
-                        .within(() => {
-                            cy.get("input").should("have.value", `${subdir}/foo`).type(`{selectall}{backspace}bar`);
-                        });
-                    cy.get("[data-cy=form-submit-btn]").click();
-
-                    // need to wait for dialog to dismiss
-                    cy.get("[data-cy=form-dialog]").should("not.exist");
-
-                    cy.waitForDom().get("[data-cy=collection-files-panel]").contains("Home").click();
-
-                    cy.wait(2000);
-                    cy.get("[data-cy=collection-files-panel]")
-                        .should("contain", subdir) // empty dir kept
-                        .and("contain", "bar");
-
-                    cy.get("[data-cy=collection-files-panel]").contains(subdir).rightclick();
-                    cy.get("[data-cy=context-menu]").contains("Remove").click();
-                    cy.get("[data-cy=confirmation-dialog-ok-btn]").click();
-                    cy.get("[data-cy=form-dialog]").should("not.exist");
-                });
-            });
-    });
-
     it("shows collection owner", () => {
         cy.createCollection(adminUser.token, {
             name: `Test collection ${Math.floor(Math.random() * 999999)}`,