Test External Browser launched with KIF in iOS

436 Views Asked by At

I'm using Swift, XCode 6.1 and KIF for integration test.

How can I see if the web browser was launched if I use this:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.daledietrich.com"]];

Or how can I launch an URL in the external browser and test it?

1

There are 1 best solutions below

0
On BEST ANSWER

KIF can't assert what was opened with Safari. It can only do things within your app.

If you just want to know that that specific URL was launched, you should probably use a unit test. openURL is an SDK method though so not a lot of value in testing that it does launch. If it fails then Apple needs to release an OS update to fix it so you can't do anything to fix it anyway. Instead, just test that the URL string is the correct string.