Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check UI does not crash if to activate an object while frame fetching #7873

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 79 additions & 0 deletions tests/cypress/e2e/actions_objects/regression_tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright (C) 2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

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

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


context('Regression tests', () => {
const labelName = 'Main label';
const taskName = `New annotation task for ${labelName}`;
const attrName = `Attr for ${labelName}`;
const textDefaultValue = 'Some default value for type Text';
const imagesCount = 75;
const imageFileName = `image_${labelName.replace(' ', '_').toLowerCase()}`;
const width = 800;
const height = 800;
const posX = 10;
const posY = 10;
const color = 'gray';
const archiveName = `${imageFileName}.zip`;
const archivePath = `cypress/fixtures/${archiveName}`;
const imagesFolder = `cypress/fixtures/${imageFileName}`;
const directoryToArchive = imagesFolder;
const zipLevel = 0;

const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName,
firstX: 250,
firstY: 350,
secondX: 350,
secondY: 450,
};

before(() => {
cy.visit('auth/login');
cy.login();
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX,
posY, labelName, imagesCount);
cy.createZipArchive(directoryToArchive, archivePath, zipLevel);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use headless function to create tasks in new tests whenever it is possible.
It is quicker and more reliable.

});

describe('Regression tests', () => {
it('Object is not activated while frame fetching', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
describe('Regression tests', () => {
it('Object is not activated while frame fetching', () => {
describe('Regression tests', () => {
it('UI does not crash if to activate an object while frame fetching', () => {

cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName);
cy.goToTaskList();
cy.openTaskJob(taskName);

cy.get('.cvat-player-last-button').click();
cy.createRectangle(createRectangleShape2Points);
cy.get('#cvat_canvas_shape_1').trigger('mousemove');
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
cy.saveJob();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will recommend to add objects in headless mode


cy.reload();
cy.get('.cvat-player-last-button').click();

cy.intercept('GET', '/api/jobs/**/data?**', (req) => {
req.continue((res) => {
res.setDelay(3000);
});
}).as('delayedRequest');

cy.get('#cvat_canvas_shape_1').trigger('mousemove');
cy.get('#cvat_canvas_shape_1').should('not.have.class', 'cvat_canvas_shape_activated');

cy.wait('@delayedRequest');
cy.get('#cvat_canvas_shape_1').trigger('mousemove');
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
});
});

after(() => {
cy.goToTaskList();
cy.deleteTask(taskName);
});
});