views:

49

answers:

1

The title say's almost all. What I have is short lived server processes that serves a web-based javascript test suite with optionally accompanying back-ends for integration tests (see here for how it's done). I'm looking for a better way to direct the iPhone Emulator's Safari to the URL given.

More, possibly optional background:

Up until iOS SDK 4.0 I've managed to control XCode using AppleScript to start a specially prepared PhoneGap project in this fashion:

  1. AppleScript (referred to as "AS") starts XCode (referred to as "XC")
  2. AS instructs XC to load the previously set up PhoneGap project.
  3. AS instructs XC to launch the PhonePap project.
  4. The PhoneGap project will redirect to the server serving the test suite, and the test suite runs.

In iOS 4.0 SDK, this only works the first round, the next time the test suite runner tries to make XC do the above routine, it fails requesting the previous run to be stopped. And I can't for the life of me find a way to stop the debugging session with AS [1], so I can only run one test suite without manual intervention, witch is pretty much a show stopper for us since we rely a lot on nightly test runs.

Now, what I really want to do is just start the iPhone Emulator, and then start Safari on the emulator with the possibility of sending an arbitrary URL to the emulated Safari.

What I've found so far is iphonesim, but I'm running into this issue and can't get it to properly start pre-compiled apps. A way to circumvent this issue in iphonesim would also be a good way forward.

[1] I'd accept a way to do this as a valid answer too.

+1  A: 

I have a very different solution for you.

Write a custom iPhone app that just contains a web view. It will behave pretty much the same as MobileSafari. Then, embed a little web server in the app.

You can then control your app by calling specific urls on that server.

This is a very simple app. Will take you 30 minutes to put together.

This is easily integrated in Xcode or a bigger (Apple) script. You can use commands like curl to open URLs.

St3fan
Interesting. A conceptually similar approach to the XCode + PhoneGap method, but I was under the impression that you're not allowed to open listen sockets in iOS? I'll do some trials and see.
Jacob Oscarson
Ops, seems my impression was very wrong indeed: http://github.com/face/MongooseDaemon
Jacob Oscarson
The simulator is simply an OS X app. You can do whatever you want. Including calling out to OS X specific stuff. Or using OS X services.
St3fan