Merge remote-tracking branch 'origin/main' into 18169-cancel-button-not-working
authorDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Fri, 19 Nov 2021 15:34:49 +0000 (16:34 +0100)
committerDaniel Kutyła <daniel.kutyla@contractors.roche.com>
Fri, 19 Nov 2021 15:34:55 +0000 (16:34 +0100)
Arvados-DCO-1.1-Signed-off-by: Daniel Kutyła <daniel.kutyla@contractors.roche.com>

1  2 
cypress/integration/collection.spec.js
src/services/collection-service/collection-service.ts

index 31337e28a72237d2e9c2d5551d7b30327c434957,3e06d7e5a0b2bb03b3de36e2cecfe1241b4dbdd0..e46be0c366717da85f09f7e60d121393e91cfd65
@@@ -97,14 -97,37 +97,37 @@@ describe('Collection panel tests', func
                  });
                  // Confirm proper vocabulary labels are displayed on the UI.
                  cy.get('[data-cy=collection-properties-panel]')
-                     .should('contain', 'Color')
-                     .and('contain', 'Magenta');
+                     .should('contain', 'Color: Magenta');
                  // Confirm proper vocabulary IDs were saved on the backend.
                  cy.doRequest('GET', `/arvados/v1/collections/${this.testCollection.uuid}`)
                      .its('body').as('collection')
                      .then(function () {
                          expect(this.collection.properties.IDTAGCOLORS).to.equal('IDVALCOLORS3');
                      });
+                 // Case-insensitive on-blur auto-selection test
+                 // Key: Size (IDTAGSIZES) - Value: Small (IDVALSIZES2)
+                 cy.get('[data-cy=resource-properties-form]').within(() => {
+                     cy.get('[data-cy=property-field-key]').within(() => {
+                         cy.get('input').type('sIzE');
+                     });
+                     cy.get('[data-cy=property-field-value]').within(() => {
+                         cy.get('input').type('sMaLL');
+                     });
+                     // Cannot "type()" TAB on Cypress so let's click another field
+                     // to trigger the onBlur event.
+                     cy.get('[data-cy=property-field-key]').click();
+                     cy.root().submit();
+                 });
+                 // Confirm proper vocabulary labels are displayed on the UI.
+                 cy.get('[data-cy=collection-properties-panel]')
+                     .should('contain', 'Size: S');
+                 // Confirm proper vocabulary IDs were saved on the backend.
+                 cy.doRequest('GET', `/arvados/v1/collections/${this.testCollection.uuid}`)
+                     .its('body').as('collection')
+                     .then(function () {
+                         expect(this.collection.properties.IDTAGSIZES).to.equal('IDVALSIZES2');
+                     });
              });
      });
  
                      .contains(adminUser.user.uuid);
              });
      });
 +
 +    describe('file upload', () => {
 +        it('allows to cancel running upload', () => {
 +            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('testCollection1');
 +
 +            cy.getAll('@testCollection1')
 +                .then(function([testCollection1]) {
 +                    cy.loginAs(activeUser);
 +
 +                    cy.goToPath(`/collections/${testCollection1.uuid}`);
 +
 +                    cy.get('[data-cy=upload-button]').click();
 +
 +                    cy.fixture('files/5mb.bin', 'base64').then(content => {
 +                        cy.get('[data-cy=drag-and-drop]').upload(content, '5mb_a.bin');
 +                        cy.get('[data-cy=drag-and-drop]').upload(content, '5mb_b.bin');
 +
 +                        cy.wait(1000);
 +
 +                        cy.get('[data-cy=form-submit-btn]').click();
 +
 +                        cy.wait(10);
 +
 +                        cy.get('button').contains('Cancel').click();
 +
 +                        cy.get('[data-cy=form-submit-btn]').should('not.exist');
 +                    });
 +                });
 +        });
 +
 +        it('allows to cancel single file from the running upload', () => {
 +            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('testCollection1');
 +
 +            cy.getAll('@testCollection1')
 +                .then(function([testCollection1]) {
 +                    cy.loginAs(activeUser);
 +
 +                    cy.goToPath(`/collections/${testCollection1.uuid}`);
 +
 +                    cy.get('[data-cy=upload-button]').click();
 +
 +                    cy.fixture('files/5mb.bin', 'base64').then(content => {
 +                        cy.get('[data-cy=drag-and-drop]').upload(content, '5mb_a.bin');
 +                        cy.get('[data-cy=drag-and-drop]').upload(content, '5mb_b.bin');
 +
 +                        cy.wait(1000);
 +
 +                        cy.get('[data-cy=form-submit-btn]').click();
 +
 +                        cy.wait(10);
 +
 +                        cy.get('button[aria-label=Remove]').eq(1).click();
 +                    });
 +                });
 +        });
 +    });
  })
index 52fbf1a5c50b8cf8e198b0b88b6739934e206651,0c3cda3bcb8abcc2ae779cf83156cdd54d7e3373..48e797c500e8b7e3dade9fc15727773176805773
@@@ -33,7 -33,8 +33,8 @@@ export class CollectionService extends 
      }
  
      update(uuid: string, data: Partial<CollectionResource>) {
-         return super.update(uuid, { ...data, preserveVersion: true });
+         const select = [...Object.keys(data), 'version', 'modifiedAt'];
+         return super.update(uuid, { ...data, preserveVersion: true }, select);
      }
  
      async files(uuid: string) {
              },
              onUploadProgress: (e: ProgressEvent) => {
                  onProgress(fileId, e.loaded, e.total, Date.now());
 -            }
 +            },
          };
          return this.webdavClient.upload(fileURL, [file], requestConfig);
      }