From b0006d84b50a85ae495c032c1f622bf1a2dda3f7 Mon Sep 17 00:00:00 2001 From: agriyadev5 Date: Tue, 24 Aug 2021 19:01:51 +0530 Subject: [PATCH] #603 image tool added for cypress test cases --- .../ui/__snapshots__/scenario1.js.snap | 86 +++++++++++++++++++ cypress/integration/ui/scenario1.js | 28 +++--- 2 files changed, 104 insertions(+), 10 deletions(-) diff --git a/cypress/integration/ui/__snapshots__/scenario1.js.snap b/cypress/integration/ui/__snapshots__/scenario1.js.snap index 6c29fcec..0064c876 100644 --- a/cypress/integration/ui/__snapshots__/scenario1.js.snap +++ b/cypress/integration/ui/__snapshots__/scenario1.js.snap @@ -175,3 +175,89 @@ exports[`use all parts of svg-edit > check mode_connect #0`] = ` `; + +exports[`use all parts of svg-edit > check tool_image #0`] = ` + + + Layer 1 + + + + + + + + + +`; diff --git a/cypress/integration/ui/scenario1.js b/cypress/integration/ui/scenario1.js index 5a8d222c..2273b50e 100644 --- a/cypress/integration/ui/scenario1.js +++ b/cypress/integration/ui/scenario1.js @@ -49,7 +49,7 @@ describe('use all parts of svg-edit', function () { .trigger('mouseup', { force: true }); cy.get('#svgcontent').toMatchSnapshot(); }); - /* it('check mode_connect', function () { + it('check mode_connect', function () { cy.get('#tool_rect').click({ force: true }); cy.get('#svgcontent') .trigger('mousedown', 100, -60, { force: true }) @@ -60,24 +60,32 @@ describe('use all parts of svg-edit', function () { .trigger('mousedown', 250, -60, { force: true }) .trigger('mousemove', 430, 120, { force: true }) .trigger('mouseup', { force: true }); - cy.get('#tool_select').click({ force: true }); - cy.get('#mode_connect').click({ force: true }); - + cy.get('#tool_select') + .click({ force: true }); + cy.get('#mode_connect') + .click({ force: true }); cy.get('#svgcontent') - .trigger('mousedown', -10, -10, { force: true }) - .trigger('mousemove', -180, -180, { force: true }) - .trigger('mouseup', { force: true }); + .trigger('mousemove', 220, 80, { force: true }) + .trigger('mousedown', 220, 80, { force: true }) + .trigger('mouseup', 220, 80, { force: true }); + cy.get('#svgcontent') + .trigger('mousemove', 410, 80, { force: true }) + .trigger('mousedown', 410, 80, { force: true }) + .trigger('mouseup', 410, 80, { force: true }); cy.get('#svgcontent').toMatchSnapshot(); }); it('check tool_image', function () { cy.get('#tool_image').click({ force: true }); cy.get('#svgcontent') - .trigger('mousemove', 100, 100, { force: true }) .trigger('mousedown', 100, 100, { force: true }) + .trigger('mousemove', 120, 120, { force: true }) .trigger('mouseup', { force: true }); - cy.on('window:confirm', () => true); + cy.window().then(($win) => { + cy.stub($win, 'prompt').returns('./images/logo.svg'); + cy.contains('OK'); + }); cy.get('#svgcontent').toMatchSnapshot(); - }); */ + }); });