1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 describe('Details panel', () => {
9 cy.getUser("active", "Active", "User", true, true)
16 // Add this test to the existing describe block in details-panel.cy.js
18 it('displays root project details when no items are selected', () => {
19 cy.loginAs(adminUser);
21 // Navigate to the user's root project
22 cy.visit(`/projects/${adminUser.user.uuid}`);
24 // Wait for the data table to load
25 cy.get('[data-cy=data-table]').should('be.visible');
27 // Ensure no items are selected
28 cy.get('[data-cy=data-table-row] input[type="checkbox"]:checked').should('not.exist');
30 // Open the details panel
31 cy.get('[data-cy=details-panel]').should('not.exist');
32 cy.get('[data-testid=InfoIcon]').click();
33 cy.get('[data-cy=details-panel]').should('be.visible');
35 // Check if root project details are displayed
36 cy.get('[data-cy=details-panel]').within(() => {
37 cy.contains('Type').should('be.visible');
38 cy.contains('Root Project').should('be.visible');
39 cy.contains('User').should('be.visible');
40 cy.contains('Created at').should('be.visible');
41 cy.contains('UUID').should('be.visible');
43 // Verify specific root project details
44 cy.contains(adminUser.user.uuid).should('be.visible');
47 // Verify that the Root Project icon is displayed
48 cy.get('[data-cy=details-panel]').find('[data-testid=InboxIcon]').should('be.visible');
52 describe('Collection details panel', () => {
56 cy.getUser("active", "Active", "User", true, true)
63 it('displays appropriate attributes when a collection is selected', () => {
64 cy.loginAs(adminUser);
66 // Create a test collection
67 const collectionName = `Test Collection ${Math.floor(Math.random() * 999999)}`;
68 cy.createCollection(adminUser.token, {
70 owner_uuid: adminUser.user.uuid,
71 manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n",
72 }).as('testCollection');
74 // Navigate to the project containing the collection
75 cy.get('@testCollection').then((collection) => {
76 cy.visit(`/projects/${adminUser.user.uuid}`);
78 // Wait for the data table to load
79 cy.get('[data-cy=data-table]').should('be.visible');
81 // Find and check the checkbox for the test collection
82 cy.contains('[data-cy=data-table-row]', collectionName)
83 .find('input[type="checkbox"]')
86 // Open the details panel
87 cy.get('[data-cy=details-panel]').should('not.exist');
88 cy.get('[data-testid=InfoIcon]').click();
89 cy.get('[data-cy=details-panel]').should('be.visible');
91 // Check if appropriate attributes are displayed
92 cy.get('[data-cy=details-panel]').within(() => {
93 cy.contains('Collection UUID').should('be.visible');
94 cy.contains('Portable data hash').should('be.visible');
95 cy.contains('Owner').should('be.visible');
96 cy.contains('Created at').should('be.visible');
97 cy.contains('Last modified').should('be.visible');
98 cy.contains('Content size').should('be.visible');
99 cy.contains('Number of files').should('be.visible');
100 cy.contains('Properties').should('be.visible');
103 // Verify specific collection details
104 cy.get('[data-cy=details-panel]').within(() => {
105 cy.contains(collection.uuid).should('be.visible');
106 cy.contains(collection.portable_data_hash).should('be.visible');
107 cy.contains(adminUser.user.uuid).should('be.visible');
108 cy.contains('1').should('be.visible'); // Number of files
109 cy.contains('3 B').should('be.visible'); // Content size
114 describe('Collection versioning', () => {
118 cy.getUser("active", "Active", "User", true, true)
125 it('creates a collection, edits it, and verifies version information', () => {
126 cy.loginAs(adminUser);
128 // Create a test collection
129 const collectionName = `Test Collection ${Math.floor(Math.random() * 999999)}`;
130 cy.createCollection(adminUser.token, {
131 name: collectionName,
132 owner_uuid: adminUser.user.uuid,
133 manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n",
134 }).as('testCollection');
136 cy.get('@testCollection').then((collection) => {
137 // Navigate to the project containing the collection
138 cy.visit(`/projects/${adminUser.user.uuid}`);
140 // Wait for the data table to load
141 cy.get('[data-cy=data-table]').should('be.visible');
143 // Find and open the test collection
144 cy.contains('[data-cy=data-table-row]', collectionName).rightclick();
146 // Edit the collection
147 cy.get("[data-cy=context-menu]").within(() => {
148 cy.get('[data-cy="Edit collection"]').click();
151 // Change the name in the edit dialog
152 const newName = `${collectionName} (edited)`;
153 cy.get('[data-cy=form-dialog]').within(() => {
154 cy.get('input[name=name]').clear().type(newName);
155 cy.get('[data-cy=form-submit-btn]').click();
158 // Wait for the update to complete
159 cy.contains('[data-cy=data-table]', newName).should('be.visible');
161 // open the collection viewer
162 cy.contains(newName).click();
164 // Verify that the version number has increased
165 cy.get('[data-cy=collection-version-number]').should('contain', '2');
167 // Click on the version number to open the details panel
168 cy.get('[data-cy=collection-version-number]').click();
170 // Verify that the details panel is open and the "Versions" tab is selected
171 cy.get('[data-cy=details-panel]').should('be.visible');
172 cy.get('[data-cy=details-panel-tab-Versions]').should('have.attr', 'aria-selected', 'true');
174 // Verify that the version number is visible in the details panel
175 cy.get('[data-cy=collection-version-browser]').within(() => {
176 cy.get('[data-cy=collection-version-browser-select-2]').should('be.visible');
177 cy.get('[data-cy=collection-version-browser-select-2]').should('have.class', 'Mui-selected');