Added cypress tests for issue 4966 (#5080)

* Added cypress tests for issue 4966

* Updated license headers
main
Boris Sekachev 3 years ago committed by GitHub
parent dbcfb30cb2
commit 6811c57ef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,5 @@
// Copyright (C) 2020-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
@ -96,8 +97,8 @@ context('Group features', () => {
cy.get(object).within(() => {
cy.get('[aria-label="more"]').click();
});
cy.wait(300);
cy.get('.ant-dropdown')
.should('be.visible')
.not('.ant-dropdown-hidden')
.within(() => {
cy.contains('Change group color').click();
@ -241,6 +242,7 @@ context('Group features', () => {
it('Change group color.', () => {
changeGroupColor('#cvat-objects-sidebar-state-item-1', yellowHex);
cy.checkCanvasSidebarColorEqualness(1);
});
it('For these objects, the fill and stroke parameters took the corresponding color values.', () => {

@ -1,4 +1,5 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
@ -22,9 +23,12 @@ context('Hotkeys to change labels feature.', () => {
const imagesFolder = `cypress/fixtures/${imageFileName}`;
const directoryToArchive = imagesFolder;
const secondLabel = `Case ${caseId} second`;
const additionalAttrsSecondLabel = [
{ additionalAttrName: attrName, additionalValue: '0;3;1', typeAttribute: 'Number', mutable: false },
];
const additionalAttrsSecondLabel = [{
additionalAttrName: attrName,
additionalValue: '0;3;1',
typeAttribute: 'Number',
mutable: false,
}];
let firstLabelCurrentVal = '';
let secondLabelCurrentVal = '';
@ -33,9 +37,11 @@ context('Hotkeys to change labels feature.', () => {
cy.get('.cvat-settings-modal').within(() => {
cy.contains('Workspace').click();
cy.get('.cvat-workspace-settings-show-text-always').within(() => {
check
? cy.get('[type="checkbox"]').check().should('be.checked')
: cy.get('[type="checkbox"]').uncheck().should('not.be.checked');
if (check) {
cy.get('[type="checkbox"]').check().should('be.checked');
} else {
cy.get('[type="checkbox"]').uncheck().should('not.be.checked');
}
});
});
cy.closeSettings();
@ -102,7 +108,8 @@ context('Hotkeys to change labels feature.', () => {
.find('.cvat-objects-sidebar-state-item-label-selector')
.should('have.text', secondLabelCurrentVal);
cy.contains('tspan', `${secondLabelCurrentVal} 1 (manual)`).should('be.visible');
// The value of the attribute of the 2nd label corresponds to the value of the attribute of the same name of the 1st label
// The value of the attribute of the 2nd label corresponds
// to the value of the attribute of the same name of the 1st label
cy.get('#cvat-objects-sidebar-state-item-1')
.find('.cvat-object-item-number-attribute')
.find('input')
@ -166,6 +173,7 @@ context('Hotkeys to change labels feature.', () => {
cy.get('#cvat-objects-sidebar-state-item-1')
.find('.cvat-objects-sidebar-state-item-label-selector')
.should('have.text', firstLabelCurrentVal);
cy.checkCanvasSidebarColorEqualness(1);
});
});
});

@ -808,6 +808,15 @@ Cypress.Commands.add('addNewLabel', (newLabelName, additionalAttrs, labelColor)
cy.contains('.cvat-constructor-viewer-item', new RegExp(`^${newLabelName}$`)).should('exist');
});
Cypress.Commands.add('checkCanvasSidebarColorEqualness', (id) => {
cy.get(`#cvat-objects-sidebar-state-item-${id}`).then(($el) => {
const labelColor = $el.css('backgroundColor');
const [r, g, b] = labelColor.match(/(\d+)/g);
const hexColor = `#${[r, g, b].map((v) => (+v).toString(16).padStart(2, '0')).join('')}`;
cy.get(`#cvat_canvas_shape_${id}`).should('have.attr', 'fill', hexColor);
});
});
Cypress.Commands.add('addNewLabelViaContinueButton', (additionalLabels) => {
cy.collectLabelsName().then((labelsNames) => {
if (additionalLabels.some((el) => labelsNames.indexOf(el) === -1)) {

Loading…
Cancel
Save