Update case72. Checking "Attribute keeping when changing label" feature (#3448)

main
Dmitry Kruchinin 5 years ago committed by GitHub
parent bcead927e4
commit 3be162a0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,7 +9,7 @@ context('Hotkeys to change labels feature.', () => {
const labelName = `Case ${caseId}`; const labelName = `Case ${caseId}`;
const taskName = labelName; const taskName = labelName;
const attrName = `Attr for ${labelName}`; const attrName = `Attr for ${labelName}`;
const textDefaultValue = 'Some default value for type Text'; const textDefaultValue = '2';
const imagesCount = 1; const imagesCount = 1;
const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`; const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`;
const width = 800; const width = 800;
@ -22,6 +22,9 @@ context('Hotkeys to change labels feature.', () => {
const imagesFolder = `cypress/fixtures/${imageFileName}`; const imagesFolder = `cypress/fixtures/${imageFileName}`;
const directoryToArchive = imagesFolder; const directoryToArchive = imagesFolder;
const secondLabel = `Case ${caseId} second` const secondLabel = `Case ${caseId} second`
const additionalAttrsSecondLabel = [
{ additionalAttrName: attrName, additionalValue: '0;3;1', typeAttribute: 'Number', mutable: false },
];
let firstLabelCurrentVal = ''; let firstLabelCurrentVal = '';
let secondLabelCurrentVal = ''; let secondLabelCurrentVal = '';
@ -45,7 +48,7 @@ context('Hotkeys to change labels feature.', () => {
cy.createZipArchive(directoryToArchive, archivePath); cy.createZipArchive(directoryToArchive, archivePath);
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName); cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName);
cy.openTask(taskName); cy.openTask(taskName);
cy.addNewLabel(secondLabel); cy.addNewLabel(secondLabel, additionalAttrsSecondLabel);
cy.openJob(); cy.openJob();
}); });
@ -69,7 +72,7 @@ context('Hotkeys to change labels feature.', () => {
}); });
}); });
it('Changing a label for a shape using hotkey.', () => { it('Changing a label for a shape using hotkey. Check "Attribute keeping when changing label" feature.', () => {
const createPolygonShape = { const createPolygonShape = {
reDraw: false, reDraw: false,
type: 'Shape', type: 'Shape',
@ -89,9 +92,18 @@ context('Hotkeys to change labels feature.', () => {
cy.get('.cvat-canvas-container').click(270, 260); cy.get('.cvat-canvas-container').click(270, 260);
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated'); cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
cy.contains('tspan', `${firstLabelCurrentVal} 1 (manual)`).should('be.visible'); cy.contains('tspan', `${firstLabelCurrentVal} 1 (manual)`).should('be.visible');
// Check "Attribute keeping when changing label" feature
cy.get('#cvat-objects-sidebar-state-item-1').find('.cvat-objects-sidebar-state-item-collapse').click();
cy.get('body').type('{Ctrl}2') cy.get('body').type('{Ctrl}2')
cy.get('#cvat-objects-sidebar-state-item-1').find('.cvat-objects-sidebar-state-item-label-selector').should('have.text', secondLabelCurrentVal); cy.get('#cvat-objects-sidebar-state-item-1').find('.cvat-objects-sidebar-state-item-label-selector').should('have.text', secondLabelCurrentVal);
cy.contains('tspan', `${secondLabelCurrentVal} 1 (manual)`).should('be.visible'); 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
cy.get('#cvat-objects-sidebar-state-item-1')
.find('.cvat-object-item-number-attribute')
.find('input')
.should('have.attr', 'aria-valuenow', textDefaultValue);
// Unset settings "Always show object details" // Unset settings "Always show object details"
testCheckingAlwaysShowObjectDetails(); testCheckingAlwaysShowObjectDetails();
}); });

Loading…
Cancel
Save