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 3 commits
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
94 changes: 94 additions & 0 deletions tests/cypress/e2e/actions_objects/regression_tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// 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', () => {
let taskID = null;
let jobID = null;

const taskPayload = {
name: 'Test annotations actions',
labels: [{
name: 'label 1',
attributes: [],
type: 'any',
}],
project_id: null,
source_storage: { location: 'local' },
target_storage: { location: 'local' },
};

const dataPayload = {
server_files: ['archive.zip'],
image_quality: 70,
use_zip_chunks: true,
use_cache: true,
sorting_method: 'lexicographical',
};

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

before(() => {
cy.visit('auth/login');
cy.login();
});

describe('Regression tests', () => {
it('UI does not crash if to activate an object while frame fetching', () => {
cy.headlessCreateTask(taskPayload, dataPayload).then((response) => {
taskID = response.taskID;
[jobID] = response.jobIDs;

cy.visit(`/tasks/${taskID}/jobs/${jobID}`);
Copy link
Member

Choose a reason for hiding this comment

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

That has to be in before function.
We do not test creating/opening a task here.


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.

Also should be in before.

Additionally I will recommend to create annotations using headless method. Now we do not have such cypress command, but it would be nice to create and use in the future.


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.logout();
cy.getAuthKey().then((response) => {
const authKey = response.body.key;
cy.request({
method: 'DELETE',
url: `/api/tasks/${taskID}`,
headers: {
Authorization: `Token ${authKey}`,
},
});
});
});
});