From 6488db956568048c506b447086be7fba4c7cb362 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin Date: Fri, 14 Aug 2020 20:05:38 +0300 Subject: [PATCH 1/2] Cypress test for issue 1819 --- ..._1819_first_part_splitted_track_visible.js | 72 +++++++++++++++++++ tests/cypress/support/commands.js | 12 ++++ 2 files changed, 84 insertions(+) create mode 100644 tests/cypress/integration/issue_1819_first_part_splitted_track_visible.js diff --git a/tests/cypress/integration/issue_1819_first_part_splitted_track_visible.js b/tests/cypress/integration/issue_1819_first_part_splitted_track_visible.js new file mode 100644 index 000000000000..a4e42935486c --- /dev/null +++ b/tests/cypress/integration/issue_1819_first_part_splitted_track_visible.js @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + */ + +/// + +context('First part of a splitted track is visible', () => { + + const issueId = '1819' + 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 = 'gray' + 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 track', () => { + cy.createTrack(309, 431, 616, 671) + }) + it('Go next with a step', () => { + cy.get('.cvat-player-forward-button') + .click() + cy.get('.cvat-player-frame-selector').within(() => { + cy.get('input[role="spinbutton"]') + .should('have.value', '2') + }) + }) + it('Split track', () => { + cy.get('body') + .type('{alt}m') + cy.get('#cvat_canvas_shape_1') + .trigger('mousemove', {which: 1}) + .trigger('click', {which: 1}) + }) + it('Go to previous frame', () => { + cy.get('.cvat-player-previous-button') + .click() + cy.get('.cvat-player-frame-selector').within(() => { + cy.get('input[role="spinbutton"]') + .should('have.value', '1') + }) + }) + it('First part of a splitted track is visible', () => { + cy.get('#cvat_canvas_shape_2') + .should('be.visible') + }) + }) +}) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index 06ad6b38a7a8..a46c0fa31655 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -76,3 +76,15 @@ Cypress.Commands.add('createShape', (ferstX, ferstY, lastX, lastY) => { cy.get('.cvat-canvas-container') .click(lastX, lastY) }) + +Cypress.Commands.add('createTrack', (ferstX, ferstY, lastX, lastY) => { + cy.get('.cvat-draw-rectangle-control').click() + cy.get('.cvat-draw-shape-popover-content') + .find('button') + .contains('Track') + .click({force: true}) + cy.get('.cvat-canvas-container') + .click(ferstX, ferstY) + cy.get('.cvat-canvas-container') + .click(lastX, lastY) +}) From b096eea9095793298c15cc38eb0a560eda7781f4 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin Date: Wed, 19 Aug 2020 12:22:38 +0300 Subject: [PATCH 2/2] Fixing a typo in parameter naming --- tests/cypress/support/commands.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js index a46c0fa31655..e1cbb1722bd6 100644 --- a/tests/cypress/support/commands.js +++ b/tests/cypress/support/commands.js @@ -65,26 +65,26 @@ Cypress.Commands.add('openTaskJob', (taskName) => { cy.openJob() }) -Cypress.Commands.add('createShape', (ferstX, ferstY, lastX, lastY) => { +Cypress.Commands.add('createShape', (firstX, firstY, lastX, lastY) => { cy.get('.cvat-draw-rectangle-control').click() cy.get('.cvat-draw-shape-popover-content') .find('button') .contains('Shape') .click({force: true}) cy.get('.cvat-canvas-container') - .click(ferstX, ferstY) + .click(firstX, firstY) cy.get('.cvat-canvas-container') .click(lastX, lastY) }) -Cypress.Commands.add('createTrack', (ferstX, ferstY, lastX, lastY) => { +Cypress.Commands.add('createTrack', (firstX, firstY, lastX, lastY) => { cy.get('.cvat-draw-rectangle-control').click() cy.get('.cvat-draw-shape-popover-content') .find('button') .contains('Track') .click({force: true}) cy.get('.cvat-canvas-container') - .click(ferstX, ferstY) + .click(firstX, firstY) cy.get('.cvat-canvas-container') .click(lastX, lastY) })