Skip to content

Regression test for ground-truth jobs from video #9150

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

Merged
merged 12 commits into from
Feb 28, 2025
176 changes: 99 additions & 77 deletions tests/cypress/e2e/features/ground_truth_jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,93 +385,115 @@ context('Ground truth jobs', () => {
});
});

describe('Regression tests', () => {
const serverFiles = ['bigArchive.zip'];

beforeEach(() => {
createAndOpenTask(serverFiles);
});
context('Regression tests', () => {
describe('GT jobs from images', () => {
const serverFiles = ['bigArchive.zip'];

afterEach(() => {
cy.headlessDeleteTask(taskID);
});
beforeEach(() => {
createAndOpenTask(serverFiles);
});

it('Check GT button should be disabled while waiting for GT job creation', () => {
cy.visit('/tasks');
cy.openTask(taskName);
afterEach(() => {
cy.headlessDeleteTask(taskID);
});

cy.get('.cvat-create-job').click({ force: true });
cy.url().should('include', '/jobs/create');
cy.get('.cvat-select-job-type').click();
cy.get('.ant-select-dropdown')
.not('.ant-select-dropdown-hidden')
.first()
.within(() => {
cy.get('.ant-select-item-option[title="Ground truth"]').click();
});
cy.get('.cvat-input-frame-count').clear();
cy.get('.cvat-input-frame-count').type(1);
it('Check GT button should be disabled while waiting for GT job creation', () => {
cy.visit('/tasks');
cy.openTask(taskName);

cy.get('.cvat-create-job').click({ force: true });
cy.url().should('include', '/jobs/create');
cy.get('.cvat-select-job-type').click();
cy.get('.ant-select-dropdown')
.not('.ant-select-dropdown-hidden')
.first()
.within(() => {
cy.get('.ant-select-item-option[title="Ground truth"]').click();
});
cy.get('.cvat-input-frame-count').clear();
cy.get('.cvat-input-frame-count').type(1);

cy.intercept('POST', '/api/jobs**', (req) => {
req.continue((res) => {
res.setDelay(1000);
});
}).as('delayedRequest');

cy.contains('button', 'Submit').click({ force: true });
cy.contains('button', 'Submit').should('be.disabled');
cy.wait('@delayedRequest');

cy.get('.cvat-canvas-container').should('exist').and('be.visible');
cy.url().then((url) => {
jobID = Number(url.split('/').slice(-1)[0].split('?')[0]);
}).should('match', /\/tasks\/\d+\/jobs\/\d+/);
});

cy.intercept('POST', '/api/jobs**', (req) => {
req.continue((res) => {
res.setDelay(1000);
it('Check GT annotations can not be shown in standard annotation view', () => {
cy.headlessCreateJob({
task_id: taskID,
frame_count: 4,
type: 'ground_truth',
frame_selection_method: 'random_uniform',
seed: 1,
}).then((jobResponse) => {
groundTruthJobID = jobResponse.jobID;
return cy.headlessCreateObjects(groundTruthFrames.map((frame, index) => {
const gtRect = groundTruthRectangles[index];
return {
objectType: 'shape',
labelName,
type: 'rectangle',
occluded: false,
frame,
points: [gtRect.firstX, gtRect.firstY, gtRect.secondX, gtRect.secondY],
};
}), groundTruthJobID);
}).then(() => {
cy.visit(`/tasks/${taskID}/jobs/${jobID}`);
cy.get('.cvat-canvas-container').should('exist');

cy.changeWorkspace('Review');
cy.get('.cvat-objects-sidebar-show-ground-truth').click();
cy.get('.cvat-objects-sidebar-show-ground-truth').should(
'have.class', 'cvat-objects-sidebar-show-ground-truth-active',
);
groundTruthFrames.forEach((frame, index) => {
cy.goCheckFrameNumber(frame);
checkRectangleAndObjectMenu(groundTruthRectangles[index]);
});

cy.interactMenu('Open the task');
cy.get('.cvat-task-job-list').within(() => {
cy.contains('a', `Job #${jobID}`).click();
});
groundTruthFrames.forEach((frame) => {
cy.goCheckFrameNumber(frame);
cy.get('.cvat_canvas_shape').should('not.exist');
cy.get('.cvat-objects-sidebar-state-item').should('not.exist');
});
});
}).as('delayedRequest');

cy.contains('button', 'Submit').click({ force: true });
cy.contains('button', 'Submit').should('be.disabled');
cy.wait('@delayedRequest');

cy.get('.cvat-canvas-container').should('exist').and('be.visible');
cy.url().then((url) => {
jobID = Number(url.split('/').slice(-1)[0].split('?')[0]);
}).should('match', /\/tasks\/\d+\/jobs\/\d+/);
});
});

it('Check GT annotations can not be shown in standard annotation view', () => {
cy.headlessCreateJob({
task_id: taskID,
frame_count: 4,
type: 'ground_truth',
frame_selection_method: 'random_uniform',
seed: 1,
}).then((jobResponse) => {
groundTruthJobID = jobResponse.jobID;
return cy.headlessCreateObjects(groundTruthFrames.map((frame, index) => {
const gtRect = groundTruthRectangles[index];
return {
objectType: 'shape',
labelName,
type: 'rectangle',
occluded: false,
frame,
points: [gtRect.firstX, gtRect.firstY, gtRect.secondX, gtRect.secondY],
};
}), groundTruthJobID);
}).then(() => {
cy.visit(`/tasks/${taskID}/jobs/${jobID}`);
cy.get('.cvat-canvas-container').should('exist');

cy.changeWorkspace('Review');
cy.get('.cvat-objects-sidebar-show-ground-truth').click();
cy.get('.cvat-objects-sidebar-show-ground-truth').should(
'have.class', 'cvat-objects-sidebar-show-ground-truth-active',
describe('GT jobs from videos', () => {
const serverFilesVideo = ['videos/video_1.mp4'];
before(() => {
createAndOpenTask(
serverFilesVideo,
{ ...defaultValidationParams, randomSeed: 634, frameCount: 1 },
// this seed yields frame index 2 > frameCount for this job
// which is the condition for reproducing the bug
);
groundTruthFrames.forEach((frame, index) => {
cy.goCheckFrameNumber(frame);
checkRectangleAndObjectMenu(groundTruthRectangles[index]);
});

cy.interactMenu('Open the task');
cy.get('.cvat-task-job-list').within(() => {
cy.contains('a', `Job #${jobID}`).click();
});
groundTruthFrames.forEach((frame) => {
cy.goCheckFrameNumber(frame);
cy.get('.cvat_canvas_shape').should('not.exist');
cy.get('.cvat-objects-sidebar-state-item').should('not.exist');
cy.contains('a', `Job #${groundTruthJobID}`).click();
});
});
it('Check crashing while navigating through GT job frames (#9095) ', () => {
cy.get('.ant-notification-notice-error').should('not.exist');
});
after(() => {
cy.headlessDeleteTask(taskID);
});
});
});
});
Loading