iOS - how to reset simulator or application state using appium app

1,250 views
Skip to first unread message

Nikolay Stanoev

unread,
Dec 16, 2013, 10:50:45 AM12/16/13
to appium-...@googlegroups.com
Hello,

I have an app which should be tested on iOS Simulator. The app is installed without any problems on the simulator using Appium. I have a script which creates an account in the app and log in it. Unfortunately, when I start the test one more time it fails. The reason for failure is that I am already logged in the app. That`s why I have to reset the simulator every time when the test is running or to reset the state of the app. I tried to use mobile: reset command but it does not work for me because when I start the app I am still logged in. 

So does anyone have an idea how to reset the simulator or the app state? ( I am using appium.dmg to start appium )

PS: I have created an apple script which can start the simulator, reset it and close it. You can see it below. Is there a way to integrate this script with appium and to be execute it every time when the simulator is launched?

do shell script "touch /private/var/db/.AccessibilityAPIEnabled" password "pwd" with administrator privileges

tell application "iPhone Simulator"
    activate
end tell

tell application "System Events"
    tell process "iPhone Simulator"
        tell menu bar 1
            tell menu bar item "iOs Simulator"
                tell menu "iOs Simulator"
                    click menu item "Reset Content and Settings…"
                end tell
            end tell
        end tell
        tell window 1
            click button "Reset"
        end tell
    end tell
end tell

tell application "iPhone Simulator" to quit

Any feedback will be useful. Thank you in advance!
 

Nikolay Stanoev

unread,
Dec 17, 2013, 4:26:51 PM12/17/13
to appium-...@googlegroups.com
Hello,

Has anyone faced this problem ?

bootstrap online

unread,
Dec 17, 2013, 4:34:01 PM12/17/13
to Nikolay Stanoev, appium-...@googlegroups.com
That's a bug in mobile reset for iOS. I opened an issue:
https://github.com/appium/appium/issues/1639
> --
> http://appium.io
> ---
> You received this message because you are subscribed to the Google Groups
> "Appium-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to appium-discus...@googlegroups.com.
> Visit this group at http://groups.google.com/group/appium-discuss.
> For more options, visit https://groups.google.com/groups/opt_out.

Nikolay Stanoev

unread,
Dec 17, 2013, 4:47:06 PM12/17/13
to appium-...@googlegroups.com, Nikolay Stanoev
Hi bootstrap,

Do you know whether this fix will be part of the next Appium version?

Thank you in advance!

bootstrap online

unread,
Dec 17, 2013, 5:14:19 PM12/17/13
to Nikolay Stanoev, appium-...@googlegroups.com
It's up to the other committers to decide if this is a reasonable
approach for appium. I use the Ruby code locally. If the concept is
approved, I'll submit a pull request to appium and it'll be in the
next version.

On Tue, Dec 17, 2013 at 4:47 PM, Nikolay Stanoev

Jonathan Lipps

unread,
Dec 17, 2013, 5:22:54 PM12/17/13
to bootstrap online, Nikolay Stanoev, appium-...@googlegroups.com
we could easily make it optional

bootstrap online

unread,
Dec 17, 2013, 5:23:57 PM12/17/13
to Jonathan Lipps, Nikolay Stanoev, appium-...@googlegroups.com
I think mobile reset is already opt in. If you don't call it then
nothing happens.

bootstrap online

unread,
Dec 17, 2013, 6:07:22 PM12/17/13
to Jonathan Lipps, Nikolay Stanoev, appium-...@googlegroups.com
https://github.com/appium/appium/pull/1643

On Tue, Dec 17, 2013 at 5:23 PM, bootstrap online

bootstrap online

unread,
Dec 17, 2013, 6:40:50 PM12/17/13
to Jonathan Lipps, Nikolay Stanoev, appium-...@googlegroups.com
This is fixed on master and will be in the next appium release.

On Tue, Dec 17, 2013 at 6:07 PM, bootstrap online

Nikolay Stanoev

unread,
Dec 18, 2013, 2:16:43 AM12/18/13
to appium-...@googlegroups.com, Jonathan Lipps, Nikolay Stanoev
Hello guys,

Thank you for your help. I am quite happy that this change will be part of the next release. I hope that it will be part of the Appium app too :).
Once the next Appium version is released I will try it and will give you a feedback whether the issues is resolved or not.

Nikolay Stanoev

unread,
Jan 4, 2014, 9:34:57 AM1/4/14
to appium-...@googlegroups.com, Jonathan Lipps, Nikolay Stanoev
Hello,

I have checked latest version of the Appium app and it seems that the fix does not resolve the problem. When i start the app after mobile: reset the user is still logged in. I have played a bit with the simulator and it seems that when i use mobile: reset and delete Keychains folder which is located in "/Users/#{user}/Library/Application Support/iPhone Simulator/6.1/Library" then the application will be in its initial state and the user will not be logged.

I have added a comment in the issue - https://github.com/appium/appium/issues/1639.

Could you share your opinion whether it is a good idea to remove Keychains folder when mobile: reset is used?


18 декември 2013, сряда, 01:40:50 UTC+2, bootstrap online написа:

Jonathan Lipps

unread,
Jan 4, 2014, 12:44:36 PM1/4/14
to Nikolay Stanoev, appium-...@googlegroups.com
I don't see how it could hurt, I say we add it to the list of things to clean up

Nikolay Stanoev

unread,
Jan 4, 2014, 2:14:03 PM1/4/14
to appium-...@googlegroups.com, Nikolay Stanoev
Hi Jonathan,

That sounds good for me. Could it be part of the next appium version?
Reply all
Reply to author
Forward
0 new messages