-
Notifications
You must be signed in to change notification settings - Fork 3.2k
/
Copy pathregression_tests.js
114 lines (95 loc) · 3.68 KB
/
regression_tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Copyright (C) CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT
/// <reference types="cypress" />
context('Regression tests', () => {
let taskID = null;
let jobID = null;
const taskPayload = {
name: 'Regression tests',
labels: [{
name: 'car',
attributes: [],
type: 'any',
}],
project_id: null,
source_storage: { location: 'local' },
target_storage: { location: 'local' },
};
const dataPayload = {
server_files: ['bigArchive.zip'],
image_quality: 70,
use_zip_chunks: true,
use_cache: true,
sorting_method: 'lexicographical',
};
const rectanglePayload = {
type: 'rectangle',
occluded: false,
labelName: taskPayload.labels[0].name,
};
before(() => {
cy.visit('/auth/login');
cy.login();
cy.headlessCreateTask(taskPayload, dataPayload).then((response) => {
taskID = response.taskID;
[jobID] = response.jobIDs;
cy.headlessCreateObjects([{
...rectanglePayload,
frame: 99,
points: [250, 64, 491, 228],
objectType: 'shape',
}, {
labelName: rectanglePayload.labelName,
objectType: 'track',
frame: 0,
shapes: [{
type: rectanglePayload.type,
frame: 0,
occluded: rectanglePayload.occluded,
points: [10, 10, 30, 30],
}],
}], jobID);
});
});
describe('UI does not crash', () => {
beforeEach(() => {
cy.visit(`/tasks/${taskID}/jobs/${jobID}`);
cy.get('.cvat-canvas-container').should('not.exist');
cy.get('.cvat-canvas-container').should('exist').and('be.visible');
});
it('UI does not crash if to activate an object while frame fetching', () => {
cy.intercept('GET', '/api/jobs/**/data?**', (req) => {
req.continue((res) => {
res.setDelay(3000);
});
}).as('delayedRequest');
cy.get('.cvat-player-last-button').click();
cy.get('#cvat-objects-sidebar-state-item-1').trigger('mousemove');
cy.get('#cvat-objects-sidebar-state-item-1').should('not.have.class', 'cvat-objects-sidebar-state-active-item');
cy.wait('@delayedRequest');
cy.get('#cvat_canvas_shape_1').trigger('mousemove');
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
});
it('UI does not crash if to navigate during an element resizing (issue 1922)', { scrollBehavior: false }, () => {
cy.get('#cvat_canvas_shape_2').then(([el]) => {
const rect = el.getBoundingClientRect();
cy.get('body').trigger('mousemove', rect.x + rect.width / 2, rect.y + rect.height / 2);
cy.get('#cvat_canvas_shape_2').should('have.class', 'cvat_canvas_shape_activated');
cy.get('body').trigger('mousedown', rect.right, rect.bottom, { button: 0 });
cy.get('body').trigger('mousemove', rect.right + 100, rect.bottom + 100);
cy.get('body').type('f'); // go to next frame
cy.get('body').trigger('mouseup');
// Page with the error is missing
cy.get('.cvat-global-boundary').should('not.exist');
cy.checkFrameNum(0);
});
});
});
after(() => {
if (taskID !== null) {
cy.headlessDeleteTask(taskID);
}
cy.logout();
});
});