Skip to content

Commit babf1a3

Browse files
authored
Update cypress test. Label constructor. Color label. Label name editing. (cvat-ai#3068)
* Update Cypress test "Label constructor. Color label. Label name editing" * Fix for Firefox
1 parent 92e5ab6 commit babf1a3

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/cypress/integration/actions_tasks_objects/case_31_label_constructor_color_name_label.js

+52
Original file line numberDiff line numberDiff line change
@@ -125,5 +125,57 @@ context('Label constructor. Color label. Label name editing', () => {
125125
});
126126
});
127127
});
128+
129+
it('Cancel/reset button interaction when changing color of the label.', () => {
130+
cy.goToTaskList();
131+
cy.openTask(taskName);
132+
// Adding a label without setting a color
133+
cy.addNewLabel(`Case ${caseId}`);
134+
cy.get('.cvat-constructor-viewer').should('be.visible');
135+
cy.contains('.cvat-constructor-viewer-item', `Case ${caseId}`)
136+
.invoke('attr', 'style')
137+
.then(($labelColor) => {
138+
// Change the label color and press "Cancel"
139+
cy.contains('.cvat-constructor-viewer-item', `Case ${caseId}`).find('[data-icon="edit"]').click();
140+
cy.get('.cvat-change-task-label-color-badge')
141+
.children()
142+
.invoke('attr', 'style')
143+
.then(($labelBadgeColor) => {
144+
expect($labelBadgeColor).to.be.equal($labelColor);
145+
});
146+
cy.get('.cvat-change-task-label-color-button').click();
147+
cy.get('.cvat-label-color-picker')
148+
.not('.ant-popover-hidden')
149+
.within(() => {
150+
cy.contains('hex').prev().clear().type(labelColor.yellowHex);
151+
cy.contains('button', 'Cancel').click();
152+
});
153+
cy.get('.cvat-change-task-label-color-badge')
154+
.children()
155+
.invoke('attr', 'style')
156+
.then(($labelBadgeColor) => {
157+
expect($labelBadgeColor).to.be.equal($labelColor);
158+
});
159+
160+
// Change the label color
161+
cy.get('.cvat-change-task-label-color-button').click();
162+
cy.changeColorViaBadge(labelColor.yellowHex);
163+
164+
// Reset the label color
165+
cy.get('.cvat-change-task-label-color-button').click();
166+
cy.get('.cvat-label-color-picker')
167+
.not('.ant-popover-hidden')
168+
.within(() => {
169+
cy.contains('button', 'Reset').click();
170+
});
171+
cy.get('.cvat-change-task-label-color-badge')
172+
.children()
173+
.should('have.attr', 'style').and('contain', 'rgb(179, 179, 179)');
174+
cy.get('.cvat-label-constructor-updater').contains('button', 'Done').click();
175+
cy.contains('.cvat-constructor-viewer-item', `Case ${caseId}`)
176+
.should('have.attr', 'style')
177+
.and('contain', $labelColor);
178+
});
179+
});
128180
});
129181
});

0 commit comments

Comments
 (0)