-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
71 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
43 changes: 21 additions & 22 deletions
43
packages/react-components/cypress/stories/video-player.spec.tsx
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,25 +1,24 @@ | ||
// import { composeStories } from '@storybook/react' | ||
import { composeStories } from '@storybook/react' | ||
import React from 'react' | ||
import * as stories from '../../stories/video-player.stories' | ||
import { checkVideoEvents, checkVideoIsVisible, setupVideoTestUtils } from '../utils/video-test-utils' | ||
|
||
// import * as stories from '../../stories/video-player.stories' | ||
const testCases = Object.values(composeStories(stories)) | ||
.map((Story) => [Story.storyName!, Story]) | ||
.filter(([name]) => name !== 'VideoNoContent') | ||
|
||
// const GIF_ID = 'WtUBmrAK1Yda649Ayr' | ||
|
||
// const composedStories = composeStories(stories) | ||
|
||
describe.skip('Video Player', () => { | ||
// composedStories.forEach((story) => { | ||
// let videoTestUtilsCtx: VideoTestUtilsContext | ||
// before(() => { | ||
// videoTestUtilsCtx = setupVideoTestUtils(GIF_ID, { loop: true }) | ||
// }) | ||
// it(story.key, () => { | ||
// const snapshotNamePrefix = `Stories / Video Player / ${story.key}` | ||
// cy.mount(<story.Component {...videoTestUtilsCtx.events} />) | ||
// checkVideoIsVisible(videoTestUtilsCtx, { takeSnapshots: true, snapshotNamePrefix }) | ||
// // Check events only for one story to save resources on duplicate tests | ||
// if (story.key === 'VideoWithControls') { | ||
// checkVideoEvents(videoTestUtilsCtx) | ||
// } | ||
// }) | ||
// }) | ||
describe('Video Player', () => { | ||
testCases.forEach(([name = '', Story]) => { | ||
it(`Story: ${name}`, () => { | ||
// @ts-ignore | ||
const videoTestUtilsCtx = setupVideoTestUtils(Story.args.id, { loop: true }) | ||
// const snapshotNamePrefix = `Stories / Video Player / ${story.key}` | ||
cy.mount(<Story {...videoTestUtilsCtx.events} />) | ||
checkVideoIsVisible(videoTestUtilsCtx) | ||
// Check events only for one story to save resources on duplicate tests | ||
if (name === 'VideoWithControls') { | ||
checkVideoEvents(videoTestUtilsCtx) | ||
} | ||
}) | ||
}) | ||
}) |
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,43 +1,25 @@ | ||
import * as React from 'react' | ||
|
||
import { composeStories } from '@storybook/react' | ||
import * as React from 'react' | ||
import * as stories from '../../stories/video.stories' | ||
import { getVideoElement } from '../utils/video-test-utils' | ||
|
||
const storiesGifIds = { | ||
Video: 'D068R9Ziv1iCjezKzG', | ||
VideoCaptionsBeta: 'D068R9Ziv1iCjezKzG', | ||
VideoUserMuted: 'obhOJFSwuTRN7VDY55', | ||
VideoNoContent: 'ZEU9ryYGZzttn0Cva7', | ||
} as const | ||
|
||
const { VideoNoContent } = composeStories(stories) | ||
|
||
describe.skip('Video', () => { | ||
// composedStories.forEach((story) => { | ||
// let videoTestUtilsCtx: VideoTestUtilsContext | ||
|
||
// before(() => { | ||
// videoTestUtilsCtx = setupVideoTestUtils(storiesGifIds[story.key], { loop: true }) | ||
// }) | ||
|
||
// it(story.key, () => { | ||
// const snapshotNamePrefix = `Video - ${story.key}` | ||
// cy.mount(<story.Component {...videoTestUtilsCtx.events} />) | ||
|
||
// checkVideoIsVisible(videoTestUtilsCtx, { takeSnapshots: true, snapshotNamePrefix }) | ||
// // Check events only for one story to save resources on duplicate tests | ||
// if (story.key === 'Video') { | ||
// checkVideoEvents(videoTestUtilsCtx) | ||
// } | ||
// }) | ||
// }) | ||
|
||
it('VideoNoContent', () => { | ||
const gifId = storiesGifIds.VideoNoContent | ||
cy.mount(<VideoNoContent />) | ||
cy.wait(1000) | ||
getVideoElement(gifId).should('not.exist') | ||
cy.percySnapshot('Video - VideoNoContent') | ||
import { checkVideoEvents, checkVideoIsVisible, setupVideoTestUtils } from '../utils/video-test-utils' | ||
|
||
const testCases = Object.values(composeStories(stories)) | ||
.map((Story) => [Story.storyName!, Story]) | ||
.filter(([name]) => name !== 'VideoNoContent') | ||
|
||
describe('Video', () => { | ||
testCases.forEach(([name = '', Story]) => { | ||
it(`Story: ${name}`, () => { | ||
// @ts-ignore | ||
const videoTestUtilsCtx = setupVideoTestUtils(Story.args.id, { loop: true }) | ||
const snapshotNamePrefix = `Video - ${name}` | ||
cy.mount(<Story {...videoTestUtilsCtx.events} />) | ||
|
||
checkVideoIsVisible(videoTestUtilsCtx, { takeSnapshots: true, snapshotNamePrefix }) | ||
// Check events only for one story to save resources on duplicate tests | ||
if (name === 'Video') { | ||
checkVideoEvents(videoTestUtilsCtx) | ||
} | ||
}) | ||
}) | ||
}) |
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