fix(vue): improve swipe to go back reliability (#22288)

resolves #22237
This commit is contained in:
Liam DeBeasi
2020-10-12 11:32:28 -04:00
committed by GitHub
parent 16cf98ffbd
commit c74fd4147b
7 changed files with 149 additions and 40 deletions

View File

@ -24,11 +24,20 @@
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
Cypress.Commands.add('ionSwipeToGoBack', (complete = false) => {
cy.get('ion-router-outlet')
.trigger('mousedown', { position: "left" })
.trigger('mousemove', { clientX: (complete) ? 100 : 300, clientY: 275 })
.trigger('mouseup', { force: true })
Cypress.Commands.add('ionSwipeToGoBack', (complete = false, selector = 'ion-router-outlet') => {
const increment = (complete) ? 60 : 25;
cy.get(selector)
.first()
.trigger('mousedown', 0, 275, { which: 1, force: true })
.trigger('mousemove', increment * 1, 275, { which: 1, force: true })
.wait(50)
.trigger('mousemove', increment * 2, 275, { which: 1, force: true })
.wait(50)
.trigger('mousemove', increment * 3, 275, { which: 1, force: true })
.wait(50)
.trigger('mousemove', increment * 4, 275, { which: 1, force: true })
.wait(50)
.trigger('mouseup', increment * 4, 275, { which: 1, force: true })
cy.wait(150);
})