TestSwarm for Popcorn on iOS

Today, David Seifried and I worked on getting TestSwarm to run the Popcorn unit tests on the iOS simulator. Previously, the simulator kept saying that there were no jobs to run. After some digging and trying different things out, Dave figured out what the problem was. The simulator is now able to run the tests when a job is pushed up to it! This is very good.

The reason we need to create our own custom app is because Safari requires user action in order for media playback to occur. This doesn’t work for the purposes of automated testing. When first thinking about this problem, I initially thought that I was going to need to inject JavaScript into the WebView that would eventually lead to the Objective-C triggering the video to play. But, the fix for this actually ended up being simple, and I found it when I wrote an older post, DPS911 Release 3. As stated in that post, the UIWebView class has a mediaPlaybackRequiresUserAction property that I can set to no, which will let videos play automatically.

The code for that is:

[[self theWebView] setMediaPlaybackRequiresUserAction:NO];

And it works! Just one line. Now TestSwarm can run Popcorn tests on iOS using the simulator and the physical device!

Advertisements
This entry was posted in Open Source. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s