diff --git a/tests/cypress/integration/actions_tasks_objects/issue_2661_displaying_attached_files_when_creating_task.js b/tests/cypress/integration/actions_tasks_objects/issue_2661_displaying_attached_files_when_creating_task.js new file mode 100644 index 00000000..33a33ae5 --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/issue_2661_displaying_attached_files_when_creating_task.js @@ -0,0 +1,45 @@ +// Copyright (C) 2021 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +context('Displaying attached files when creating a task.', () => { + const issueId = '2661'; + const labelName = `Issue ${issueId}`; + const imagesCount = 5; + const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`; + const width = 800; + const height = 800; + const posX = 10; + const posY = 10; + const color = 'gray'; + const archiveName = `${imageFileName}.zip`; + const archivePath = `cypress/fixtures/${archiveName}`; + const imagesFolder = `cypress/fixtures/${imageFileName}`; + const directoryToArchive = imagesFolder; + let imageListToAttach = []; + for (let i = 1; i <= imagesCount; i++) { + imageListToAttach.push(`${imageFileName}/${imageFileName}_${i}.png`); + } + + before(() => { + cy.visit('auth/login'); + cy.login(); + cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount); + cy.createZipArchive(directoryToArchive, archivePath); + cy.get('#cvat-create-task-button').click(); + }); + + describe(`Testing "${labelName}"`, () => { + it('Attach a files. Attached files is visible.', () => { + cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' }); + cy.get('.cvat-file-manager-local-tab').should('contain', archiveName).and('be.visible'); + }); + + it('Attach more then 4 files. Attached files is visible and contain text " files selected".', () => { + cy.get('input[type="file"]').attachFile(imageListToAttach, { subjectType: 'drag-n-drop' }); + cy.get('.cvat-file-manager-local-tab').should('contain', `${imagesCount} files selected`).and('be.visible'); + }); + }); +}); diff --git a/tests/package-lock.json b/tests/package-lock.json index 2032322d..41483677 100644 --- a/tests/package-lock.json +++ b/tests/package-lock.json @@ -2869,18 +2869,18 @@ } }, "cypress-file-upload": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-4.1.1.tgz", - "integrity": "sha512-tX6UhuJ63rNgjdzxglpX+ZYf/bM6PDhFMtt1qCBljLtAgdearqyfD1AHqyh59rOHCjfM+bf6FA3o9b/mdaX6pw==", + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/cypress-file-upload/-/cypress-file-upload-5.0.2.tgz", + "integrity": "sha512-QRPnQPeEaW+HMVB62/htIsKh7Kd/x2uzoHKEQxh7LCD+4IaG0rAjLZupCIjjUh+JnRymgfir8wOYtFSJCNWlpA==", "dev": true, "requires": { - "mime": "^2.4.4" + "mime": "^2.5.0" }, "dependencies": { "mime": { - "version": "2.4.6", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.4.6.tgz", - "integrity": "sha512-RZKhC3EmpBchfTGBVb8fb+RL2cWyw/32lshnsETttkBAyAUXSGHxbEJWWRXc751DrIxG1q04b8QwMbAwkRPpUA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.0.tgz", + "integrity": "sha512-ft3WayFSFUVBuJj7BMLKAQcSlItKtfjsKDDsii3rqFDAZ7t11zRe8ASw/GlmivGwVUYtwkQrxiGGpL6gFvB0ag==", "dev": true } } diff --git a/tests/package.json b/tests/package.json index 64560769..71cec39d 100644 --- a/tests/package.json +++ b/tests/package.json @@ -6,9 +6,9 @@ "devDependencies": { "@cypress/code-coverage": "^3.8.1", "cypress": "^5.0.0", - "cypress-file-upload": "^4.1.1", - "cypress-plugin-tab": "^1.0.5", - "cypress-localstorage-commands": "^1.3.1" + "cypress-file-upload": "^5.0.2", + "cypress-localstorage-commands": "^1.3.1", + "cypress-plugin-tab": "^1.0.5" }, "dependencies": { "archiver": "^5.0.0",