fix(cypress): use wait for drag handlers

This commit is contained in:
moklick
2022-04-28 23:49:56 +02:00
parent ebf2a66639
commit 8a7bc49c79
7 changed files with 49 additions and 34 deletions
+5 -4
View File
@@ -38,8 +38,9 @@ describe('Controls Testing', () => {
cy.window().then((win) => {
cy.get('.react-flow__renderer')
.trigger('mousedown', 'topLeft', { which: 1, view: win })
.trigger('mousemove', 'bottomLeft')
.trigger('mouseup', { force: true, view: win })
.trigger('mousemove', 10, 400)
.wait(50)
.trigger('mouseup', 10, 400, { force: true, view: win })
.then(() => {
const styleAfterDrag = Cypress.$('.react-flow__viewport').css('transform');
expect(styleBeforeDrag).to.not.equal(styleAfterDrag);
@@ -60,7 +61,7 @@ describe('Controls Testing', () => {
it('uses interactive control - not interactive', () => {
cy.get('.react-flow__node:first').click().should('have.class', 'selected');
cy.get('.react-flow__renderer').click('bottomRight');
cy.get('.react-flow__pane').click('topLeft');
cy.get('.react-flow__node:first').should('not.have.class', 'selected');
cy.get('.react-flow__controls-interactive')
@@ -74,7 +75,7 @@ describe('Controls Testing', () => {
cy.get('.react-flow__controls-interactive')
.click()
.then(() => {
cy.get('.react-flow__node:first').click().should('have.class', 'selected');
cy.get('.react-flow__node:first').click({ force: true }).should('have.class', 'selected');
});
});
});