1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 describe('Multi-file deletion tests', function () {
10 cy.getUser('admin', 'Admin', 'User', true, true)
11 .as('adminUser').then(function () {
12 adminUser = this.adminUser;
15 cy.getUser('collectionuser1', 'Collection', 'User', false, true)
16 .as('activeUser').then(function () {
17 activeUser = this.activeUser;
22 beforeEach(function () {
24 cy.clearLocalStorage();
27 it('deletes all files from root dir', function () {
28 cy.createCollection(adminUser.token, {
29 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
30 owner_uuid: activeUser.user.uuid,
31 manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
33 .as('testCollection').then(function () {
34 cy.loginAs(activeUser);
35 cy.goToPath(`/collections/${this.testCollection.uuid}`);
37 cy.get('[data-cy=collection-files-panel]').within(() => {
38 cy.get('[type="checkbox"]').first().check();
39 cy.get('[type="checkbox"]').last().check();
41 cy.get('[data-cy=collection-files-panel-options-btn]').click();
42 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
43 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
45 cy.get('[data-cy=collection-files-panel]')
46 .should('not.contain', 'baz')
47 .and('not.contain', 'bar');
51 it.skip('deletes all files from non root dir', function () {
52 cy.createCollection(adminUser.token, {
53 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
54 owner_uuid: activeUser.user.uuid,
55 manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
57 .as('testCollection').then(function () {
58 cy.loginAs(activeUser);
59 cy.goToPath(`/collections/${this.testCollection.uuid}`);
61 cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
62 cy.get('[data-cy=collection-files-panel]')
63 .should('contain', 'foo');
65 cy.get('[data-cy=collection-files-panel]')
66 .contains('foo').closest('[data-cy=virtual-file-tree]').find('[type="checkbox"]').click();
68 cy.get('[data-cy=collection-files-panel-options-btn]').click();
69 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
70 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
72 cy.get('[data-cy=collection-files-panel]')
73 .should('not.contain', 'subdir')
74 .and('contain', 'baz');
78 it('deletes all files from non root dir', function () {
79 cy.createCollection(adminUser.token, {
80 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
81 owner_uuid: activeUser.user.uuid,
82 manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
84 .as('testCollection').then(function () {
85 cy.loginAs(activeUser);
86 cy.goToPath(`/collections/${this.testCollection.uuid}`);
88 cy.get('[data-cy=collection-files-panel]').contains('subdir').click();
90 cy.get('[data-cy=collection-files-panel]')
91 .should('contain', 'foo');
93 cy.get('[data-cy=collection-files-panel]')
94 .contains('foo').parent().find('[type="checkbox"]').click();
96 cy.get('[data-cy=collection-files-panel-options-btn]').click();
97 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
98 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
100 cy.get('[data-cy=collection-files-panel]')
101 .should('not.contain', 'foo')
102 .and('contain', 'subdir');