1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 describe('Side panel tests', 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;
19 cy.getUser('user', 'Active', 'User', false, true)
20 .as('activeUser').then(function() {
21 activeUser = this.activeUser;
26 beforeEach(function() {
28 cy.clearLocalStorage()
31 it('enables the +NEW side panel button on users home project', function() {
32 cy.loginAs(activeUser);
33 cy.doSearch(`${activeUser.user.uuid}`);
34 cy.get('[data-cy=side-panel-button]')
36 .and('not.be.disabled');
39 it('disables or enables the +NEW side panel button on depending on project permissions', function() {
40 cy.loginAs(activeUser);
41 [true, false].map(function(isWritable) {
42 cy.createGroup(adminUser.token, {
43 name: `Test ${isWritable ? 'writable' : 'read-only'} project`,
44 group_class: 'project',
45 }).as('sharedGroup').then(function() {
46 cy.createLink(adminUser.token, {
47 name: isWritable ? 'can_write' : 'can_read',
48 link_class: 'permission',
49 head_uuid: this.sharedGroup.uuid,
50 tail_uuid: activeUser.user.uuid
52 cy.doSearch(`${this.sharedGroup.uuid}`);
53 cy.get('[data-cy=side-panel-button]')
55 .and(`${isWritable ? 'not.' : ''}be.disabled`);
60 it('disables the +NEW side panel button on appropriate sections', function() {
61 cy.loginAs(activeUser);
63 {url: '/shared-with-me', label: 'Shared with me'},
64 {url: '/public-favorites', label: 'Public Favorites'},
65 {url: '/favorites', label: 'My Favorites'},
66 {url: '/workflows', label: 'Workflows'},
67 {url: '/all_processes', label: 'All Processes'},
68 {url: '/trash', label: 'Trash'},
69 ].map(function(section) {
70 cy.visit(section.url);
71 cy.get('[data-cy=breadcrumb-first]')
72 .should('contain', section.label);
73 cy.get('[data-cy=side-panel-button]')