From efb6e397a2d9ec98c8a9fa1f47bea66d8651bb81 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Fri, 11 Feb 2022 18:04:16 -0300 Subject: [PATCH] 18315: Adds file upload test proving that the UI is correctly updated. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- cypress/integration/collection.spec.js | 35 ++++++++++++++----- .../collection-panel/collection-panel.tsx | 2 +- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/cypress/integration/collection.spec.js b/cypress/integration/collection.spec.js index f6547aae..91f58904 100644 --- a/cypress/integration/collection.spec.js +++ b/cypress/integration/collection.spec.js @@ -890,17 +890,15 @@ describe('Collection panel tests', function () { name: `Test collection ${Math.floor(Math.random() * 999999)}`, owner_uuid: activeUser.user.uuid, manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n" - }) - .as('testCollection1'); + }).as('testCollection1'); cy.createCollection(adminUser.token, { name: `Test collection ${Math.floor(Math.random() * 999999)}`, owner_uuid: adminUser.user.uuid, manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n" - }) - .as('testCollection2').then(function (testCollection2) { - cy.shareWith(adminUser.token, activeUser.user.uuid, testCollection2.uuid, 'can_write'); - }); + }).as('testCollection2').then(function (testCollection2) { + cy.shareWith(adminUser.token, activeUser.user.uuid, testCollection2.uuid, 'can_write'); + }); cy.getAll('@testCollection1', '@testCollection2') .then(function ([testCollection1, testCollection2]) { @@ -922,8 +920,29 @@ describe('Collection panel tests', function () { name: `Test collection ${Math.floor(Math.random() * 999999)}`, owner_uuid: activeUser.user.uuid, manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:bar\n" - }) - .as('testCollection1'); + }).as('testCollection1'); + }); + + it('uploads a file and checks the collection UI to be fresh', () => { + cy.getAll('@testCollection1') + .then(function([testCollection1]) { + cy.loginAs(activeUser); + cy.goToPath(`/collections/${testCollection1.uuid}`); + cy.get('[data-cy=upload-button]').click(); + cy.get('[data-cy=collection-files-panel]') + .contains('5mb_a.bin').should('not.exist'); + cy.get('[data-cy=collection-file-count]').should('contain', '1'); + cy.fixture('files/5mb.bin', 'base64').then(content => { + cy.get('[data-cy=drag-and-drop]').upload(content, '5mb_a.bin'); + cy.get('[data-cy=form-submit-btn]').click(); + cy.get('[data-cy=form-submit-btn]').should('not.exist'); + }); + // Confirm that the file browser has been updated. + cy.get('[data-cy=collection-files-panel]') + .contains('5mb_a.bin').should('exist'); + // Confirm that the collection panel has been updated. + cy.get('[data-cy=collection-file-count]').should('contain', '2'); + }); }); it('allows to cancel running upload', () => { diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx index d513cfb4..dce8ef8f 100644 --- a/src/views/collection-panel/collection-panel.tsx +++ b/src/views/collection-panel/collection-panel.tsx @@ -323,7 +323,7 @@ export const CollectionDetailsAttributes = (props: CollectionDetailsProps) => { + label='Number of files' value={{item.fileCount}} />