-
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 test. Add/delete labels and attributes. (#2693)
* Cypress test. Add/delete labels and attributes. * Apply comments.
- Loading branch information
1 parent
f14a928
commit 3ced77c
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
tests/cypress/integration/actions_tasks_objects/case_41_add_delete_label_attribute.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,71 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
context('Add/delete labels and attributes.', () => { | ||
const caseId = '41'; | ||
const labelName = `Case ${caseId}`; | ||
const attrName = `Attr for ${labelName}`; | ||
const textDefaultValue = 'Some default value for type Text'; | ||
|
||
before(() => { | ||
cy.visit('auth/login'); | ||
cy.login(); | ||
cy.get('#cvat-create-task-button').click(); | ||
}); | ||
|
||
describe(`Testing "${labelName}"`, () => { | ||
it('Start adding a label. Press Cancel. The label is not created.', () => { | ||
cy.get('.cvat-constructor-viewer-new-item').click(); // Open label constructor | ||
cy.get('[placeholder="Label name"]').type(labelName); | ||
cy.contains('[type="button"]', 'Cancel').click(); | ||
cy.get('.cvat-constructor-viewer-item').should('not.exist'); | ||
}); | ||
|
||
it('Start adding a label. Start adding an attribute. Press Cancel. The label is not created.', () => { | ||
cy.get('.cvat-constructor-viewer-new-item').click(); | ||
cy.get('[placeholder="Label name"]').type(labelName); | ||
cy.get('.cvat-new-attribute-button').click(); | ||
cy.get('.cvat-attribute-name-input').type(attrName); | ||
cy.get('.cvat-attribute-type-input').click(); | ||
cy.get('.cvat-attribute-type-input-text').click(); | ||
cy.get('.cvat-attribute-values-input').type(textDefaultValue); | ||
cy.contains('[type="button"]', 'Cancel').click(); | ||
cy.get('.cvat-constructor-viewer-item').should('not.exist'); | ||
}); | ||
|
||
it('Start adding a label. Add an attribute. Press Done. The label should be created.', () => { | ||
cy.get('.cvat-constructor-viewer-new-item').click(); | ||
cy.get('[placeholder="Label name"]').type(labelName); | ||
cy.get('.cvat-new-attribute-button').click(); | ||
cy.get('.cvat-attribute-name-input').type(attrName); | ||
cy.get('.cvat-attribute-type-input').click(); | ||
cy.get('.cvat-attribute-type-input-text').click(); | ||
cy.get('.cvat-attribute-values-input').type(textDefaultValue); | ||
cy.contains('[type="submit"]', 'Done').click(); | ||
cy.get('.cvat-constructor-viewer-item').should('exist'); | ||
}); | ||
|
||
it('Start to edit the label. Attribute should exist. Remove the atrribute. Press Done.', () => { | ||
cy.get('.cvat-constructor-viewer-item').find('[aria-label="edit"]').click(); | ||
cy.get('.cvat-attribute-inputs-wrapper') | ||
.should('exist') | ||
.within(() => { | ||
cy.get('.cvat-delete-attribute-button').click(); | ||
}); | ||
cy.get('.cvat-attribute-inputs-wrapper').should('not.exist'); | ||
cy.contains('[type="submit"]', 'Done').click(); | ||
// After deleting the attribute and saving the changes, check that the attribute is missing. | ||
cy.get('.cvat-constructor-viewer-item').find('[aria-label="edit"]').click(); | ||
cy.get('.cvat-attribute-inputs-wrapper').should('not.exist'); | ||
cy.contains('[type="button"]', 'Cancel').click(); | ||
}); | ||
|
||
it('Delete the added label. The label removed.', () => { | ||
cy.get('.cvat-constructor-viewer-item').find('[aria-label="close"]').click(); | ||
cy.get('.cvat-constructor-viewer-item').should('not.exist'); | ||
}); | ||
}); | ||
}); |