18549: Layout fixed, tests updated
[arvados-workbench2.git] / cypress / integration / delete-multiple-files.spec.js
index bd40a2b7600235922fbf01d688f6ab28d2358a67..b506fb3d6874b25e9fd16085d5da090e22b48be1 100644 (file)
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-describe('Collection panel tests', function () {
+describe('Multi-file deletion tests', function () {
     let activeUser;
     let adminUser;
 
@@ -32,7 +32,8 @@ describe('Collection panel tests', function () {
         })
             .as('testCollection').then(function () {
                 cy.loginAs(activeUser);
-                cy.visit(`/collections/${this.testCollection.uuid}`);
+                cy.goToPath(`/collections/${this.testCollection.uuid}`);
+
                 cy.get('[data-cy=collection-files-panel]').within(() => {
                     cy.get('[type="checkbox"]').first().check();
                     cy.get('[type="checkbox"]').last().check();
@@ -40,49 +41,65 @@ describe('Collection panel tests', function () {
                 cy.get('[data-cy=collection-files-panel-options-btn]').click();
                 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
                 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
+                cy.wait(1000);
                 cy.get('[data-cy=collection-files-panel]')
                     .should('not.contain', 'baz')
                     .and('not.contain', 'bar');
             });
     });
 
-    it('deletes all files from non root dir', function () {
+    it.skip('deletes all files from non root dir', function () {
         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. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
+            manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
         })
             .as('testCollection').then(function () {
                 cy.loginAs(activeUser);
-                cy.visit(`/collections/${this.testCollection.uuid}`);
+                cy.goToPath(`/collections/${this.testCollection.uuid}`);
+
+                cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
+                cy.get('[data-cy=collection-files-panel]')
+                    .should('contain', 'foo');
 
                 cy.get('[data-cy=collection-files-panel]')
-                    .contains('bar').rightclick({ force: true });
+                    .contains('foo').closest('[data-cy=virtual-file-tree]').find('[type="checkbox"]').click();
 
-                cy.get('[data-cy=context-menu]')
-                    .contains('Rename')
-                    .click();
+                cy.get('[data-cy=collection-files-panel-options-btn]').click();
+                cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
+                cy.get('[data-cy=confirmation-dialog-ok-btn]').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');
+                    .should('not.contain', 'subdir')
+                    .and('contain', 'baz');
+            });
+    });
 
-                cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
+    it('deletes all files from non root dir', function () {
+        cy.createCollection(adminUser.token, {
+            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
+            owner_uuid: activeUser.user.uuid,
+            manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
+        })
+            .as('testCollection').then(function () {
+                cy.loginAs(activeUser);
+                cy.goToPath(`/collections/${this.testCollection.uuid}`);
+
+                cy.get('[data-cy=collection-files-panel]').contains('subdir').click();
+                cy.wait(1000);
                 cy.get('[data-cy=collection-files-panel]')
                     .should('contain', 'foo');
 
                 cy.get('[data-cy=collection-files-panel]')
-                    .contains('foo').closest('[data-cy=virtual-file-tree]').find('[type="checkbox"]').click();
+                    .contains('foo').parent().find('[type="checkbox"]').click();
 
                 cy.get('[data-cy=collection-files-panel-options-btn]').click();
                 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
                 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
+
+                cy.get('[data-cy=collection-files-panel]')
+                    .should('not.contain', 'foo')
+                    .and('contain', 'subdir');
             });
     });
 })