From cd558f22eedb5494d78716f30b11b7e6fa350f8c Mon Sep 17 00:00:00 2001 From: moklick Date: Fri, 4 Oct 2019 13:45:31 +0200 Subject: [PATCH] feat(tests): add zoom --- cypress/integration/flow/basic.spec.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/cypress/integration/flow/basic.spec.js b/cypress/integration/flow/basic.spec.js index 4be01fdd..e6a4d977 100644 --- a/cypress/integration/flow/basic.spec.js +++ b/cypress/integration/flow/basic.spec.js @@ -80,14 +80,31 @@ describe('Basic Flow Rendering', () => { const newPosition = { clientX: Cypress.config('viewportWidth') * 0.6, - clientY: Cypress.config('viewportHeight') * 0.6 + clientY: Cypress.config('viewportHeight') * 0.7 }; + const styleBeforeDrag = Cypress.$('.react-graph__nodes').css('transform'); + cy.window().then((win) => { cy.get('.react-graph__zoompane') .trigger('mousedown', { which: 1, view: win }) .trigger('mousemove', newPosition) - .trigger('mouseup', { force: true, view: win }); + .trigger('mouseup', { force: true, view: win }) + .then(() => { + const styleAfterDrag = Cypress.$('.react-graph__nodes').css('transform'); + expect(styleBeforeDrag).to.not.equal(styleAfterDrag); + }); }); }); + + it('zooms the pane', () => { + const styleBeforeZoom = Cypress.$('.react-graph__nodes').css('transform'); + + cy.get('.react-graph__zoompane') + .trigger('wheel','topLeft', { deltaY: -200 }) + .then(() => { + const styleAfterZoom = Cypress.$('.react-graph__nodes').css('transform'); + expect(styleBeforeZoom).to.not.equal(styleAfterZoom); + }); + }); }); \ No newline at end of file