16118: Adds collection's integration test suite (WIP)
[arvados-workbench2.git] / cypress / integration / collection-panel.spec.js
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 describe('Collection panel tests', function() {
6     let activeUser;
7     let adminUser;
8
9     before(function() {
10         // Only set up common users once. These aren't set up as aliases because
11         // aliases are cleaned up after every test. Also it doesn't make sense
12         // to set the same users on beforeEach() over and over again, so we
13         // separate a little from Cypress' 'Best Practices' here.
14         cy.getUser('admin', 'Admin', 'User', true, true)
15             .as('adminUser').then(function() {
16                 adminUser = this.adminUser;
17             }
18         );
19         cy.getUser('collectionuser1', 'Collection', 'User', false, true)
20             .as('activeUser').then(function() {
21                 activeUser = this.activeUser;
22             }
23         );
24     })
25
26     beforeEach(function() {
27         cy.clearCookies()
28         cy.clearLocalStorage()
29     })
30
31     it('shows a collection by URL', function() {
32         cy.loginAs(activeUser);
33         cy.createCollection(adminUser.token, {
34             name: 'Test collection',
35             owner_uuid: activeUser.user.uuid,
36             manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"})
37         .as('testCollection').then(function() {
38             cy.visit(`/collections/${this.testCollection.uuid}`);
39             cy.get('[data-cy=collection-info-panel]')
40                 .should('contain', this.testCollection.name)
41                 .and('contain', this.testCollection.uuid);
42             cy.get('[data-cy=collection-files-panel]')
43                 .should('contain', 'bar');
44         })
45     })
46
47     // it('')
48 })