Cypress test. Attribute annotation mode zoom margin feature. (#2573)

* add test

* improvements test

* improvements other tests

* add cssSelectors

* small improvements

Co-authored-by: Dmitriy Oparin <dmitriyx.oparin@intel.com>
main
DmitriyOparin 5 years ago committed by GitHub
parent 979bd33ccd
commit 68dfa5da64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -122,7 +122,7 @@ function renderInputElement(parameters: InputElementParameters): JSX.Element {
element = renderText();
}
return <div className='attribute-annotation-sidebar-attr-editor'>{element}</div>;
return <div className='cvat-attribute-annotation-sidebar-attr-editor'>{element}</div>;
}
interface ListParameters {

@ -23,9 +23,9 @@ function AttributeSwitcher(props: Props): JSX.Element {
const title = `${currentAttribute} [${currentIndex + 1}/${attributesCount}]`;
return (
<div className='attribute-annotation-sidebar-attribute-switcher'>
<div className='cvat-attribute-annotation-sidebar-attribute-switcher'>
<Tooltip title={`Previous attribute ${normalizedKeyMap.PREVIOUS_ATTRIBUTE}`} mouseLeaveDelay={0}>
<Button disabled={attributesCount <= 1} onClick={() => nextAttribute(-1)}>
<Button className='cvat-attribute-annotation-sidebar-attribute-switcher-left' disabled={attributesCount <= 1} onClick={() => nextAttribute(-1)}>
<LeftOutlined />
</Button>
</Tooltip>
@ -34,7 +34,7 @@ function AttributeSwitcher(props: Props): JSX.Element {
<Text strong>{` [${currentIndex + 1}/${attributesCount}]`}</Text>
</Tooltip>
<Tooltip title={`Next attribute ${normalizedKeyMap.NEXT_ATTRIBUTE}`} mouseLeaveDelay={0}>
<Button disabled={attributesCount <= 1} onClick={() => nextAttribute(1)}>
<Button className='cvat-attribute-annotation-sidebar-attribute-switcher-right' disabled={attributesCount <= 1} onClick={() => nextAttribute(1)}>
<RightOutlined />
</Button>
</Tooltip>

@ -15,7 +15,7 @@ function ObjectBasicsEditor(props: Props): JSX.Element {
const { currentLabel, labels, changeLabel } = props;
return (
<div className='attribute-annotation-sidebar-basics-editor'>
<div className='cvat-attribute-annotation-sidebar-basics-editor'>
<Select value={currentLabel} onChange={changeLabel} style={{ width: '50%' }}>
{labels.map(
(label: any): JSX.Element => (

@ -25,9 +25,9 @@ function ObjectSwitcher(props: Props): JSX.Element {
const title = `${currentLabel} ${clientID} [${currentIndex + 1}/${objectsCount}]`;
return (
<div className='attribute-annotation-sidebar-object-switcher'>
<div className='cvat-attribute-annotation-sidebar-object-switcher'>
<Tooltip title={`Previous object ${normalizedKeyMap.PREVIOUS_OBJECT}`} mouseLeaveDelay={0}>
<Button disabled={objectsCount <= 1} onClick={() => nextObject(-1)}>
<Button className='cvat-attribute-annotation-sidebar-object-switcher-left' disabled={objectsCount <= 1} onClick={() => nextObject(-1)}>
<LeftOutlined />
</Button>
</Tooltip>
@ -37,7 +37,7 @@ function ObjectSwitcher(props: Props): JSX.Element {
<Text strong>{`[${currentIndex + 1}/${objectsCount}]`}</Text>
</Tooltip>
<Tooltip title={`Next object ${normalizedKeyMap.NEXT_OBJECT}`} mouseLeaveDelay={0}>
<Button disabled={objectsCount <= 1} onClick={() => nextObject(1)}>
<Button className='cvat-attribute-annotation-sidebar-object-switcher-right' disabled={objectsCount <= 1} onClick={() => nextObject(1)}>
<RightOutlined />
</Button>
</Tooltip>

@ -13,8 +13,8 @@
padding: 5px;
}
.attribute-annotation-sidebar-object-switcher,
.attribute-annotation-sidebar-attribute-switcher {
.cvat-attribute-annotation-sidebar-object-switcher,
.cvat-attribute-annotation-sidebar-attribute-switcher {
display: flex;
align-items: center;
justify-content: space-between;
@ -32,7 +32,7 @@
}
}
.attribute-annotation-sidebar-basics-editor {
.cvat-attribute-annotation-sidebar-basics-editor {
display: flex;
align-items: center;
justify-content: space-between;
@ -58,7 +58,7 @@
justify-content: space-around;
}
.attribute-annotation-sidebar-attr-editor {
.cvat-attribute-annotation-sidebar-attr-editor {
display: flex;
align-items: center;
justify-content: space-around;

@ -0,0 +1,65 @@
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
/// <reference types="cypress" />
import { taskName, labelName } from '../../support/const';
context('Attribute annotation mode (AAM) zoom margin feature', () => {
const caseId = '32';
const rectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
firstX: 100,
firstY: 100,
secondX: 150,
secondY: 150,
};
function changeSettingsZoomMargin(valueZoomMargin) {
cy.openSettings();
cy.get('.cvat-settings-modal').within(() => {
cy.contains('Workspace').click();
cy.get('.cvat-workspace-settings-aam-zoom-margin').within(() => {
cy.get('[role="spinbutton"]').clear().type(valueZoomMargin);
});
});
cy.closeSettings();
}
before(() => {
cy.openTaskJob(taskName);
// create object and tag
cy.createRectangle(rectangleShape2Points);
cy.createTag(labelName);
// go to AAM workspace
cy.changeWorkspace('Attribute annotation', labelName);
});
describe(`Testing case "${caseId}"`, () => {
it('Change AAM zoom margin on workspace with rectangle', () => {
cy.get('.cvat-attribute-annotation-sidebar-object-switcher').should('contain', `${labelName} 1 [1/2]`);
cy.getScaleValue().then((scaleBeforeChangeZoomMargin) => {
changeSettingsZoomMargin(150);
cy.getScaleValue().then((scaleAfterChangeZoomMargin) => {
expect(scaleBeforeChangeZoomMargin).to.be.greaterThan(scaleAfterChangeZoomMargin);
});
});
});
it('Change AAM zoom margin on workspace with tag', () => {
cy.get('.cvat-attribute-annotation-sidebar-object-switcher-right').click();
cy.get('.cvat-attribute-annotation-sidebar-object-switcher').should('contain', `${labelName} 2 [2/2]`);
cy.getScaleValue().then((scaleBeforeChangeZoomMargin) => {
changeSettingsZoomMargin(200);
cy.getScaleValue().then((scaleAfterChangeZoomMargin) => {
expect(scaleBeforeChangeZoomMargin).to.be.eq(scaleAfterChangeZoomMargin);
});
});
});
});
});

@ -36,18 +36,18 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib
textValue = $textValue.text().split(': ')[1];
});
});
cy.get('.attribute-annotation-sidebar-attr-editor').within(() => {
cy.get('.cvat-attribute-annotation-sidebar-attr-editor').within(() => {
cy.get('[type="text"]').should('have.value', textValue);
});
});
it('Go to next attribute and check again', () => {
cy.get('.attribute-annotation-sidebar-attribute-switcher').find('.anticon-right').click({ force: true });
cy.get('.cvat-attribute-annotation-sidebar-attribute-switcher-right').click();
cy.get('.cvat_canvas_text').within(() => {
cy.get('[style="fill: red;"]').then(($textValue) => {
textValue = $textValue.text().split(': ')[1];
});
});
cy.get('.attribute-annotation-sidebar-attr-editor').within(() => {
cy.get('.cvat-attribute-annotation-sidebar-attr-editor').within(() => {
cy.get('[type="text"]').should('have.value', textValue);
});
});

@ -52,15 +52,12 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o
});
});
it('Go to next object', () => {
cy.get('.attribute-annotation-sidebar-object-switcher')
.should('contain', `${labelName} 1 [1/2]`)
.find('.anticon-right')
.click({ force: true });
cy.get('.cvat-attribute-annotation-sidebar-object-switcher-right').click();
});
it('Page with the error is missing', () => {
cy.contains('Oops, something went wrong', { timeout: 1000 }).should('not.exist');
cy.changeLabelAAM(labelName);
cy.get('.attribute-annotation-sidebar-object-switcher').should('contain', `${labelName} 2 [2/2]`);
cy.get('.cvat-attribute-annotation-sidebar-object-switcher').should('contain', `${labelName} 2 [2/2]`);
});
});
});

@ -272,10 +272,11 @@ Cypress.Commands.add('changeWorkspace', (mode, labelName) => {
});
Cypress.Commands.add('changeLabelAAM', (labelName) => {
cy.get('.cvat-workspace-selector').then((value) => {
const cvatWorkspaceSelectorValue = value.text();
if (cvatWorkspaceSelectorValue === 'Attribute annotation') {
cy.get('.attribute-annotation-sidebar-basics-editor').within(() => {
if (cvatWorkspaceSelectorValue.includes('Attribute annotation')) {
cy.get('.cvat-attribute-annotation-sidebar-basics-editor').within(() => {
cy.get('.ant-select-selector').click();
});
cy.get('.ant-select-dropdown')

Loading…
Cancel
Save