appium / appium

Cross-platform automation framework for all kinds of apps, built on top of the W3C WebDriver protocol
http://appium.io/
Apache License 2.0
18.74k stars 6.06k forks source link

Appium v1.5.2+ keepKeyChains caps doesn't work #6780

Closed CyHuH closed 6 years ago

CyHuH commented 8 years ago

The problem

After appium start ios simulator, all my pre-installed certificates from this simulator deleted and I can't connect to my test server from the app. In v1.4 all working good.

Environment

mykola-mokhnach commented 8 years ago

It would be nice to see the code where driver capabilities are set and the log

CyHuH commented 8 years ago

capabilities:

CAPABILITIES = {'app': app,
                'platformName': 'iOS',
                'platformVersion': '9.3',
                'deviceName': 'iPhone 5',
                'autoAcceptAlerts': 'true',
                'locale': 'ru_RU',
                'language': 'en',
                'launchTimeout': 1900000,
                'nativeInstrumentsLib': 'true',
                'keepKeyChains': 'true'}

part of code from environment.py (using python behave):

def before_all(context):
    context.driver = webdriver.Remote(
        command_executor=APPIUM_SERVER,
        desired_capabilities=CAPABILITIES)

some appium v1.4 server logs:

info: [debug] Final device string is: 'iPhone 5 (9.3)'
info: [debug] We're on iOS7.1+ so forcing defaultDevice on
info: [debug] Getting device string from opts: {"forceIphone":false,"forceIpad":false,"xcodeVersion":"7.3.1","iOSSDKVersion":"9.3","deviceName":"iPhone 5","platformVersion":"9.3"}
info: [debug] fixDevice is on
info: [debug] Final device string is: 'iPhone 5 (9.3)'
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Wrote new app Info.plist with device type
info: [debug] Checking whether we need to set app preferences
info: [debug] Running ios sim reset flow
info: [debug] Killing the simulator process
info: [debug] Killing any other simulator daemons
info: [debug] Killall Simulator
info: [debug] Cleaning sim data files
info: [debug] Resetting simulator and saving Keychains
info: node-simctl: Executing: xcrun with args: simctl erase 2EB978EF-4397-48DE-9578-92BB5A575954 and timeout: 2000
info: node-simctl: Executing: xcrun with args: simctl erase 2EB978EF-4397-48DE-9578-92BB5A575954 and timeout: 2000

appium v1.5.2 server logs:

[Appium] Welcome to Appium v1.5.2 (REV 2b9a2833bc3c6bc8e7b7344e8178ce98e29ebe4b)
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
[HTTP] --> POST /wd/hub/session {"desiredCapabilities":{"app":"/Users/asocial/Work/mobile-avia-client-ios/DerivedData/YaAvia/Build/Products/Debug-iphonesimulator/YaAvia.app","keepKeyChains":"true","deviceName":"iPhone 5","platformVersion":"9.3","platformName":"iOS","autoAcceptAlerts":"true","language":"en","launchTimeout":1900000,"locale":"ru_RU","nativeInstrumentsLib":"true"},"requiredCapabilities":{}}
[MJSONWP] Calling AppiumDriver.createSession() with args: [{"app":"/Users/asocial/Work/mobile-avia-client-ios/DerivedData/YaAvia/Build/Products/Debug-iphonesimulator/YaAvia.app","keepKeyChains":"true","dev...
[Appium] Creating new IosDriver session
[Appium] Capabilities:
[Appium]   app: '/Users/asocial/Work/mobile-avia-client-ios/DerivedData/YaAvia/Build/Products/Debug-iphonesimulator/YaAvia.app'
[Appium]   keepKeyChains: 'true'
[Appium]   deviceName: 'iPhone 5'
[Appium]   platformVersion: '9.3'
[Appium]   platformName: 'iOS'
[Appium]   autoAcceptAlerts: 'true'
[Appium]   language: 'en'
[Appium]   launchTimeout: 1900000
[Appium]   locale: 'ru_RU'
[Appium]   nativeInstrumentsLib: 'true'
[BaseDriver] Capability 'autoAcceptAlerts' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'nativeInstrumentsLib' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'keepKeyChains' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Session created with session id: da93c91e-b0ff-46e1-93ef-f7837cd40ac8
[debug] [iOS] Not auto-detecting udid.
[BaseDriver] Using local app '/Users/asocial/Work/mobile-avia-client-ios/DerivedData/YaAvia/Build/Products/Debug-iphonesimulator/YaAvia.app'
[debug] [iOS] Removing any remaining instruments sockets
[debug] [iOS] Cleaned up instruments socket /var/folders/kh/xbb7df3x71jb5g1vl7hk0nrc_3ndcx/T/instruments_sock
[debug] [iOS] Setting Xcode version
[debug] [iOS] Xcode version set to 7.3.1
[debug] [iOS] Setting iOS SDK Version
[debug] [iOS] iOS SDK Version set to 9.3
[debug] [iOS] Checking whether instruments supports our device string
[debug] [Instruments] Getting list of devices instruments supports
[debug] [Instruments] Instruments is at: /Applications/Xcode.app/Contents/Developer/usr/bin/instruments
[debug] [Instruments] Available devices: Apple TV 1080p (9.2) [0D07863C-43F3-49B8-A651-B8B7CAD56123] (Simulator),Apple Watch - 38mm (2.2) [8441DC77-7052-4B22-BBB0-A4E3C0B9797E] (Simulator),iPhone 5 (9.3) [2EB978EF-4397-48DE-9578-92BB5A575954] (Simulator),iPhone 6 Plus (9.3) [6DAB7E2A-5AE1-41CF-8F6D-B04682B02219] (Simulator),iPhone 6s (9.3) [DB49CE4D-D094-4B20-A6EE-E921CF909AA1] (Simulator),iPhone 6s (9.3) + Apple Watch - 42mm (2.2) [8CF0F24C-414C-4DF5-B5F9-BD2E26CD6EBF] (Simulator)
[iOSSim] Retrieving device name string for Xcode version 7.3.1
[debug] [iOSSim] Getting device string from options: {"deviceName":"iPhone 5","platformVersion":"9.3","forceIphone":false,"forceIpad":false}
[debug] [iOSSim] Final device string is 'iPhone 5 (9.3)'
[debug] [iOS] iOS sim UDID is 2EB978EF-4397-48DE-9578-92BB5A575954
[iOSSim] Constructing iOS simulator for Xcode version 7.3.1
[debug] [iOS] Parsed app 'Localizable.strings'
[debug] [ios-app-utils] Getting bundle ID from app
[iOS] Extracted bundleID: ru.yandex.mobile.avia.test from app: /Users/asocial/Work/mobile-avia-client-ios/DerivedData/YaAvia/Build/Products/Debug-iphonesimulator/YaAvia.app
[debug] [iOS] Creating instruments
[debug] [UIAuto] Preparing bootstrap code
[debug] [UIAuto] Dynamic bootstrap dir: /Users/asocial/Library/Application Support/appium/bootstrap
[debug] [UIAuto] Dynamic env: {"nodePath":"/usr/local/Cellar/node/6.3.0/bin/node","commandProxyClientPath":"/usr/local/avm/versions/1.5.2/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js","instrumentsSock":"/var/folders/kh/xbb7df3x71jb5g1vl7hk0nrc_3ndcx/T/instruments_sock","interKeyDelay":null,"justLoopInfinitely":false,"autoAcceptAlerts":true,"autoDismissAlerts":false,"sendKeyStrategy":"oneByOne"}
[debug] [UIAuto] Dynamic bootstrap code: // This file is automatically generated. Do not manually m...fy!
[debug] [UIAuto] Dynamic bootstrap path: /Users/asocial/Library/Application Support/appium/bootstrap/bootstrap-40f0d68dcf42293d.js
[debug] [UIAuto] Reusing dynamic bootstrap: /Users/asocial/Library/Application Support/appium/bootstrap/bootstrap-40f0d68dcf42293d.js
[debug] [iOS] User specified default device, letting instruments launch it
[debug] [iOS] Running ios sim reset flow
[debug] [iOS] Killing the simulator
[debug] [iOSSim] Killing all iOS Simulators
[debug] [iOS] Cleaning sim state.
[debug] [iOSSim] Cleaning app data files for 'YaAvia.app', 'ru.yandex.mobile.avia.test'
[iOSSim] Attempted to get an app path from a fresh simulator quickly launching the sim to populate its directories
[debug] [iOSSim] Attempting to launch and quit the simulator, to create directory structure
[debug] [iOSSim] Will launch with Safari? false
[iOSSim] Starting simulator with command: open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID 2EB978EF-4397-48DE-9578-92BB5A575954
[iOSSim] Tailing simulator logs until we encounter the string "System app "com.apple.springboard" finished startup"
[iOSSim] We will time out after 60000ms
[debug] [iOSSim] Waiting and extra 2000ms for the simulator to really finish booting
[debug] [iOSSim] Done waiting extra time for simulator
[iOSSim] Simulator booted in 26143ms
[debug] [iOSSim] Killing all iOS Simulators
[debug] [iOSSim] Building bundle path map
[debug] [iOSSim] Building bundle path map
[debug] [iOSSim] Could not find app directories to delete. It is probably not installed
[debug] [iOSSim] Killing any simulator daemons for 2EB978EF-4397-48DE-9578-92BB5A575954
[iOSSim] Cleaning simulator 2EB978EF-4397-48DE-9578-92BB5A575954
[debug] [iOS] No simulator directories found.
[debug] [iOSSim] Attempting to launch and quit the simulator, to create directory structure
[debug] [iOSSim] Will launch with Safari? false
[debug] [iOS] Setting locale information
[iOSSim] Starting simulator with command: open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID 2EB978EF-4397-48DE-9578-92BB5A575954
[debug] [iOSSim] New language: en
[debug] [iOSSim] New locale: ru_RU
[debug] [iOSSim] Writing new locale plist data
[debug] [iOS] Locale was updated. Stopping simulator.
[debug] [iOS] Killing the simulator
[debug] [iOSSim] Killing all iOS Simulators
[debug] [iOS] No iOS / app preferences to set
[debug] [iOSLog] Starting iOS 9.3 simulator log capture
[debug] [iOSLog] System log path: /Users/asocial/Library/Logs/CoreSimulator/2EB978EF-4397-48DE-9578-92BB5A575954/system.log
[debug] [iOS] Not pre-launching simulator
[debug] [iOS] Starting UIAutoClient, and launching Instruments.
[debug] [UIAuto] Instruments socket server started at /var/folders/kh/xbb7df3x71jb5g1vl7hk0nrc_3ndcx/T/instruments_sock
[iOSSim] Tailing simulator logs until we encounter the string "System app "com.apple.springboard" finished startup"
[iOSSim] We will time out after 60000ms
[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 iPhone 5 (9.3)
[Instruments] On xcode 7.0+, instruments-without-delay does not work, skipping instruments-without-delay
[debug] [Instruments] Found Insruments-Without-Delay: /usr/local/avm/versions/1.5.2/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/kh/xbb7df3x71jb5g1vl7hk0nrc_3ndcx/T/appium-instruments/instrumentscli0.trace -w "iPhone 5 (9.3)" /Users/asocial/Work/mobile-avia-client-ios/DerivedData/YaAvia/Build/Products/Debug-iphonesimulator/YaAvia.app -e UIASCRIPT "/Users/asocial/Library/Application Support/appium/bootstrap/bootstrap-40f0d68dcf42293d.js" -e UIARESULTSPATH /var/folders/kh/xbb7df3x71jb5g1vl7hk0nrc_3ndcx/T/appium-instruments'
[debug] [Instruments] And launch timeouts (in ms): {"global":1900000}

For this messages I changed 'true' to True and nothing changed:

[BaseDriver] Capability 'autoAcceptAlerts' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'nativeInstrumentsLib' changed from string to boolean. This may cause unexpected behavior
[BaseDriver] Capability 'keepKeyChains' changed from string to boolean. This may cause unexpected behavior
mykola-mokhnach commented 8 years ago

I suppose this feature has not been implemented after update to 1.5 There is still TODO in the Simulator reset code. And the corresponding config variable does not seem to be used anywhere. Sad, but true :-(

SrinivasanTarget commented 8 years ago

@triager please label: Bug

sambarapu commented 7 years ago

Hi Team, I am using appium latest version , would like to check if there is any other alternative for 'keepKeyChains': 'true' in new version of appium ?. Thanks

mykola-mokhnach commented 6 years ago

This now works in the recent beta of xcuitest driver

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.