Skip to content

Commit

Permalink
Cypress test. Save filtered object in AAM. (#3436)
Browse files Browse the repository at this point in the history
* Cypress test. Save filtered object in AAM.

* Update cypress command

* Revert changes for cypress command. Moved the test.

* Splited "changeWorkspace" and "changeLabelAAM" commands.
  • Loading branch information
dvkruchinin authored Jul 19, 2021
1 parent c58e915 commit 1faa9b1
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright (C) 2021 Intel Corporation
//
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />

import { labelName, taskName } from '../../support/const';

context('Save filtered object in AAM.', () => {
const caseId = '99';
const newLabelName = `New label for case ${caseId}`;
const createCuboidShape2Points = {
points: 'From rectangle',
type: 'Shape',
labelName: labelName,
firstX: 250,
firstY: 350,
secondX: 350,
secondY: 450,
};

before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.openJob();
cy.createCuboid(createCuboidShape2Points);
});

describe(`Testing case "${caseId}"`, () => {
it(`Set filter label == “${labelName}”.`, () => {
cy.addFiltersRule(0);
cy.setFilter({
groupIndex: 0,
ruleIndex: 0,
field: 'Label',
operator: '==',
value: labelName,
submit: true,
});
});

it(`Go to AAM and change a label for the shape. Save the changes. UI is not failed.`, () => {
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(newLabelName);
cy.saveJob();
cy.get('#cvat_canvas_shape_1').should('not.exist');
cy.get('.attribute-annotations-sidebar-not-found-wrapper').should('exist');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ context('Mutable attribute.', () => {

describe(`Testing case "${caseId}"`, () => {
it('Go to AAM. For the 2nd and 3rd frames, change the attribute value.', () => {
cy.changeWorkspace('Attribute annotation', labelTrack);
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelTrack);
testChangingAttributeValue(additionalAttrsLabelShape[0].additionalValue, attrValueSecondFrame);
testChangingAttributeValue(attrValueSecondFrame, attrValueThirdFrame);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ context('Attribute annotation mode (AAM) zoom margin feature', () => {
cy.createTag(labelName);

// go to AAM workspace
cy.changeWorkspace('Attribute annotation', labelName);
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelName);
});

describe(`Testing case "${caseId}"`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ context("Object can't be draggable/resizable in AAM", () => {
});

it.skip('Go to AAM', () => {
cy.changeWorkspace('Attribute annotation', labelName);
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelName);
cy.get('#cvat_canvas_shape_1')
.then((shape) => {
shapeXPos = Math.floor(shape.attr('x'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ context('Check error сannot read property at saving job', () => {
});

it('Go to AAM', () => {
cy.changeWorkspace('Attribute annotation', labelName);
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelName);
});

it('Save job and go to previous frame at saving job', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
cy.createRectangle(createRectangleShape2Points);
});
it('Go to AAM', () => {
cy.changeWorkspace('Attribute annotation', labelName);
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelName);
});
it('Check if highlighted attribute correspond to the chosen attribute in right panel', () => {
cy.get('.cvat_canvas_text').within(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o
cy.createRectangle(createRectangleShape2PointsSecond);
});
it('Go to AAM', () => {
cy.changeWorkspace('Attribute annotation', labelName);
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(labelName);
});
it('Go to next frame', () => {
cy.get('.cvat-player-next-button').click();
Expand Down
3 changes: 1 addition & 2 deletions tests/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,13 @@ Cypress.Commands.add('saveSettings', () => {
});
});

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

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

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

0 comments on commit 1faa9b1

Please sign in to comment.