-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cypress/unit tests. Label deleting feature. (#2953)
* Add dummy second label * Add unit tests * Update cypress command * Add cypress tests * Revert command.js requare * Add css classes * Add css class
- Loading branch information
1 parent
eb1cb83
commit c3fb14b
Showing
9 changed files
with
200 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 89 additions & 0 deletions
89
tests/cypress/integration/actions_projects/case_57_project_label_deleting_feature.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { projectName, labelName } from '../../support/const_project'; | ||
|
||
context('Delete a label from a project.', () => { | ||
const caseID = 57; | ||
const taskName = `Task case ${caseID}`; | ||
const attrName = `Attr for ${labelName}`; | ||
const textDefaultValue = 'Some value for type Text'; | ||
const imagesCount = 1; | ||
const imageFileName = `image_${taskName.replace(/\s+/g, '_').toLowerCase()}`; | ||
const width = 800; | ||
const height = 800; | ||
const posX = 10; | ||
const posY = 10; | ||
const color = 'white'; | ||
const archiveName = `${imageFileName}.zip`; | ||
const archivePath = `cypress/fixtures/${archiveName}`; | ||
const imagesFolder = `cypress/fixtures/${imageFileName}`; | ||
const directoryToArchive = imagesFolder; | ||
const advancedConfigurationParams = false; | ||
const forProject = true; | ||
const attachToProject = false; | ||
const multiAttrParams = false; | ||
let projectID = ''; | ||
|
||
function getProjectID(projectName) { | ||
cy.contains('.cvat-project-name', projectName) | ||
.parents('.cvat-project-details') | ||
.should('have.attr', 'cvat-project-id') | ||
.then(($projectID) => { | ||
projectID = $projectID; | ||
}); | ||
} | ||
|
||
before(() => { | ||
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount); | ||
cy.createZipArchive(directoryToArchive, archivePath); | ||
cy.openProject(projectName); | ||
}); | ||
|
||
after(() => { | ||
cy.goToProjectsList(); | ||
cy.deleteProject(projectName, projectID); | ||
}); | ||
|
||
describe(`Testing "Case ${caseID}"`, () => { | ||
it('Create a task from project.', () => { | ||
cy.createAnnotationTask( | ||
taskName, | ||
labelName, | ||
attrName, | ||
textDefaultValue, | ||
archiveName, | ||
multiAttrParams, | ||
advancedConfigurationParams, | ||
forProject, | ||
attachToProject, | ||
projectName, | ||
); | ||
}); | ||
|
||
it('Delete a label from project.', () => { | ||
cy.openProject(projectName); | ||
getProjectID(projectName); | ||
cy.contains('.cvat-constructor-viewer-item', labelName) | ||
.should('exist') | ||
.and('be.visible') | ||
.find('[aria-label="close"]') | ||
.click(); | ||
cy.get('.cvat-modal-delete-label') | ||
.should('be.visible') | ||
.within(() => { | ||
cy.contains('[type="button"]', 'OK').click(); | ||
}); | ||
cy.contains('.cvat-constructor-viewer-item', labelName).should('not.exist'); | ||
}); | ||
|
||
it('Try to open job with no labels in the project. Successful.', () => { | ||
cy.openTaskJob(taskName); | ||
cy.get('.cvat-disabled-canvas-control').should('exist'); | ||
cy.contains('.cvat-notification-no-labels', 'does not contain any label').should('exist').and('be.visible'); | ||
}); | ||
}); | ||
}); |
60 changes: 60 additions & 0 deletions
60
tests/cypress/integration/actions_tasks_objects/case_58_task_label_deleting_feature.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
context('Delete a label from a task.', () => { | ||
const caseId = '58'; | ||
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); | ||
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName); | ||
cy.openTask(taskName); | ||
}); | ||
|
||
after(() => { | ||
cy.goToTaskList(); | ||
cy.deleteTask(taskName); | ||
}); | ||
|
||
describe(`Testing "${labelName}"`, () => { | ||
it('Delete a label from the task.', () => { | ||
cy.contains('.cvat-constructor-viewer-item', labelName) | ||
.should('exist') | ||
.and('be.visible') | ||
.find('[aria-label="close"]') | ||
.click(); | ||
cy.get('.cvat-modal-delete-label') | ||
.should('be.visible') | ||
.within(() => { | ||
cy.contains('[type="button"]', 'OK').click(); | ||
}); | ||
cy.contains('.cvat-constructor-viewer-item', labelName).should('not.exist'); | ||
}); | ||
|
||
it('Try to open a job with no labels. Successful.', () => { | ||
cy.openJob(); | ||
cy.get('.cvat-disabled-canvas-control').should('exist'); | ||
cy.contains('.cvat-notification-no-labels', 'does not contain any label').should('exist').and('be.visible'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters