21988: added details-panel test
[arvados.git] / services / workbench2 / cypress / e2e / details-panel.cy.js
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 describe('Collection details panel', () => {
6   let adminUser;
7
8   before(() => {
9     cy.getUser("active", "Active", "User", true, true)
10       .as("activeUser")
11       .then((user) => {
12         adminUser = user;
13       });
14   });
15
16   it('displays appropriate attributes when a collection is selected', () => {
17     cy.loginAs(adminUser);
18
19     // Create a test collection
20     const collectionName = `Test Collection ${Math.floor(Math.random() * 999999)}`;
21     cy.createCollection(adminUser.token, {
22       name: collectionName,
23       owner_uuid: adminUser.user.uuid,
24       manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:foo\n",
25     }).as('testCollection');
26
27     // Navigate to the project containing the collection
28     cy.get('@testCollection').then((collection) => {
29       cy.visit(`/projects/${adminUser.user.uuid}`);
30
31       // Wait for the data table to load
32       cy.get('[data-cy=data-table]').should('be.visible');
33
34       // Find and check the checkbox for the test collection
35       cy.contains('[data-cy=data-table-row]', collectionName)
36         .find('input[type="checkbox"]')
37         .click();
38
39       // Open the details panel
40       cy.get('[data-cy=details-panel]').should('not.exist');
41       cy.get('[data-testid=InfoIcon]').click();
42       cy.get('[data-cy=details-panel]').should('be.visible');
43
44       // Check if appropriate attributes are displayed
45       cy.get('[data-cy=details-panel]').within(() => {
46         cy.contains('Collection UUID').should('be.visible');
47         cy.contains('Portable data hash').should('be.visible');
48         cy.contains('Owner').should('be.visible');
49         cy.contains('Created at').should('be.visible');
50         cy.contains('Last modified').should('be.visible');
51         cy.contains('Content size').should('be.visible');
52         cy.contains('Number of files').should('be.visible');
53         cy.contains('Properties').should('be.visible');
54       });
55
56       // Verify specific collection details
57       cy.get('[data-cy=details-panel]').within(() => {
58         cy.contains(collection.uuid).should('be.visible');
59         cy.contains(collection.portable_data_hash).should('be.visible');
60         cy.contains(adminUser.user.uuid).should('be.visible');
61         cy.contains('1').should('be.visible'); // Number of files
62         cy.contains('3 B').should('be.visible'); // Content size
63       });
64     });
65   });
66 });