Skip to content

Commit

Permalink
Added cypress tests for the feature: 'continue frame n' (#4340)
Browse files Browse the repository at this point in the history
* Added cypress tests for the feature: 'continue frame n'

* Update tests/cypress/integration/actions_tasks/continue_frame_n.js

* Update tests/cypress/integration/actions_tasks/continue_frame_n.js
  • Loading branch information
bsekachev authored Feb 15, 2022
1 parent ae50696 commit f719648
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cvat-ui/src/components/annotation-page/annotation-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default function AnnotationPageComponent(props: Props): JSX.Element {
<span>
Press
<Button
className='cvat-continue-job-button'
className='cvat-notification-continue-job-button'
type='link'
onClick={() => {
changeFrame(parsedFrame);
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/components/annotation-page/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ button.cvat-predictor-button {
font-weight: bold;
}

.cvat-continue-job-button {
.cvat-notification-continue-job-button {
padding: 0;

> span {
Expand Down
58 changes: 58 additions & 0 deletions tests/cypress/integration/actions_tasks/continue_frame_n.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright (C) 2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

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

context('Paste labels from one task to another.', { browser: '!firefox' }, () => {
const task = {
name: 'Test "Continue frame N"',
label: 'Test label',
attrName: 'Test attribute',
attrValue: 'Test attribute value',
};

const imagesCount = 3;
const imageFileName = `image_${task.name.replace(' ', '_').toLowerCase()}`;
const width = 100;
const height = 100;
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;

before(() => {
cy.visit('/');
cy.login();
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, task.name, imagesCount);
cy.createZipArchive(directoryToArchive, archivePath);
cy.goToTaskList();
cy.createAnnotationTask(task.name, task.label, task.attrName, task.attrValue, archiveName);
});

after(() => {
cy.logout();
cy.getAuthKey().then((authKey) => {
cy.deleteTasks(authKey, [task.name, task.nameSecond]);
});
});

describe('Test "Continue frame N"', () => {
it('Open job, go to the 3rd frame, close task, reopen, notification exists.', () => {
cy.openTaskJob(task.name);
cy.checkFrameNum(0);
cy.goCheckFrameNumber(2);
cy.goToTaskList();
cy.openTaskJob(task.name);
cy.get('.cvat-notification-continue-job').should('exist');
});

it('Pressing continue button should navigate to the latest opened frame', () => {
cy.get('.cvat-notification-continue-job-button').click();
cy.checkFrameNum(2);
});
});
});

0 comments on commit f719648

Please sign in to comment.