From 2ae01ebee8f8b1ea2d3d35cf6e2b1e666dfd7a0a Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin Date: Mon, 7 Sep 2020 13:54:08 +0300 Subject: [PATCH] Cypress test for issue 1368. --- ..._1368_points_track_invisible_next_frame.js | 62 +++++++++++++++++++ tests/cypress/support/commands.js | 4 +- 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 tests/cypress/integration/issue_1368_points_track_invisible_next_frame.js diff --git a/tests/cypress/integration/issue_1368_points_track_invisible_next_frame.js b/tests/cypress/integration/issue_1368_points_track_invisible_next_frame.js new file mode 100644 index 000000000000..d9fd151ef25e --- /dev/null +++ b/tests/cypress/integration/issue_1368_points_track_invisible_next_frame.js @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + */ + +/// + +context('Points track it is still invisible on next frames', () => { + + const issueId = '1368' + const labelName = `Issue ${issueId}` + const taskName = `New annotation task for ${labelName}` + const attrName = `Attr for ${labelName}` + const textDefaultValue = 'Some default value for type Text' + const images = [`image_${issueId}_1.png`, + `image_${issueId}_2.png`, + `image_${issueId}_3.png`] + const width = 800 + const height = 800 + const posX = 10 + const posY = 10 + const color = 'white' + const archiveName = `images_issue_${issueId}.zip` + const archivePath = `cypress/fixtures/${archiveName}` + const imagesFolder = `cypress/fixtures/image_issue_${issueId}` + const directoryToArchive = imagesFolder + + before(() => { + cy.visit('auth/login') + cy.login() + for (let img of images) { + cy.imageGenerator(imagesFolder, img, width, height, color, posX, posY, labelName) + } + cy.createZipArchive(directoryToArchive, archivePath) + cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName) + cy.openTaskJob(taskName) + }) + + describe(`Testing issue "${issueId}"`, () => { + it('Create a points track', () => { + cy.createPoint(300, 410, 'Track') + cy.get('#cvat-objects-sidebar-state-item-1') + .should('contain', '1').and('contain', 'POINTS TRACK') + }) + it('Switch outside property', () => { + cy.get('#cvat_canvas_shape_1') + .trigger('mousemove') + .trigger('mouseover') + cy.get('body') + .type('o') + cy.get('#cvat_canvas_shape_1') + .should('be.hidden') + }) + it('Point track on the next frame should not exist', () => { + cy.get('.cvat-player-next-button') + .click() + cy.get('#cvat_canvas_shape_1') + .should('not.exist') + }) + }) +}) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index a9cef747b346..84f85708f1ab 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -107,11 +107,11 @@ Cypress.Commands.add('createTrack', (firstX, firstY, lastX, lastY) => { .click(lastX, lastY) }) -Cypress.Commands.add('createPoint', (posX, posY) => { +Cypress.Commands.add('createPoint', (posX, posY, type='Shape') => { cy.get('.cvat-draw-points-control').click() cy.get('.cvat-draw-shape-popover-content') .find('button') - .contains('Shape') + .contains(type) .click({force: true}) cy.get('.cvat-canvas-container') .click(posX, posY)