From eebaa364deafa90ecfe0e7a2a22140a9e4a30be1 Mon Sep 17 00:00:00 2001 From: Eli Yukelzon Date: Mon, 7 Sep 2020 13:58:39 +0300 Subject: [PATCH] MM-27804 - Cypress/E2E: Attachments > File Upload (#6333) * Cypress/E2E: Automate backlogs - Attachments > File Upload * made test less flaky * code review --- .../upload_files_spec.js | 22 +++++++++++++++++++ package-lock.json | 21 +++++++++++++----- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/e2e/cypress/integration/files_and_attachments/upload_files_spec.js b/e2e/cypress/integration/files_and_attachments/upload_files_spec.js index c76f9f6a15cf..ae77a31bae42 100644 --- a/e2e/cypress/integration/files_and_attachments/upload_files_spec.js +++ b/e2e/cypress/integration/files_and_attachments/upload_files_spec.js @@ -287,6 +287,28 @@ describe('Upload Files', () => { cy.findByText('Unable to get the file info.').should('be.visible'); cy.findByText('Back to Mattermost').should('be.visible').parent().should('have.attr', 'href', '/'); }); + + it('MM-T337 CTRL/CMD+U - Five files on one message, thumbnails while uploading', () => { + cy.visit(`/${testTeam.name}/channels/town-square`); + const filename = 'huge-image.jpg'; + cy.get('#centerChannelFooter').find('#fileUploadInput'). + attachFile(filename). + attachFile(filename). + attachFile(filename). + attachFile(filename). + attachFile(filename); + for (let i = 1; i < 4; i++) { + cy.get(`:nth-child(${i}) > .post-image__thumbnail > .post-image`).should('be.visible'); + } + cy.get(':nth-child(5) > .post-image__thumbnail > .post-image').should('not.be.visible'); + cy.get('.file-preview__container').scrollTo('right'); + for (let i = 1; i < 3; i++) { + cy.get(`:nth-child(${i}) > .post-image__thumbnail > .post-image`).should('not.be.visible'); + } + cy.get(':nth-child(5) > .post-image__thumbnail > .post-image').should('be.visible'); + cy.postMessage('test'); + cy.findByTestId('fileAttachmentList').find('.post-image').should('have.length', 5); + }); }); function verifyLinkHasDownloadProperties(fileAttachment, filename) { diff --git a/package-lock.json b/package-lock.json index 4713b10dca7a..5fca1c417218 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8234,7 +8234,7 @@ }, "p-cancelable": { "version": "0.4.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", + "resolved": "http://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", "dev": true, "optional": true @@ -10624,14 +10624,14 @@ "dependencies": { "file-type": { "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "resolved": "http://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", "dev": true, "optional": true }, "get-stream": { "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "resolved": "http://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", "dev": true, "optional": true, @@ -13294,7 +13294,10 @@ "version": "1.3.1", "resolved": "https://registry.npmjs.org/full-icu/-/full-icu-1.3.1.tgz", "integrity": "sha512-VMtK//85QJomhk3cXOCksNwOYaw1KWnYTS37GYGgyf7A3ajdBoPGhaJuJWAH2S2kq8GZeXkdKn+3Mfmgy11cVw==", - "dev": true + "dev": true, + "requires": { + "icu4c-data": "0.67.2" + } }, "function-bind": { "version": "1.1.1", @@ -14301,6 +14304,12 @@ "postcss": "^7.0.14" } }, + "icu4c-data": { + "version": "0.67.2", + "resolved": "https://registry.npmjs.org/icu4c-data/-/icu4c-data-0.67.2.tgz", + "integrity": "sha512-OIRiop+k1IVf4TBLEOj910duoO9NKwtJLwp++qWT6KT5gRziHNt+5gwhcGuTqRy++RTK2gLoAIbk8KYCNxW++g==", + "dev": true + }, "identity-obj-proxy": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz", @@ -15026,7 +15035,7 @@ }, "into-stream": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", + "resolved": "http://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=", "dev": true, "optional": true, @@ -19735,7 +19744,7 @@ }, "p-is-promise": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", + "resolved": "http://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", "dev": true, "optional": true