From a2997960c3b2382852f1bc73e237489b57334181 Mon Sep 17 00:00:00 2001 From: Dmitry Kruchinin <33020454+dvkruchinin@users.noreply.github.com> Date: Mon, 14 Sep 2020 08:55:55 +0300 Subject: [PATCH] Cypress test for PR 1370. (#2152) Co-authored-by: Dmitry Kruchinin Co-authored-by: Boris Sekachev --- tests/cypress.json | 1 + ..._with_object_dragging_and_go_next_frame.js | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tests/cypress/integration/pr_1370_check_UI_fail_with_object_dragging_and_go_next_frame.js diff --git a/tests/cypress.json b/tests/cypress.json index 09429d82..b1181733 100644 --- a/tests/cypress.json +++ b/tests/cypress.json @@ -11,6 +11,7 @@ "testFiles": [ "auth_page.js", "issue_*.js", + "pr_*.js", "case_*.js", "remove_users_tasks.js" ] diff --git a/tests/cypress/integration/pr_1370_check_UI_fail_with_object_dragging_and_go_next_frame.js b/tests/cypress/integration/pr_1370_check_UI_fail_with_object_dragging_and_go_next_frame.js new file mode 100644 index 00000000..b3779c0e --- /dev/null +++ b/tests/cypress/integration/pr_1370_check_UI_fail_with_object_dragging_and_go_next_frame.js @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2020 Intel Corporation + * + * SPDX-License-Identifier: MIT + */ + +/// + +context('Check if the UI fails by moving to the next frame while dragging the object', () => { + + const prId = '1370' + const labelName = `PR ${prId}` + const taskName = `New annotation task for ${labelName}` + const attrName = `Attr for ${labelName}` + const textDefaultValue = 'Some default value for type Text' + const imagesCount = 3 + let images = [] + for ( let i = 1; i <= imagesCount; i++) { + images.push(`image_${prId}_${i}.png`) + } + const width = 800 + const height = 800 + const posX = 10 + const posY = 10 + const color = 'gray' + const archiveName = `images_issue_${prId}.zip` + const archivePath = `cypress/fixtures/${archiveName}` + const imagesFolder = `cypress/fixtures/image_issue_${prId}` + 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 PR "${prId}"`, () => { + it('Create object', () => { + cy.createShape(200, 300, 300, 400) + }) + it('Start object dragging and go to next frame (F).', () => { + cy.get('#cvat_canvas_shape_1') + .trigger('mousemove') + .trigger('mouseover') + .trigger('mousedown', {which: 1}) + cy.get('body') + .type('f') + }) + it('Page with the error is missing', () => { + cy.contains('Oops, something went wrong') + .should('not.exist') + }) + }) +})