18219: Updates cypress tests.
authorLucas Di Pentima <lucas.dipentima@curii.com>
Wed, 15 Dec 2021 21:03:04 +0000 (18:03 -0300)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Fri, 17 Dec 2021 22:36:10 +0000 (19:36 -0300)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

cypress/integration/collection.spec.js
cypress/integration/project.spec.js
src/views-components/details-panel/details-panel.tsx
src/views-components/resource-properties-dialog/resource-properties-dialog.tsx
src/views/collection-panel/collection-panel.tsx

index 82a26cef6f325993a199643934a26ab7b2d0b43e..03ec1b58e25934ab5e754f8d046795e15eea0711 100644 (file)
@@ -85,6 +85,17 @@ describe('Collection panel tests', function () {
                 cy.loginAs(activeUser);
                 cy.goToPath(`/collections/${this.testCollection.uuid}`);
 
+                cy.get('[data-cy=collection-info-panel')
+                    .should('contain', this.testCollection.name)
+                    .and('not.contain', 'Color: Magenta')
+                    .and('not.contain', 'Size: S');
+                cy.get('[data-cy=additional-info-icon]').click();
+
+                cy.get('[data-cy=details-panel]').within(() => {
+                    cy.get('[data-cy=property-editor-btn]').click();
+                });
+                cy.get('[data-cy=resource-properties-dialog').contains('Edit properties');
+
                 // Key: Color (IDTAGCOLORS) - Value: Magenta (IDVALCOLORS3)
                 cy.get('[data-cy=resource-properties-form]').within(() => {
                     cy.get('[data-cy=property-field-key]').within(() => {
@@ -96,7 +107,7 @@ describe('Collection panel tests', function () {
                     cy.root().submit();
                 });
                 // Confirm proper vocabulary labels are displayed on the UI.
-                cy.get('[data-cy=collection-properties-panel]')
+                cy.get('[data-cy=resource-properties-dialog]')
                     .should('contain', 'Color: Magenta');
                 // Confirm proper vocabulary IDs were saved on the backend.
                 cy.doRequest('GET', `/arvados/v1/collections/${this.testCollection.uuid}`)
@@ -120,7 +131,7 @@ describe('Collection panel tests', function () {
                     cy.root().submit();
                 });
                 // Confirm proper vocabulary labels are displayed on the UI.
-                cy.get('[data-cy=collection-properties-panel]')
+                cy.get('[data-cy=resource-properties-dialog]')
                     .should('contain', 'Size: S');
                 // Confirm proper vocabulary IDs were saved on the backend.
                 cy.doRequest('GET', `/arvados/v1/collections/${this.testCollection.uuid}`)
@@ -128,6 +139,15 @@ describe('Collection panel tests', function () {
                     .then(function () {
                         expect(this.collection.properties.IDTAGSIZES).to.equal('IDVALSIZES2');
                     });
+
+                // Close property editor & confirm properties display on the UI.
+                cy.get('[data-cy=resource-properties-dialog]').within(() => {
+                    cy.get('[data-cy=close-dialog-btn]').click();
+                });
+                cy.get('[data-cy=collection-info-panel')
+                    .should('contain', this.testCollection.name)
+                    .and('contain', 'Color: Magenta')
+                    .and('contain', 'Size: S');
             });
     });
 
@@ -186,29 +206,9 @@ describe('Collection panel tests', function () {
                             .should('contain', 'Add to favorites')
                             .and(`${isWritable ? '' : 'not.'}contain`, 'Edit collection');
                         cy.get('body').click(); // Collapse the menu avoiding details panel expansion
-                        cy.get('[data-cy=collection-properties-panel]')
-                            .should('contain', 'someKey')
-                            .and('contain', 'someValue')
-                            .and('not.contain', 'anotherKey')
-                            .and('not.contain', 'anotherValue')
-                        if (isWritable === true) {
-                            // Check that properties can be added.
-                            cy.get('[data-cy=resource-properties-form]').within(() => {
-                                cy.get('[data-cy=property-field-key]').within(() => {
-                                    cy.get('input').type('anotherKey');
-                                });
-                                cy.get('[data-cy=property-field-value]').within(() => {
-                                    cy.get('input').type('anotherValue');
-                                });
-                                cy.root().submit();
-                            })
-                            cy.get('[data-cy=collection-properties-panel]')
-                                .should('contain', 'anotherKey')
-                                .and('contain', 'anotherValue')
-                        } else {
-                            // Properties form shouldn't be displayed.
-                            cy.get('[data-cy=resource-properties-form]').should('not.exist');
-                        }
+                        cy.get('[data-cy=collection-info-panel]')
+                            .should('contain', 'someKey: someValue')
+                            .and('not.contain', 'anotherKey: anotherValue');
                         // Check that the file listing show both read & write operations
                         cy.get('[data-cy=collection-files-panel]').within(() => {
                             cy.wait(1000);
@@ -313,63 +313,6 @@ describe('Collection panel tests', function () {
             });
     });
 
-    it.skip('renames a file to a different directory', function () {
-        // Creates the collection using the admin token so we can set up
-        // a bogus manifest text without block signatures.
-        cy.createCollection(adminUser.token, {
-            name: `Test collection ${Math.floor(Math.random() * 999999)}`,
-            owner_uuid: activeUser.user.uuid,
-            manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n"
-        })
-            .as('testCollection').then(function () {
-                cy.loginAs(activeUser);
-                cy.goToPath(`/collections/${this.testCollection.uuid}`);
-
-                ['subdir', 'G%C3%BCnter\'s%20file', 'table%&?*2'].forEach((subdir) => {
-                    cy.get('[data-cy=collection-files-panel]')
-                        .contains('bar').rightclick({force: true});
-                    cy.get('[data-cy=context-menu]')
-                        .contains('Rename')
-                        .click();
-                    cy.get('[data-cy=form-dialog]')
-                        .should('contain', 'Rename')
-                        .within(() => {
-                            cy.get('input').type(`{selectall}{backspace}${subdir}/foo`);
-                        });
-                    cy.get('[data-cy=form-submit-btn]').click();
-                    cy.get('[data-cy=collection-files-panel]')
-                        .should('not.contain', 'bar')
-                        .and('contain', subdir);
-                    // Look for the "arrow icon" and expand the "subdir" directory.
-                    cy.get('[data-cy=virtual-file-tree] > div > i').click();
-                    // Rename 'subdir/foo' to 'foo'
-                    cy.get('[data-cy=collection-files-panel]')
-                        .contains('foo').rightclick();
-                    cy.get('[data-cy=context-menu]')
-                        .contains('Rename')
-                        .click();
-                    cy.get('[data-cy=form-dialog]')
-                        .should('contain', 'Rename')
-                        .within(() => {
-                            cy.get('input')
-                                .should('have.value', `${subdir}/foo`)
-                                .type(`{selectall}{backspace}bar`);
-                        });
-                    cy.get('[data-cy=form-submit-btn]').click();
-                    cy.get('[data-cy=collection-files-panel]')
-                        .should('contain', subdir) // empty dir kept
-                        .and('contain', 'bar');
-
-                    cy.get('[data-cy=collection-files-panel]')
-                        .contains(subdir).rightclick();
-                    cy.get('[data-cy=context-menu]')
-                        .contains('Remove')
-                        .click();
-                    cy.get('[data-cy=confirmation-dialog-ok-btn]').click();
-                });
-            });
-    });
-
     it('renames a file to a different directory', function () {
         // Creates the collection using the admin token so we can set up
         // a bogus manifest text without block signatures.
index b3d6bbed83b657ab3990c0aeb435aa1a34b8e67a..3ffdcc2df2cbc796db9ea4a4314a32cbd2809560 100644 (file)
@@ -28,7 +28,7 @@ describe('Project tests', function() {
         cy.clearLocalStorage();
     });
 
-    it('adds creates a new project with properties', function() {
+    it('creates a new project with properties', function() {
         const projName = `Test project (${Math.floor(999999 * Math.random())})`;
         cy.loginAs(activeUser);
         cy.get('[data-cy=side-panel-button]').click();
index 058db81b89ce71e4a907d45d3590c14039e31305..399f4ef4ef273569dda2c30d440229b58f4c8708 100644 (file)
@@ -160,6 +160,7 @@ export const DetailsPanel = withStyles(styles)(
 
                 const item = getItem(res);
                 return <Grid
+                    data-cy='details-panel'
                     container
                     direction="column"
                     item
index b634715f8ac6ebd7b58123c0dd4316e99d2c577c..2502f50a6646bbb72eb170a88b8876d453aad1f8 100644 (file)
@@ -60,6 +60,7 @@ export const ResourcePropertiesDialog = connect(mapStateToProps, mapDispatchToPr
                     onClose={closeDialog}
                     fullWidth
                     maxWidth='sm'>
+                    <div data-cy='resource-properties-dialog'>
                     <DialogTitle>Edit properties</DialogTitle>
                     <DialogContent>
                         <ResourcePropertiesDialogForm uuid={resource ? resource.uuid : ''} />
@@ -80,12 +81,14 @@ export const ResourcePropertiesDialog = connect(mapStateToProps, mapDispatchToPr
                     </DialogContent>
                     <DialogActions>
                         <Button
+                            data-cy='close-dialog-btn'
                             variant='text'
                             color='primary'
                             onClick={closeDialog}>
                             Close
                     </Button>
                     </DialogActions>
+                    </div>
                 </Dialog>
             )
     ));
index 5aeaef184724d3ac90fc5ede3ff296aa979152fa..adc3e9959418926500276f2ba99f8d5290dabe6f 100644 (file)
@@ -345,7 +345,7 @@ export const CollectionDetailsAttributes = connect(null, mapDispatchToProps)(
             <DetailsAttribute classLabel={classes.label} classValue={classes.value}
                 label='Properties'>
                 { !props.twoCol
-                    ? <div onClick={props.onClick}>
+                    ? <div data-cy='property-editor-btn' onClick={props.onClick}>
                         <RenameIcon className={classes.editIcon} />
                     </div>
                     : '' }