未验证 提交 92e5ab66 编写于 作者: D Dmitry Kruchinin 提交者: GitHub

Cypress test. Mutable attribute. (#3058)

* Add mutable condition to cypress command

* Cypress test. Mutable attribute.

* Small fix

* Update tests/cypress/integration/actions_tasks_objects/case_70_mutable_attribute.js
Co-authored-by: NBoris Sekachev <boris.sekachev@intel.com>
Co-authored-by: NBoris Sekachev <boris.sekachev@intel.com>
上级 865274e8
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT
// /// <reference types="cypress" />
import { taskName } from '../../support/const';
context('Mutable attribute.', () => {
const caseId = '70';
const labelTrack = `Case ${caseId}`;
const additionalAttrsLabelShape = [
{ additionalAttrName: 'tree', additionalValue: 'birch tree', typeAttribute: 'Text', mutable: true },
];
const createRectangleTrack2Points = {
points: 'By 2 Points',
type: 'Track',
labelName: labelTrack,
firstX: 260,
firstY: 200,
secondX: 360,
secondY: 250,
};
const attrValueSecondFrame = 'aspen';
const attrValueThirdFrame = 'oak';
function testChangingAttributeValue(expectedValue, value) {
cy.get('.cvat-player-next-button').click();
cy.get('.attribute-annotation-sidebar-attr-elem-wrapper')
.find('[type="text"]')
.should('have.value', expectedValue)
.clear()
.type(value);
}
function checkObjectDetailValue(frameNum, expectedValue) {
cy.get('.cvat-player-next-button').click();
cy.goCheckFrameNumber(frameNum);
cy.contains(expectedValue).should('exist').and('be.visible');
}
before(() => {
cy.openTask(taskName);
cy.addNewLabel(labelTrack, additionalAttrsLabelShape);
cy.openJob();
cy.createRectangle(createRectangleTrack2Points);
});
describe(`Testing case "${caseId}"`, () => {
it('Go to AAM. For the 2nd and 3rd frames, change the attribute value.', () => {
cy.changeWorkspace('Attribute annotation', labelTrack);
testChangingAttributeValue(additionalAttrsLabelShape[0].additionalValue, attrValueSecondFrame);
testChangingAttributeValue(attrValueSecondFrame, attrValueThirdFrame);
});
it('Go to Standard mode. The object detaild have correct values on the corresponding frames.', () => {
cy.changeWorkspace('Standard');
cy.get('#cvat_canvas_shape_1')
.trigger('mousemove', { scrollBehavior: false })
.should('have.class', 'cvat_canvas_shape_activated');
[
[
0,
`${additionalAttrsLabelShape[0].additionalAttrName}: ${additionalAttrsLabelShape[0].additionalValue}`,
],
[1, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueSecondFrame}`],
[2, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueThirdFrame}`],
[3, `${additionalAttrsLabelShape[0].additionalAttrName}: ${attrValueThirdFrame}`],
].forEach(([num, val]) => {
checkObjectDetailValue(num, val);
});
});
});
});
......@@ -420,6 +420,10 @@ Cypress.Commands.add('updateAttributes', (multiAttrParams) => {
cy.get(`.ant-select-item-option[title="${multiAttrParams.additionalValue}"]`).click();
});
}
if (multiAttrParams.mutable) {
cy.get('.cvat-attribute-mutable-checkbox')
.find('[type="checkbox"]').should('not.be.checked').check().should('be.checked');
}
});
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册