Skip to content

Commit 1faa9b1

Browse files
authored
Cypress test. Save filtered object in AAM. (#3436)
* Cypress test. Save filtered object in AAM. * Update cypress command * Revert changes for cypress command. Moved the test. * Splited "changeWorkspace" and "changeLabelAAM" commands.
1 parent c58e915 commit 1faa9b1

8 files changed

+63
-8
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright (C) 2021 Intel Corporation
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
/// <reference types="cypress" />
6+
7+
import { labelName, taskName } from '../../support/const';
8+
9+
context('Save filtered object in AAM.', () => {
10+
const caseId = '99';
11+
const newLabelName = `New label for case ${caseId}`;
12+
const createCuboidShape2Points = {
13+
points: 'From rectangle',
14+
type: 'Shape',
15+
labelName: labelName,
16+
firstX: 250,
17+
firstY: 350,
18+
secondX: 350,
19+
secondY: 450,
20+
};
21+
22+
before(() => {
23+
cy.openTask(taskName);
24+
cy.addNewLabel(newLabelName);
25+
cy.openJob();
26+
cy.createCuboid(createCuboidShape2Points);
27+
});
28+
29+
describe(`Testing case "${caseId}"`, () => {
30+
it(`Set filter label == “${labelName}”.`, () => {
31+
cy.addFiltersRule(0);
32+
cy.setFilter({
33+
groupIndex: 0,
34+
ruleIndex: 0,
35+
field: 'Label',
36+
operator: '==',
37+
value: labelName,
38+
submit: true,
39+
});
40+
});
41+
42+
it(`Go to AAM and change a label for the shape. Save the changes. UI is not failed.`, () => {
43+
cy.changeWorkspace('Attribute annotation');
44+
cy.changeLabelAAM(newLabelName);
45+
cy.saveJob();
46+
cy.get('#cvat_canvas_shape_1').should('not.exist');
47+
cy.get('.attribute-annotations-sidebar-not-found-wrapper').should('exist');
48+
});
49+
});
50+
});

tests/cypress/integration/actions_tasks/case_70_mutable_attribute.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ context('Mutable attribute.', () => {
5050

5151
describe(`Testing case "${caseId}"`, () => {
5252
it('Go to AAM. For the 2nd and 3rd frames, change the attribute value.', () => {
53-
cy.changeWorkspace('Attribute annotation', labelTrack);
53+
cy.changeWorkspace('Attribute annotation');
54+
cy.changeLabelAAM(labelTrack);
5455
testChangingAttributeValue(additionalAttrsLabelShape[0].additionalValue, attrValueSecondFrame);
5556
testChangingAttributeValue(attrValueSecondFrame, attrValueThirdFrame);
5657
});

tests/cypress/integration/actions_tasks2/case_32_attribute_annotation_mode_zoom_margin_feature.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ context('Attribute annotation mode (AAM) zoom margin feature', () => {
3737
cy.createTag(labelName);
3838

3939
// go to AAM workspace
40-
cy.changeWorkspace('Attribute annotation', labelName);
40+
cy.changeWorkspace('Attribute annotation');
41+
cy.changeLabelAAM(labelName);
4142
});
4243

4344
describe(`Testing case "${caseId}"`, () => {

tests/cypress/integration/issues_prs/issue_2486_not_edit_object_aam.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ context("Object can't be draggable/resizable in AAM", () => {
3434
});
3535

3636
it.skip('Go to AAM', () => {
37-
cy.changeWorkspace('Attribute annotation', labelName);
37+
cy.changeWorkspace('Attribute annotation');
38+
cy.changeLabelAAM(labelName);
3839
cy.get('#cvat_canvas_shape_1')
3940
.then((shape) => {
4041
shapeXPos = Math.floor(shape.attr('x'));

tests/cypress/integration/issues_prs/pr_2203_error_cannot_read_property_at_saving_job.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ context('Check error сannot read property at saving job', () => {
3333
});
3434

3535
it('Go to AAM', () => {
36-
cy.changeWorkspace('Attribute annotation', labelName);
36+
cy.changeWorkspace('Attribute annotation');
37+
cy.changeLabelAAM(labelName);
3738
});
3839

3940
it('Save job and go to previous frame at saving job', () => {

tests/cypress/integration/issues_prs2/issue_1425_highlighted_attribute_correspond_chosen_attribute.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
2828
cy.createRectangle(createRectangleShape2Points);
2929
});
3030
it('Go to AAM', () => {
31-
cy.changeWorkspace('Attribute annotation', labelName);
31+
cy.changeWorkspace('Attribute annotation');
32+
cy.changeLabelAAM(labelName);
3233
});
3334
it('Check if highlighted attribute correspond to the chosen attribute in right panel', () => {
3435
cy.get('.cvat_canvas_text').within(() => {

tests/cypress/integration/issues_prs2/issue_1750_err_aam_switch_frames.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o
3737
cy.createRectangle(createRectangleShape2PointsSecond);
3838
});
3939
it('Go to AAM', () => {
40-
cy.changeWorkspace('Attribute annotation', labelName);
40+
cy.changeWorkspace('Attribute annotation');
41+
cy.changeLabelAAM(labelName);
4142
});
4243
it('Go to next frame', () => {
4344
cy.get('.cvat-player-next-button').click();

tests/cypress/support/commands.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,14 +380,13 @@ Cypress.Commands.add('saveSettings', () => {
380380
});
381381
});
382382

383-
Cypress.Commands.add('changeWorkspace', (mode, labelName) => {
383+
Cypress.Commands.add('changeWorkspace', (mode) => {
384384
cy.get('.cvat-workspace-selector').click();
385385
cy.get('.cvat-workspace-selector-dropdown').within(() => {
386386
cy.get(`.ant-select-item-option[title="${mode}"]`).click();
387387
});
388388

389389
cy.get('.cvat-workspace-selector').should('contain.text', mode);
390-
cy.changeLabelAAM(labelName);
391390
});
392391

393392
Cypress.Commands.add('changeLabelAAM', (labelName) => {

0 commit comments

Comments
 (0)