From 88754db3dfb963c3995a5b057f4fe43fa3ee87ad Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Wed, 20 Jan 2021 09:26:31 +0300 Subject: [PATCH 1/7] Add the test. --- ...create_task_without_necessary_arguments.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js diff --git a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js new file mode 100644 index 000000000000..a508be64181f --- /dev/null +++ b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js @@ -0,0 +1,37 @@ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT + +/// + +context('Try to create a task without necessary arguments.', () => { + const caseId = '40'; + const labelName = `Case ${caseId}`; + const taskName = `New annotation task for ${labelName}`; + const attrName = `Attr for ${labelName}`; + const textDefaultValue = 'Some default value for type Text'; + const imagesCount = 1; + 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; + + before(() => { + cy.visit('auth/login'); + cy.login(); + cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount); + cy.createZipArchive(directoryToArchive, archivePath); + }); + + describe(`Testing "${labelName}"`, () => { + it('Go to create task page', () => { + cy.log('121212'); + }); + }); +}); From ad76115a9c3b3842a45d17b68d3ba0f8c6107254 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Wed, 20 Jan 2021 11:17:22 +0300 Subject: [PATCH 2/7] Add css classes. --- .../src/components/create-task-page/create-task-content.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cvat-ui/src/components/create-task-page/create-task-content.tsx b/cvat-ui/src/components/create-task-page/create-task-content.tsx index c5a3b6a3bee6..7abf5da2cb1e 100644 --- a/cvat-ui/src/components/create-task-page/create-task-content.tsx +++ b/cvat-ui/src/components/create-task-page/create-task-content.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -86,6 +86,7 @@ class CreateTaskContent extends React.PureComponent Date: Wed, 20 Jan 2021 11:18:32 +0300 Subject: [PATCH 3/7] Add cypress test. Try to create a task without necessary arguments. --- ...create_task_without_necessary_arguments.js | 38 ++++++++++++++++--- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js index a508be64181f..3e16ea85393a 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js +++ b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // // SPDX-License-Identifier: MIT @@ -8,8 +8,6 @@ context('Try to create a task without necessary arguments.', () => { const caseId = '40'; const labelName = `Case ${caseId}`; const taskName = `New annotation task for ${labelName}`; - const attrName = `Attr for ${labelName}`; - const textDefaultValue = 'Some default value for type Text'; const imagesCount = 1; const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`; const width = 800; @@ -30,8 +28,38 @@ context('Try to create a task without necessary arguments.', () => { }); describe(`Testing "${labelName}"`, () => { - it('Go to create task page', () => { - cy.log('121212'); + it('Go to create task page.', () => { + cy.get('#cvat-create-task-button').click(); + }); + + it('Try to create a task without any fields. A task is not created.', () => { + cy.get('.cvat-create-task-submit-section').click(); + cy.get('.cvat-notification-create-task-fail').should('exist'); + cy.closeNotification('.cvat-notification-create-task-fail'); + }); + + it('Input a task name. Try to create a task without any fields. A task is not created.', () => { + cy.get('[id="name"]').type(taskName); + cy.get('.cvat-create-task-submit-section').click(); + cy.get('.cvat-notification-create-task-fail').should('exist'); + cy.closeNotification('.cvat-notification-create-task-fail'); + }); + + it('Input task labels. Try to create a task without any fields. A task is not created.', () => { + cy.addNewLabel(labelName); + cy.get('.cvat-create-task-submit-section').click(); + cy.get('.cvat-notification-create-task-fail').should('exist'); + cy.closeNotification('.cvat-notification-create-task-fail'); + }); + + it('Add some files. Try to create a task without any fields. A task created.', () => { + cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' }); + cy.get('.cvat-create-task-submit-section').click(); + cy.get('.cvat-notification-create-task-fail').should('not.exist'); + cy.get('.cvat-notification-create-task-success').should('exist'); + // Check that the interface is prepared for creating the next task. + cy.get('[id="name"]').should('have.value', ''); + cy.get('.cvat-constructor-viewer-item').should('not.exist'); }); }); }); From 7e569e7470e9e0837bbf83c9b45a7fd8a1a76c19 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Wed, 20 Jan 2021 11:21:42 +0300 Subject: [PATCH 4/7] Update copyright year --- .../case_40_create_task_without_necessary_arguments.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js index 3e16ea85393a..3528d737c77a 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js +++ b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2021 Intel Corporation +// Copyright (C) 2021 Intel Corporation // // SPDX-License-Identifier: MIT From 76fa70e6bdb9c0db1034dc42bebeb86541b22838 Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Wed, 20 Jan 2021 12:52:18 +0300 Subject: [PATCH 5/7] Add step for deleting the task. --- .../case_40_create_task_without_necessary_arguments.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js index 3528d737c77a..cbc8601db250 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js +++ b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js @@ -27,6 +27,13 @@ context('Try to create a task without necessary arguments.', () => { cy.createZipArchive(directoryToArchive, archivePath); }); + after(() => { + cy.goToTaskList(); + cy.getTaskID(taskName).then(($taskID) => { + cy.deleteTask(taskName, $taskID); + }); + }); + describe(`Testing "${labelName}"`, () => { it('Go to create task page.', () => { cy.get('#cvat-create-task-button').click(); From c2308a1ac0973124129cc50136cb7ca70de200fc Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Thu, 21 Jan 2021 15:11:10 +0300 Subject: [PATCH 6/7] Apply comments. --- .../case_40_create_task_without_necessary_arguments.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js index cbc8601db250..a374711f7a11 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js +++ b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js @@ -45,21 +45,21 @@ context('Try to create a task without necessary arguments.', () => { cy.closeNotification('.cvat-notification-create-task-fail'); }); - it('Input a task name. Try to create a task without any fields. A task is not created.', () => { + it('Input a task name. A task is not created.', () => { cy.get('[id="name"]').type(taskName); cy.get('.cvat-create-task-submit-section').click(); cy.get('.cvat-notification-create-task-fail').should('exist'); cy.closeNotification('.cvat-notification-create-task-fail'); }); - it('Input task labels. Try to create a task without any fields. A task is not created.', () => { + it('Input task labels. A task is not created.', () => { cy.addNewLabel(labelName); cy.get('.cvat-create-task-submit-section').click(); cy.get('.cvat-notification-create-task-fail').should('exist'); cy.closeNotification('.cvat-notification-create-task-fail'); }); - it('Add some files. Try to create a task without any fields. A task created.', () => { + it('Add some files. A task created.', () => { cy.get('input[type="file"]').attachFile(archiveName, { subjectType: 'drag-n-drop' }); cy.get('.cvat-create-task-submit-section').click(); cy.get('.cvat-notification-create-task-fail').should('not.exist'); From 96bdc8e714f32f67939e56143f8ba0fb5a10acba Mon Sep 17 00:00:00 2001 From: dvkruchinin Date: Tue, 26 Jan 2021 10:44:22 +0300 Subject: [PATCH 7/7] Apply comments. --- .../case_40_create_task_without_necessary_arguments.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js index a374711f7a11..98c4f62c0b3c 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js +++ b/tests/cypress/integration/actions_tasks_objects/case_40_create_task_without_necessary_arguments.js @@ -25,6 +25,7 @@ context('Try to create a task without necessary arguments.', () => { cy.login(); cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount); cy.createZipArchive(directoryToArchive, archivePath); + cy.get('#cvat-create-task-button').click(); }); after(() => { @@ -35,10 +36,6 @@ context('Try to create a task without necessary arguments.', () => { }); describe(`Testing "${labelName}"`, () => { - it('Go to create task page.', () => { - cy.get('#cvat-create-task-button').click(); - }); - it('Try to create a task without any fields. A task is not created.', () => { cy.get('.cvat-create-task-submit-section').click(); cy.get('.cvat-notification-create-task-fail').should('exist');