-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add more options and more steps for realSwipe (#21)
- Loading branch information
1 parent
ecd6f7e
commit 457f6d1
Showing
2 changed files
with
83 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
describe("cy.realSwipe", () => { | ||
beforeEach(() => { | ||
cy.viewport("iphone-x") | ||
cy.visit("https://csb-dhe0i-qj8xxmx8y.vercel.app/"); | ||
}); | ||
|
||
([ | ||
{ | ||
button: "left", | ||
swipe: "toRight", | ||
swipe: "toLeft", | ||
touchPosition: "right", | ||
}, | ||
{ | ||
button: "right", | ||
swipe: "toLeft", | ||
swipe: "toRight", | ||
touchPosition: "left", | ||
}, | ||
{ | ||
button: "top", | ||
swipe: "toBottom", | ||
swipe: "toTop", | ||
touchPosition: "center", | ||
}, | ||
{ | ||
button: "bottom", | ||
swipe: "toTop", | ||
swipe: "toBottom", | ||
touchPosition: "top", | ||
}, | ||
] as const).forEach(({ button, swipe, touchPosition }) => { | ||
it(`swipes ${button} drawer ${swipe}`, () => { | ||
cy.contains("button", button).click(); | ||
cy.get(".MuiDrawer-paper").realSwipe(swipe, { touchPosition }); | ||
cy.get(".MuiDrawer-paper").realSwipe(swipe, { length: 150, step: 10, touchPosition }); | ||
|
||
cy.get(".MuiDrawer-paper").should("not.be.visible"); | ||
}); | ||
}); | ||
|
||
it("opens drawer with swipe", () => { | ||
cy.get('.jss3.jss4').realSwipe("toRight", { length: 150, step: 10, touchPosition: "center" }); | ||
cy.get('.MuiDrawer-paper').realSwipe("toLeft", { length: 150, step: 10, touchPosition: "center" }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters