2016-04-20

I've been bashing my head against this all day.
I cannot for the life of me get Appium to reset in between test cases.

Mac OSX 10.10.5
Xcode 7.3 & 7.2
iOS Simulator 9.3 & 8.1
iPhone 6 iOS 9.1
Appium 1.5.1 (source code & npm install -g appium with the shrinkwrap fix)

Here is how I obtain the driver, and it is reset between test methods "@AfterMethod"

A simple test case

The second test case fails, since it is still logged into the application.

SERVER LOGS:
[debug] [iOSSim] Simulator files not fully created. Waiting a bit
[iOS] Error: Simulator files not fully created. Waiting a bit
at SimulatorXcode73.callee$2$0$ (lib/simulator-xcode-6.js:316:15)
at tryCatch (/Users/williamrussell/projects/appium/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke as _invoke
at GeneratorFunctionPrototype.prototype.(anonymous function) as next
at GeneratorFunctionPrototype.invoke (/Users/williamrussell/projects/appium/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at run (/Users/williamrussell/projects/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:104:47)
at /Users/williamrussell/projects/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/es6.promise.js:115:28
at flush (/Users/williamrussell/projects/appium/node_modules/babel-runtime/node_modules/core-js/library/modules/$.microtask.js:19:5)
at process._tickCallback (node.js:355:11)
[Error: Simulator files not fully created. Waiting a bit]

[iOS] Could not reset simulator. Leaving as is.

The logs for the device
[HTTP] --> POST /wd/hub/session/f99d5364-34af-4c4e-805a-f613e0f60101/appium/app/reset {}
[MJSONWP] Calling AppiumDriver.reset() with args: ["f99d5364-34af-4c4e-805a-f613e0f60101"]
[debug] [iOS] Executing iOS command 'reset'
[debug] [BaseDriver] Resetting app mid-session
[debug] [BaseDriver] Running generic full reset
[debug] [iOS] Deleting ios session
[debug] [UIAuto] Destroying instruments client socket.
[debug] [UIAuto] Closing socket server.
[debug] [UIAuto] Instruments socket server was closed
[debug] [Instruments] Starting shutdown.
[debug] [Instruments] Sending sigterm to instruments
[debug] [Instruments] [INST] 2016-04-20 03:31:51 +0000 Stopped: Script was stopped by the user
[debug] [Instruments] [INST STDERR] 2016-04-19 20:31:51.394 instruments[12609:277167] Attempting to change event horizon while disengage
[debug] [Instruments] [INST] Instruments Trace Complete (Duration : 84.190704s; Output : /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/appium-instruments/instrumentscli0.trace)
[debug] [Instruments] Instruments exited with code 0
[debug] [iOSLog] Stopping iOS log capture
[debug] [iOS] Running ios real device reset flow
[debug] [BaseDriver] Restarting app
[BaseDriver] The following capabilities were provided, but are not recognized by appium: webStorageEnabled, locationContextEnabled, platform, javascriptEnabled, databaseEnabled, takesScreenshot, networkConnectionEnabled, appium-version, desired.
[BaseDriver] Session created with session id: bbaae143-4287-4da7-ac21-b270674eaa5d
[debug] [iOS] Not auto-detecting udid.
[BaseDriver] Using local app '/Users/williamrussell/happy/happy-platform-qa/mobile-happy/src/main/resources/builds/happy_ios_preprod1.ipa'
[debug] [BaseDriver] Copying local zip to tmp dir
[debug] [BaseDriver] Unzipping /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/2016319-12598-1o0b618/appium-app.zip
[debug] [BaseDriver] Testing zip archive: /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/2016319-12598-1o0b618/appium-app.zip
[BaseDriver] Unzipped local app to '/var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/2016319-12598-1o0b618/Payload/happyx.app'
[debug] [iOS] Removing any remaining instruments sockets
[debug] [iOS] Cleaned up instruments socket /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/instruments_sock
[debug] [iOS] No language specified. Using default strings
[debug] [iOS] Strings file not found. Looking in 'en.lproj' directory
[iOS] Could not file localizable strings file 'Localizable.strings'!
[debug] [ios-app-utils] Getting bundle ID from app
[iOS] Extracted bundleID: com.happyguy.happyx from app: /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/2016319-12598-1o0b618/Payload/happyx.app
[debug] [iOS] Creating instruments
[debug] [UIAuto] Preparing bootstrap code
[debug] [UIAuto] Dynamic bootstrap dir: /Users/williamrussell/Library/Application Support/appium/bootstrap
[debug] [UIAuto] Dynamic env: {"nodePath":"/usr/local/Cellar/node012/0.12.13/bin/node","commandProxyClientPath":"/usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js","instrumentsSock":"/var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":false,"autoDismissAlerts":false,"sendKeyStrategy":"grouped"}
...bug] [UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
[debug] [UIAuto] Dynamic bootstrap path: /Users/williamrussell/Library/Application Support/appium/bootstrap/bootstrap-ba10a5de2043f93e.js
[debug] [UIAuto] Reusing dynamic bootstrap: /Users/williamrussell/Library/Application Support/appium/bootstrap/bootstrap-ba10a5de2043f93e.js
[debug] [iOS] Running ios real device reset flow
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: '/usr/local/bin/idevicesyslog'
[debug] [iOS] Creating iDevice object with udid 33459842000ca3791d530a7b641c5f490b60282a
[debug] [iOS] App is installed.
[debug] [iOS] fullReset not requested. No need to install.
[debug] [iOS] Starting UIAutoClient, and launching Instruments.
[debug] [UIAuto] Instruments socket server started at /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/instruments_sock
[debug] [Instruments] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
[debug] [Instruments] Attempting to launch instruments, this is try #1
[Instruments] Launching instruments
[debug] [Instruments] Attempting to run app on real device with UDID '33459842000ca3791d530a7b641c5f490b60282a'
[debug] [Instruments] Found Insruments-Without-Delay: /usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-instruments/thirdparty/iwd7
[debug] [Instruments] Spawning instruments with command: '/Applications/Xcode.app/Contents/Developer/usr/bin/instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate -D /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/appium-instruments/instrumentscli0.trace -w 33459842000ca3791d530a7b641c5f490b60282a com.happyguy.happyx -e UIASCRIPT "/Users/williamrussell/Library/Application Support/appium/bootstrap/bootstrap-ba10a5de2043f93e.js" -e UIARESULTSPATH /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/appium-instruments'
[debug] [Instruments] And extra without-delay env: {}
[debug] [Instruments] And launch timeouts (in ms): {"global":90000}
[debug] [Instruments] [INST STDERR] 2016-04-19 20:31:56.114 instruments[12663:277525] WebKit Threading Violation - initial use of WebKit from a secondary thread.
[UIAuto] Instruments is ready to receive commands
[debug] [iOS] Instruments launched. Starting poll loop for new commands.
[debug] [iOS] Setting bootstrap config keys/values
[debug] [UIAuto] Socket data received (2 bytes)
[debug] [UIAuto] Got a result when we were not expecting one! Ignoring it
[debug] [UIAuto] Sending command to instruments: target = $.target();
au = $;
$.isVerbose = true;

[debug] [Instruments] [INST] 2016-04-20 03:32:00 +0000 Debug: evaluation finished
[debug] [Instruments] [INST] 2016-04-20 03:32:00 +0000 Debug: responding with:
[debug] [Instruments] [INST] 2016-04-20 03:32:00 +0000 Debug: Running system command #1: /usr/local/Cellar/node012/0.12.13/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js /var/folders/s1/2747gn8d15b3jntg2y47rtnh0000gn/T/instruments_sock 2,{"status":0,"value":true}...
[debug] [UIAuto] Socket data received (27 bytes)
[debug] [UIAuto] Got result from instruments: {"status":0,"value":true}
[debug] [iOS] Setting initial orientation to PORTRAIT
[debug] [UIAuto] Sending command to instruments: au.setScreenOrientation('PORTRAIT')
[debug] [Instruments] [INST] 2016-04-20 03:32:01 +0000 Debug: Got new command 1 from instruments: au.setScreenOrientation('PORTRAIT')
[debug] [Instruments] [INST] 2016-04-20 03:32:01 +0000 Debug: evaluating au.setScreenOrientation('PORTRAIT')
[debug] [Instruments] [INST] 2016-04-20 03:32:01 +0000 Debug: target.setDeviceOrientation("1")

Reason:
We need this to work in DeviceFarm. DeviceFarm does not allow for "fullRest".

Any advice?

Show more