appium/appium — pull request #1841 by linguinee (2014-02-01 03:47:10+00:00)
Title: Added iOS --full-reset capability (wipes out 'iPhone Simulator' folder)

...It doesn't seem to actually delete the folder, though. I wanted to submit a pull request to have someone look at it - I've never done any node.js programming, so it may be something obvious. First, I thought it was a race condition where the 'iPhone Simulator' folder isn't actually being deleted before the Simulator launches, but after adding the code to delete the folder in postCleanup I saw that the folder isn't deleted when called there, either. So now I'm a bit stumped.

The folder is deleted in `IOS.prototype.removeAppState`. Calling `rimraf()` asynchronously doesn't give an error (not sure how to check for error when using `rimraf.sync()`). Executing `ls ~/Library/Application Support` before and after deleting the folder still lists 'iPhone Simulator' as present, though the `ls` afterwards may have been executed after the Simulator was launched (I was uncertain how to do this synchronously in order to debug). Calling `rimraf()` on a random folder in my Documents dir worked fine.

```
drwxr-xr-x 3 lkung staff 102 Jan 31 19:33 iPhone Simulator
drwxr-xr-x 2 lkung staff 68 Jan 31 19:44 foo
```

Come to think of it, `foo` is empty while `iPhone Simulator` is not. However, I was under the impression that `rimraf()` is `rm -rf`?

Adding this `--full-reset` iOS capability resolves [#1799](https://github.com/appium/appium/issues/1799). The app I'm testing saves state that only wiping out the 'iPhone Simulator' folder can erase, so this change also allows me to run my tests on the grid (since there's no way to wipe out the folder before a test runs on a node since I don't know the IP address of the node until a session is created).

Currently passes all lint, unit, and functional iOS tests.