Skip to content

Commit

Permalink
Added 2 cypress tests (#4278)
Browse files Browse the repository at this point in the history
* Implemented test for issue #3975 PR #4189
  • Loading branch information
Boris Sekachev authored Feb 3, 2022
1 parent 58a71a4 commit 29f14a8
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// Copyright (C) 2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

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

context('Delete a label from a task.', () => {
const labelName = 'car';
const taskName = 'Test correct state changing on first annotations save';
const attrName = 'Dummy attribute';
const textDefaultValue = 'Test';
const imagesCount = 1;
const imageFileName = `image_${labelName}`;
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 rectangleData = {
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);
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName);
cy.openTask(taskName);
});

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

describe(`Testing "${labelName}"`, () => {
it('State of the created task should be "new".', () => {
cy.get('td.cvat-job-item-state').invoke('text').should('equal', 'new');
});

it('Create object, save annotation, state should be "in progress"', () => {
cy.openJob();
cy.createRectangle(rectangleData);
cy.saveJob();
cy.interactMenu('Open the task');
cy.reload();
cy.get('td.cvat-job-item-state').invoke('text').should('equal', 'in progress');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,25 @@ context('Some parts of the Redux state (issues) is not reset after changing a ta
it('Create an issue. Check issue 2633.', () => {
cy.openTaskJob(taskName.firstTaskName);
cy.changeWorkspace('Review');
cy.createIssueFromControlButton(createIssueRectangle);
cy.createIssueFromControlButton(createIssueRectangle).then(() => {
const viewportHeight = Cypress.config('viewportHeight');
const viewportWidth = Cypress.config('viewportWidth');
function waitForResize() {
return new Cypress.Promise((resolve) => {
cy.window().then((win) => {
win.addEventListener('resize', () => {
resolve();
}, { once: true });
});
});
}

cy.viewport(viewportHeight + 50, viewportWidth + 50);
cy.wrap(waitForResize()).then(() => {
cy.get('.cvat_canvas_issue_region').should('be.visible');
cy.viewport(viewportHeight, viewportWidth);
});
});
cy.createIssueFromControlButton(createIssuePoint); // Issue 2633
});

Expand Down

0 comments on commit 29f14a8

Please sign in to comment.