diff --git a/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js b/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js index 3d8913c2..21e64c1d 100644 --- a/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js +++ b/tests/cypress/integration/actions_tasks_objects/case_13_merge_split_features.js @@ -1,8 +1,6 @@ -/* - * Copyright (C) 2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - */ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT /// @@ -43,19 +41,19 @@ context('Merge/split features', () => { describe(`Testing case "${caseId}"`, () => { it('Create rectangle shape on first frame', () => { + checkFrameNumber(frameNum); cy.createRectangle(createRectangleShape2Points); - checkFrameNumber(frameNum) }); it('Create rectangle shape on third frame with another position', () => { cy.get('.cvat-player-next-button').click().click(); - checkFrameNumber(frameNum + 2) + checkFrameNumber(frameNum + 2); cy.createRectangle(createRectangleShape2PointsSecond); }); it('Merge the objects with "Merge button"', () => { cy.get('.cvat-merge-control').click(); cy.get('#cvat_canvas_shape_2').click(); cy.get('.cvat-player-previous-button').click().click(); - checkFrameNumber(frameNum) + checkFrameNumber(frameNum); cy.get('#cvat_canvas_shape_1').click(); cy.get('.cvat-merge-control').click(); }); @@ -65,18 +63,18 @@ context('Merge/split features', () => { cy.get('#cvat-objects-sidebar-state-item-3').within(() => { cy.get('.ant-row-flex').within(() => { cy.get('.anticon-star').should('have.css', 'color').then($iconStarCss => { - iconStarCss = $iconStarCss - expect(iconStarCss).to.be.eq('rgb(36, 36, 36)') + iconStarCss = $iconStarCss; + expect(iconStarCss).to.be.eq('rgb(36, 36, 36)'); }); }); }); cy.get('.cvat-player-next-button').click().click(); - checkFrameNumber(frameNum + 2) + checkFrameNumber(frameNum + 2); cy.get('#cvat_canvas_shape_3').should('exist').and('be.visible'); cy.get('#cvat-objects-sidebar-state-item-3').should('contain', '3').and('contain', 'RECTANGLE TRACK'); cy.get('#cvat-objects-sidebar-state-item-3').within(() => { cy.get('.ant-row-flex').within(() => { - cy.get('.anticon-star').should('have.css', 'color', iconStarCss) + cy.get('.anticon-star').should('have.css', 'color', iconStarCss); }); }); }); @@ -88,5 +86,17 @@ context('Merge/split features', () => { checkFrameNumber(frameNum + 3) cy.get('#cvat_canvas_shape_3').should('exist').and('be.hidden'); }); + // it('Go to the second frame and remove "outside" flag from the track. The track now visible.', () => { + // cy.get('.cvat-player-previous-button').click().click(); + // checkFrameNumber(frameNum + 1) + // cy.get('#cvat-objects-sidebar-state-item-3').within(() => { + // cy.get('.ant-row-flex').within(() => { + // cy.get('.anticon-star').should('have.css', 'color').then($iconStarCss => { + // iconStarCss = $iconStarCss + // expect(iconStarCss).to.be.eq('rgb(36, 36, 36)') + // }); + // }); + // }); + // }); }); }); diff --git a/tests/cypress/integration/actions_tasks_objects/issue_1425_highlighted_attribute_correspond_chosen_attribute.js b/tests/cypress/integration/actions_tasks_objects/issue_1425_highlighted_attribute_correspond_chosen_attribute.js index 13926213..34458402 100644 --- a/tests/cypress/integration/actions_tasks_objects/issue_1425_highlighted_attribute_correspond_chosen_attribute.js +++ b/tests/cypress/integration/actions_tasks_objects/issue_1425_highlighted_attribute_correspond_chosen_attribute.js @@ -1,8 +1,6 @@ -/* - * Copyright (C) 2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - */ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT /// @@ -30,12 +28,7 @@ context('The highlighted attribute in AAM should correspond to the chosen attrib cy.createRectangle(createRectangleShape2Points); }); it('Go to AAM', () => { - cy.changeAnnotationMode('Attribute annotation'); - // Select the necessary label in any case - cy.get('.attribute-annotation-sidebar-basics-editor').within(() => { - cy.get('.ant-select-selection').click(); - }); - cy.get('.ant-select-dropdown-menu-item').contains(labelName).click(); + cy.changeAnnotationMode('Attribute annotation', labelName); }); it('Check if highlighted attribute correspond to the chosen attribute in right panel', () => { cy.get('.cvat_canvas_text').within(() => { diff --git a/tests/cypress/integration/actions_tasks_objects/issue_1750_err_aam_switch_frames.js b/tests/cypress/integration/actions_tasks_objects/issue_1750_err_aam_switch_frames.js index ee7652cd..ea972d23 100644 --- a/tests/cypress/integration/actions_tasks_objects/issue_1750_err_aam_switch_frames.js +++ b/tests/cypress/integration/actions_tasks_objects/issue_1750_err_aam_switch_frames.js @@ -1,8 +1,6 @@ -/* - * Copyright (C) 2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - */ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT /// @@ -39,11 +37,7 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o cy.createRectangle(createRectangleShape2PointsSecond); }); it('Go to AAM', () => { - cy.get('.cvat-workspace-selector').click(); - cy.get('.ant-select-dropdown-menu-item') - .contains('Attribute annotation') - .click() - .should('contain.text', 'Attribute annotation'); + cy.changeAnnotationMode('Attribute annotation', labelName); }); it('Go to next frame', () => { cy.get('.cvat-player-next-button').click(); @@ -65,6 +59,10 @@ context('An error occurs in AAM when switching to 2 frames, if the frames have o }); it('Page with the error is missing', () => { cy.contains('Oops, something went wrong').should('not.exist'); + cy.get('.attribute-annotation-sidebar-basics-editor').within(() => { + cy.get('.ant-select-selection').click(); + }); + cy.get('.ant-select-dropdown-menu-item').contains(labelName).click(); cy.get('.attribute-annotation-sidebar-object-switcher').should('contain', `${labelName} 2 [2/2]`); }); }); diff --git a/tests/cypress/plugins/index.js b/tests/cypress/plugins/index.js index 00a306e2..f1af3f8c 100644 --- a/tests/cypress/plugins/index.js +++ b/tests/cypress/plugins/index.js @@ -16,5 +16,13 @@ module.exports = (on, config) => { return null; }, }); + // Try to resolve "Cypress failed to make a connection to the Chrome DevTools Protocol" + // https://github.com/cypress-io/cypress/issues/7450 + on('before:browser:launch', (browser, launchOptions) => { + if (browser.name === 'chrome' && browser.isHeadless) { + launchOptions.args.push('--disable-gpu'); + return launchOptions + } + }); return config; }; diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 889551c4..076c246d 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -1,8 +1,6 @@ -/* - * Copyright (C) 2020 Intel Corporation - * - * SPDX-License-Identifier: MIT - */ +// Copyright (C) 2020 Intel Corporation +// +// SPDX-License-Identifier: MIT /// @@ -124,10 +122,12 @@ Cypress.Commands.add('switchLabel', (labelName) => { }); Cypress.Commands.add('checkObjectParameters', (objectParameters, objectType) => { - cy.get('.cvat-objects-sidebar-state-item').then((objectSidebar) => { - cy.get(`#cvat_canvas_shape_${objectSidebar.length}`).should('exist').and('be.visible'); - cy.get(`#cvat-objects-sidebar-state-item-${objectSidebar.length}`) - .should('contain', objectSidebar.length).and('contain', `${objectType} ${objectParameters.type.toUpperCase()}`).within(() => { + cy.get('.cvat_canvas_shape').last().should('have.attr', 'id').then(($cvatCanvasShapeId) => { + const arrCvatCanvasShapeId = $cvatCanvasShapeId.split('_') + const idNumCanvasShape = arrCvatCanvasShapeId[arrCvatCanvasShapeId.length - 1] + cy.get(`#cvat_canvas_shape_${idNumCanvasShape}`).should('exist').and('be.visible'); + cy.get(`#cvat-objects-sidebar-state-item-${idNumCanvasShape}`) + .should('contain', idNumCanvasShape).and('contain', `${objectType} ${objectParameters.type.toUpperCase()}`).within(() => { cy.get('.ant-select-selection-selected-value').should('have.text', selectedValueGlobal); }); }); @@ -217,10 +217,17 @@ Cypress.Commands.add('closeSettings', () => { }); }); -Cypress.Commands.add('changeAnnotationMode', (mode) => { +Cypress.Commands.add('changeAnnotationMode', (mode, labelName) => { cy.get('.cvat-workspace-selector').click(); cy.get('.ant-select-dropdown-menu-item').contains(mode).click(); cy.get('.cvat-workspace-selector').should('contain.text', mode); + if (mode === 'Attribute annotation') { + // Select the necessary label in any case + cy.get('.attribute-annotation-sidebar-basics-editor').within(() => { + cy.get('.ant-select-selection').click(); + }); + cy.get('.ant-select-dropdown-menu-item').contains(labelName).click(); + } }); Cypress.Commands.add('createCuboid', (createCuboidParams) => {