Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write test cases that cover the use of the API #1

Open
gajus opened this issue Sep 17, 2015 · 8 comments
Open

Write test cases that cover the use of the API #1

gajus opened this issue Sep 17, 2015 · 8 comments

Comments

@gajus
Copy link
Owner

gajus commented Sep 17, 2015

react-youtube-player has a simple API:

/**
 * @typedef {String} YoutubePlayer~playbackState
 * @value 'unstarted' Stops and cancels loading of the current video. [stopVideo]{@link https://developers.google.com/youtube/iframe_api_reference#stopVideo}
 * @value 'playing' Plays the currently cued/loaded video. [playVideo]{@link https://developers.google.com/youtube/iframe_api_reference#playVideo}
 * @value 'paused' Pauses the currently playing video. [pauseVideo]{@link https://developers.google.com/youtube/iframe_api_reference#pauseVideo}
 */

/**
 * @property {String} videoId
 * @property {String|Number} width (default: '100%').
 * @property {String|Number} height (default: '100%').
 * @property {YoutubePlayer~playbackState} playbackState
 */

./example/ demonstrates how to control a react-youtube-player component using property values that are controlled using user input.

However, testing how properties affect YouTube player state is not as straightforward. Tests need to account for things such as state change when video stops playing. How state of the YouTube player affects how properties are interpreted, etc.

The nature of the component requires that it is tested using a real browser (using a test runner such as Karma).

The scope of this issue is to write a test scope and implement it.

@gajus
Copy link
Owner Author

gajus commented Sep 17, 2015

There is an open bounty to complete this task. https://www.bountysource.com/issues/26763180-write-test-cases-that-cover-the-use-of-the-api

@sambuddhabasu
Copy link

Hello @gajus , I am interested in solving this issue. Can you let me know where to get started from?

@LongLiveCHIEF
Copy link

What browser targets would you like to see the tests pass in? Will the usual stable of latest Chrome, Safari, Firefox, IE11, and Edge be sufficient?

@gajus
Copy link
Owner Author

gajus commented Dec 13, 2015

@H3Chief PhantomJS (ie. Chrome) would be enough.

@LongLiveCHIEF
Copy link

great. Thanks!

@eimfach
Copy link

eimfach commented Apr 24, 2016

Does still need to get done?

@gajus
Copy link
Owner Author

gajus commented Apr 24, 2016

@eimfach Absolutely.

PlasmaPower added a commit to PlasmaPower/react-youtube-player that referenced this issue May 10, 2016
PlasmaPower added a commit to PlasmaPower/react-youtube-player that referenced this issue May 10, 2016
PlasmaPower added a commit to PlasmaPower/react-youtube-player that referenced this issue May 10, 2016
PlasmaPower added a commit to PlasmaPower/react-youtube-player that referenced this issue May 10, 2016
PlasmaPower added a commit to PlasmaPower/react-youtube-player that referenced this issue May 10, 2016
PlasmaPower added a commit to PlasmaPower/react-youtube-player that referenced this issue May 10, 2016
PlasmaPower added a commit to PlasmaPower/react-youtube-player that referenced this issue May 10, 2016
@gajus gajus closed this as completed in #7 May 10, 2016
@gajus gajus reopened this Mar 20, 2017
@gajus
Copy link
Owner Author

gajus commented Mar 20, 2017

The existing tests were testing youtube-player implementation rather than react-youtube-player. A test case should mock youtube-player and focus only on ensuring that the appropriate methods are invoked via the API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants