Skip to content

Commit

Permalink
Cleaned up next-image e2e test for easier extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jankaifer committed Nov 22, 2022
1 parent df6e635 commit 536b0d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Expand Up @@ -20,14 +20,11 @@ const MotionImage = motion(CustomImage)
export default function Page() {
const [clicked, setClicked] = useState(false)
return (
<>
<h1>Framer demo</h1>
<MotionImage
onClick={() => setClicked(true)}
initial={{ opacity: 1 }}
animate={{ opacity: clicked ? 0 : 1 }}
transition={{ duration: 0.5 }}
/>
</>
<MotionImage
onClick={() => setClicked(true)}
initial={{ opacity: 1 }}
animate={{ opacity: clicked ? 0 : 1 }}
transition={{ duration: 0.5 }}
/>
)
}
4 changes: 2 additions & 2 deletions test/e2e/next-image/index.test.ts
Expand Up @@ -4,7 +4,7 @@ import { waitFor } from 'next-test-utils'
import path from 'path'
import webdriver from 'next-webdriver'

describe('next-image', () => {
describe('next-image-forward-ref', () => {
let next: NextInstance

const appDir = path.join(__dirname, 'app')
Expand All @@ -20,7 +20,7 @@ describe('next-image', () => {
afterAll(() => next.destroy())

it('allows framer-motion to animate opacity', async () => {
const browser = await webdriver(next.url, '/')
const browser = await webdriver(next.url, '/framer-motion')
expect(
Number(await browser.elementById('img').getComputedCss('opacity'))
).toBeCloseTo(1)
Expand Down

0 comments on commit 536b0d7

Please sign in to comment.