Skip to content

Commit

Permalink
add interaction test to test tooltip focus visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
joshfarrant committed Jan 13, 2025
1 parent 288583b commit 33870b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/react/src/VideoPlayer/VideoPlayer.features.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {Stack} from '../Stack'
import {Button} from '../Button'
import {useVideo} from './hooks'
import styles from './VideoPlayer.stories.module.css'
import {expect, userEvent, waitFor, within} from '@storybook/test'

export default {
title: 'Components/VideoPlayer/Features',
Expand Down Expand Up @@ -104,3 +105,20 @@ export const CustomPlayIcon = () => (
<VideoPlayer.Track src="./example.vtt" default />
</VideoPlayer>
)

export const TooltipVisibleOnFocus = () => (
<VideoPlayer title="GitHub media player">
<VideoPlayer.Source src="./example.mp4" type="video/mp4" />
<VideoPlayer.Track src="./example.vtt" default />
</VideoPlayer>
)
TooltipVisibleOnFocus.play = async ({canvasElement}) => {
const {getByText} = within(canvasElement)

await waitFor(() => expect(getByText('Play video')).not.toBeVisible())

await userEvent.tab()
await userEvent.tab()

await waitFor(() => expect(getByText('Play video')).toBeVisible())
}

0 comments on commit 33870b0

Please sign in to comment.