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 it('deletes all files from root dir', function () {
23 cy.createCollection(adminUser.token, {
24 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
25 owner_uuid: activeUser.user.uuid,
26 manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
28 .as('testCollection').then(function () {
29 cy.loginAs(activeUser);
30 cy.goToPath(`/collections/${this.testCollection.uuid}`);
32 cy.get('[data-cy=collection-files-panel]').within(() => {
33 cy.get('[type="checkbox"]').first().check();
34 cy.get('[type="checkbox"]').last().check();
36 cy.get('[data-cy=collection-files-panel-options-btn]').click();
37 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
38 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
40 cy.get('[data-cy=collection-files-panel]')
41 .should('not.contain', 'baz')
42 .and('not.contain', 'bar');
46 it.skip('deletes all files from non root dir', function () {
47 cy.createCollection(adminUser.token, {
48 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
49 owner_uuid: activeUser.user.uuid,
50 manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
52 .as('testCollection').then(function () {
53 cy.loginAs(activeUser);
54 cy.goToPath(`/collections/${this.testCollection.uuid}`);
56 cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
57 cy.get('[data-cy=collection-files-panel]')
58 .should('contain', 'foo');
60 cy.get('[data-cy=collection-files-panel]')
61 .contains('foo').closest('[data-cy=virtual-file-tree]').find('[type="checkbox"]').click();
63 cy.get('[data-cy=collection-files-panel-options-btn]').click();
64 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
65 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
67 cy.get('[data-cy=collection-files-panel]')
68 .should('not.contain', 'subdir')
69 .and('contain', 'baz');
73 it('deletes all files from non root dir', function () {
74 cy.createCollection(adminUser.token, {
75 name: `Test collection ${Math.floor(Math.random() * 999999)}`,
76 owner_uuid: activeUser.user.uuid,
77 manifest_text: "./subdir 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n. 37b51d194a7513e45b56f6524f2d51f2+3 0:3:baz\n"
79 .as('testCollection').then(function () {
80 cy.loginAs(activeUser);
81 cy.goToPath(`/collections/${this.testCollection.uuid}`);
83 cy.get('[data-cy=collection-files-panel]').contains('subdir').click();
85 cy.get('[data-cy=collection-files-panel]')
86 .should('contain', 'foo');
88 cy.get('[data-cy=collection-files-panel]')
89 .contains('foo').parent().find('[type="checkbox"]').click();
91 cy.get('[data-cy=collection-files-panel-options-btn]').click();
92 cy.get('[data-cy=context-menu] div').contains('Remove selected').click();
93 cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
95 cy.get('[data-cy=collection-files-panel]')
96 .should('not.contain', 'foo')
97 .and('contain', 'subdir');