Skip to content

Commit

Permalink
add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobSmith-Framer committed Oct 21, 2021
1 parent add9320 commit 41d1d64
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
12 changes: 12 additions & 0 deletions cypress/integration/layout-cancelled-finishes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe("Cancelled Animation", () => {
it("Allows the ", () => {
cy.visit("?test=layout-cancelled-finishes")
.get("[data-testid='cancellable']")
.trigger("click")
.wait(200)
.should(($cancellable: any) => {
const cancellable = $cancellable[0] as HTMLDivElement
expect(cancellable).to.not.exist
})
})
})
19 changes: 19 additions & 0 deletions dev/tests/layout-cancelled-finishes.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import * as React from "react"
import { motion, AnimatePresence, useInstantLayoutTransition } from "@framer"

export const App = () => {
const [isVisible, setIsVisible] = React.useState(true)
const startTransition = useInstantLayoutTransition()

return (
<AnimatePresence>
{isVisible && (
<motion.div
onClick={() => startTransition(() => setIsVisible(false))}
data-testid="cancellable"
style={{ height: 100 }}
/>
)}
</AnimatePresence>
)
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"test-e2e-chrome": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --browser chrome --spec \"cypress/integration/layout-relative.chrome.ts\"'",
"test-e2e-electron": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --config ignoreTestFiles=*.chrome.ts'",
"test-e2e": "yarn test-e2e-chrome && yarn test-e2e-electron",
"test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/drag.ts\"'",
"test-e2e-file": "start-server-and-test start-dev-server http://localhost:9990 'cypress run --headless --spec \"cypress/integration/layout-cancelled-finishes.ts\"'",
"test-watch": "jest --watch --coverage --coverageReporters=lcov --config jest.config.json",
"projection-dev": "python -m SimpleHTTPServer",
"collect-projection-tests": "node ./dev/projection/collect-projection-tests.js",
Expand Down

0 comments on commit 41d1d64

Please sign in to comment.