21700: Install Bundler system-wide in Rails postinst
[arvados.git] / services / workbench2 / cypress / e2e / delete-multiple-files.cy.js
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 describe('Multi-file deletion tests', function () {
6     let activeUser;
7     let adminUser;
8
9     before(function () {
10         cy.getUser('admin', 'Admin', 'User', true, true)
11             .as('adminUser').then(function () {
12                 adminUser = this.adminUser;
13             }
14             );
15         cy.getUser('collectionuser1', 'Collection', 'User', false, true)
16             .as('activeUser').then(function () {
17                 activeUser = this.activeUser;
18             }
19             );
20     });
21
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"
27         })
28             .as('testCollection').then(function () {
29                 cy.loginAs(activeUser);
30                 cy.goToPath(`/collections/${this.testCollection.uuid}`);
31
32                 cy.get('[data-cy=collection-files-panel]').within(() => {
33                     cy.get('[type="checkbox"]').first().check();
34                     cy.get('[type="checkbox"]').last().check();
35                 });
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();
39                 cy.wait(1000);
40                 cy.get('[data-cy=collection-files-panel]')
41                     .should('not.contain', 'baz')
42                     .and('not.contain', 'bar');
43             });
44     });
45
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"
51         })
52             .as('testCollection').then(function () {
53                 cy.loginAs(activeUser);
54                 cy.goToPath(`/collections/${this.testCollection.uuid}`);
55
56                 cy.get('[data-cy=virtual-file-tree] > div > i').first().click();
57                 cy.get('[data-cy=collection-files-panel]')
58                     .should('contain', 'foo');
59
60                 cy.get('[data-cy=collection-files-panel]')
61                     .contains('foo').closest('[data-cy=virtual-file-tree]').find('[type="checkbox"]').click();
62
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();
66
67                 cy.get('[data-cy=collection-files-panel]')
68                     .should('not.contain', 'subdir')
69                     .and('contain', 'baz');
70             });
71     });
72
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"
78         })
79             .as('testCollection').then(function () {
80                 cy.loginAs(activeUser);
81                 cy.goToPath(`/collections/${this.testCollection.uuid}`);
82
83                 cy.get('[data-cy=collection-files-panel]').contains('subdir').click();
84                 cy.wait(1000);
85                 cy.get('[data-cy=collection-files-panel]')
86                     .should('contain', 'foo');
87
88                 cy.get('[data-cy=collection-files-panel]')
89                     .contains('foo').parent().find('[type="checkbox"]').click();
90
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();
94
95                 cy.get('[data-cy=collection-files-panel]')
96                     .should('not.contain', 'foo')
97                     .and('contain', 'subdir');
98             });
99     });
100 })