Continue writing the test.

Try to fix "Cypress failed to make a connection to the Chrome DevTools Protocol"
Adding selection lable name when goint to AAM to cypress command.
Fix some test for avid fail when the label order is reversed
main
Kruchinin 5 years ago
parent 950061f492
commit 343e4e5515

@ -1,8 +1,6 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
/// <reference types="cypress" />
@ -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)')
// });
// });
// });
// });
});
});

@ -1,8 +1,6 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
/// <reference types="cypress" />
@ -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(() => {

@ -1,8 +1,6 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
/// <reference types="cypress" />
@ -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]`);
});
});

@ -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;
};

@ -1,8 +1,6 @@
/*
* Copyright (C) 2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*/
// Copyright (C) 2020 Intel Corporation
//
// SPDX-License-Identifier: MIT
/// <reference types="cypress" />
@ -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) => {

Loading…
Cancel
Save