Skip to content

Commit

Permalink
Update cypress test. Label constructor. Color label. Label name editi…
Browse files Browse the repository at this point in the history
…ng. (#3068)

* Update Cypress test "Label constructor. Color label. Label name editing"

* Fix for Firefox
  • Loading branch information
dvkruchinin authored Apr 6, 2021
1 parent 92e5ab6 commit babf1a3
Showing 1 changed file with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,57 @@ context('Label constructor. Color label. Label name editing', () => {
});
});
});

it('Cancel/reset button interaction when changing color of the label.', () => {
cy.goToTaskList();
cy.openTask(taskName);
// Adding a label without setting a color
cy.addNewLabel(`Case ${caseId}`);
cy.get('.cvat-constructor-viewer').should('be.visible');
cy.contains('.cvat-constructor-viewer-item', `Case ${caseId}`)
.invoke('attr', 'style')
.then(($labelColor) => {
// Change the label color and press "Cancel"
cy.contains('.cvat-constructor-viewer-item', `Case ${caseId}`).find('[data-icon="edit"]').click();
cy.get('.cvat-change-task-label-color-badge')
.children()
.invoke('attr', 'style')
.then(($labelBadgeColor) => {
expect($labelBadgeColor).to.be.equal($labelColor);
});
cy.get('.cvat-change-task-label-color-button').click();
cy.get('.cvat-label-color-picker')
.not('.ant-popover-hidden')
.within(() => {
cy.contains('hex').prev().clear().type(labelColor.yellowHex);
cy.contains('button', 'Cancel').click();
});
cy.get('.cvat-change-task-label-color-badge')
.children()
.invoke('attr', 'style')
.then(($labelBadgeColor) => {
expect($labelBadgeColor).to.be.equal($labelColor);
});

// Change the label color
cy.get('.cvat-change-task-label-color-button').click();
cy.changeColorViaBadge(labelColor.yellowHex);

// Reset the label color
cy.get('.cvat-change-task-label-color-button').click();
cy.get('.cvat-label-color-picker')
.not('.ant-popover-hidden')
.within(() => {
cy.contains('button', 'Reset').click();
});
cy.get('.cvat-change-task-label-color-badge')
.children()
.should('have.attr', 'style').and('contain', 'rgb(179, 179, 179)');
cy.get('.cvat-label-constructor-updater').contains('button', 'Done').click();
cy.contains('.cvat-constructor-viewer-item', `Case ${caseId}`)
.should('have.attr', 'style')
.and('contain', $labelColor);
});
});
});
});

0 comments on commit babf1a3

Please sign in to comment.