Since updating to Xcode 8 and Appium 1.6, I have been unable to start running iOS Appium tests. I have not changed anything (in regards to path, capabilities, ios version etc) other than adding the capability automationName: XCUITest
. Here is my environment:
require 'rspec/expectations'
require 'appium_lib'
############
# SETTINGS #
############
# Relative path to iPhone .app
APP_PATH_IPHONE = '../../../../../Users/sohaiba/Desktop/{app_name}.app' #this was Release-iphonesimulator
# Relative path to Android .apk
APP_PATH_ANDROID = '../../../../../Users/sohaiba/Desktop/{app_name}.apk'
# Android device name
ANDROID_NAME = 'Nexus 7' # Moto G # Samsung Galaxy Note 4
# Android device uuid
ANDROID_UUID = '015d24bcc13c2415' #
# iPhone Simulator Device
IPHONE_DEVICE = 'iPhone 6'
# Version of iOS simulator to use
IPHONE_VERSION = '9.3'
PORT = '4723'
# automation module
IOS_AUTOMATOR = 'XCUITest'
ANDROID_AUTOMATOR = 'uiautomator2'
#######################
# DO NOT MODIFY BELOW #
#######################
def android_emu
if ENV['BUILD_ANDROID_EMU'] != nil then
ENV['BUILD_ANDROID_EMU']
else
ANDROID_EMULATOR
end
end
def android_platform_capabilities
{
'app' => absolute_app_path,
'platformName' => 'Android',
'deviceName' => ANDROID_NAME,
#'udid' => ANDROID_UUID,
#'appWaitActivity' => '.ui.LaunchActivity',
'newCommandTimeout' => 300,
#'autoWebview' => true,
'fullReset' => true,
'noReset' => false,
'automationName' => ANDROID_AUTOMATOR,
}
end
def iphone_platform_capabilities
{
'app' => absolute_app_path,
'platformName' => 'iOS',
'deviceName' => IPHONE_DEVICE,
'platformVersion' => IPHONE_VERSION,
'autoAcceptAlerts' => true,
'launchTimeout' => 360000,
'fullReset' => false,
'noReset' => true,
'automationName' => IOS_AUTOMATOR,
}
end
def is_iphone
return ENV['UITEST_PLATFORM'] == 'iOS' || ENV['UITEST_PLATFORM'] == nil
end
def is_android
return ENV['UITEST_PLATFORM'] == 'Android'
end
def selenium
capabilities = {}
if is_iphone
capabilities = iphone_platform_capabilities
elsif is_android
capabilities = android_platform_capabilities
end
$driver = Appium::Driver.new({caps: capabilities, appium_lib:{ server_url: "http://127.0.0.1:#{PORT}/wd/hub" }})
$driver.start_driver
end
def absolute_app_path
if ENV['UITEST_CUSTOM_IOSPATH'] != nil
ENV['UITEST_CUSTOM_IOSPATH']
elsif ENV['UITEST_CUSTOM_ANDROIDPATH'] != nil
ENV['UITEST_CUSTOM_ANDROIDPATH']
elsif is_iphone
APP_PATH_IPHONE
elsif is_android
APP_PATH_ANDROID
end
end
# selenium
After {
$driver.driver_quit
if(is_iphone) then
# Remove app data.
uninstall_app=`xcrun simctl uninstall booted {app_bundle_id}`
reinstall_app=`xcrun simctl install booted ~/Desktop/{app_name}.app`
end
}
And here are the console logs
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: Pasteboard change listener callback port <NSMachPort: 0x7f9313c172f0> registered
Oct 21 16:16:02 apa-tomr syslogd[25339]: ASL Sender Statistics
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: Pasteboard change listener callback port <NSMachPort: 0x7f9313c132d0> registered
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: Pasteboard change listener callback port <NSMachPort: 0x7f9313e09040> registered
A new Appium session is about to start!
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: Pasteboard change listener callback port <NSMachPort: 0x7f9313f0ba90> registered
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: Pasteboard change listener callback port <NSMachPort: 0x7f9313d1b500> registered
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: Requesting installation of file:///Users/sohaiba/Users/sohaiba/Desktop/{app_name}.app/ with options: {
CFBundleIdentifier = “{app_bundle_ID}”;
PackageType = Developer;
SimulatorRootPath = “/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot”;
SimulatorUserPath = “/Users/sohaiba/Library/Developer/CoreSimulator/Devices/2306D6FA-975E-4D94-B23A-B9172ED55CCA/data”;
}
Oct 21 16:16:02 apa-tomr installd[25347]: 0x7000002a0000 -[MIClientConnection _doBackgroundInstallationForPath:withOptions:completion:]: Install of “/Users/sohaiba/Users/sohaiba/Desktop/{app_name}.app” type Developer (LSInstallType = (null)) requested by CoreSimulatorBridge (pid 25362)
Oct 21 16:16:02 apa-tomr installd[25347]: 0x7000002a0000 -[MIInstaller _setupPackageStateWithError:]: 182: Can’t stat /Users/sohaiba/Users/sohaiba/Desktop/{app_name}.app: No such file or directory (Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory”)
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: 0x700000094000 __MobileInstallationInstallForLaunchServices_block_invoke222: Returned error Error Domain=MIInstallerErrorDomain Code=3 “Can’t stat /Users/sohaiba/Users/sohaiba/Desktop/{app_name}.app: No such file or directory” UserInfo={PathArgument=file:///Users/sohaiba/Users/sohaiba/Desktop/{app_name}.app, NSLocalizedDescription=Can’t stat /Users/sohaiba/Users/sohaiba/Desktop/{app_name}.app: No such file or directory, FunctionName=-[MIInstaller _setupPackageStateWithError:], SourceFileLine=182, NSUnderlyingError=0x7f9313c073d0 {Error Domain=NSPOSIXErrorDomain Code=2 “No such file or directory”}}
Oct 21 16:16:02 apa-tomr SpringBoard[25354]: [appinstallation] LaunchServices observer: Apps Failed be installed: (
“<LSApplicationProxy: 0x7f96ac466ce0> {app_bundle_ID} <(null) Not found in database>”
)
Oct 21 16:16:02 apa-tomr profiled[25395]: [appinstallation] LaunchServices observer: Apps Failed be installed: (
“<LSApplicationProxy: 0x7f8a4168f220> {app_bundle_ID} <(null) Not found in database>”
)
Oct 21 16:16:02 apa-tomr itunesstored[25405]: [appinstallation] LaunchServices observer: Apps Failed be installed: (
“<LSApplicationProxy: 0x7fa8bae44790> {app_bundle_id} <(null) Not found in database>”
)
Oct 21 16:16:02 apa-tomr nsurlsessiond[25381]: [appinstallation] LaunchServices observer: Apps Failed be installed: (
“<LSApplicationProxy: 0x7f99ca5135c0> {app_bundle_id} <(null) Not found in database>”
)
Oct 21 16:16:02 apa-tomr passd[25512]: [appinstallation] LaunchServices observer: Apps Failed be installed: (
“<LSApplicationProxy: 0x7f9b4a63f8b0> {app_bundle_id} <(null) Not found in database>”
)
Oct 21 16:16:02 apa-tomr CoreSimulatorBridge[25362]: Pasteboard change listener callback port <NSMachPort: 0x7f9313e086f0> registered
Oct 21 16:16:02 apa-tomr containermanagerd[25377]: 0x700000117000 systemGroupContainerPath: com.apple.containermanagerd.internal is not entitled for system group identifier: systemgroup.com.apple.lsd
Oct 21 16:16:02 apa-tomr containermanagerd[25377]: 0x70000021d000 systemGroupContainerPath: com.apple.containermanagerd.internal is not entitled for system group identifier: systemgroup.com.apple.lsd
Oct 21 16:16:02 apa-tomr installd[25347]: 0x7000002a0000 -[MIClientConnection uninstallIdentifiers:withOptions:completion:]: Uninstall requested by CoreSimulatorBridge (pid 25362) for identifier {app_bundle_ID} with options: {
SimulatorRootPath = “/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot”;
SimulatorUserPath = “/Users/sohaiba/Library/Developer/CoreSimulator/Devices/2306D6FA-975E-4D94-B23A-B9172ED55CCA/data”;
}
Oct 21 16:16:02 apa-tomr installd[25347]: 0x7000002a0000 -[MIUninstaller _uninstallBundleWithIdentifier:error:]: Uninstalling identifier {app_bundle_id}
Oct 21 16:16:02 apa-tomr installd[25347]: 0x7000002a0000 -[MIUninstallNotifier performRemovalWithCompletionBlock:]: Destroying container with identifier {app_bundle_id} at /Users/sohaiba/Library/Developer/CoreSimulator/Devices/2306D6FA-975E-4D94-B23A-B9172ED55CCA/data/Containers/Bundle/Application/97BA73D8-C19F-409B-8EA3-BDBB328BBBEC
Oct 21 16:16:02 apa-tomr installd[25347]: 0x7000002a0000 -[MIUninstallNotifier performRemovalWithCompletionBlock:]: Destroying container with identifier {app_bundle_id} at /Users/sohaiba/Library/Developer/CoreSimulator/Devices/2306D6FA-975E-4D94-B23A-B9172ED55CCA/data/Containers/Data/Application/1E2E5E58-B1FE-4CD0-B19F-5A9385C1E9AE
Oct 21 16:16:03 apa-tomr pkd[25385]: releasing plug-in hold 5C052E04-DC19-4C59-88DD-58506C889DE8 at client’s request
Oct 21 16:16:03 apa-tomr containermanagerd[25377]: 0x70000021d000 systemGroupContainerPath: com.apple.containermanagerd.internal is not entitled for system group identifier: systemgroup.com.apple.lsd
Oct 21 16:16:03 apa-tomr containermanagerd[25377]: 0x700000117000 systemGroupContainerPath: com.apple.containermanagerd.internal is not entitled for system group identifier: systemgroup.com.apple.lsd
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: Installed apps did change.
Added: {(
)}
Removed: {(
“{app_bundle_id}”
)}
Modified: {(
)}
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: Reloading and rendering all application icons.
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.MobileSMS
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: throwing out icon because it isn’t visible in the model : node=<SBApplicationIcon: 0x7f96ac25f9d0; nodeID: “com.apple.camera”> com.apple.camera
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.weather
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobiletimer
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.videos
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobilenotes
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.stocks
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.MobileStore
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.AppStore
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.iBooks
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.facetime
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.calculator
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.podcasts
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.Bridge
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.compass
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.tips
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.VoiceMemos
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobileme.fmf1
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobileme.fmip1
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobilephone
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobilemail
Oct 21 16:16:03 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.Music
Oct 21 16:16:03 apa-tomr CoreSimulatorBridge[25362]: Pasteboard change listener callback port <NSMachPort: 0x7f9313f0b620> registered
Oct 21 16:16:03 apa-tomr CoreSimulatorBridge[25362]: Requesting installation of file:///Users/sohaiba/Desktop/{app_name}.app/ with options: {
CFBundleIdentifier = “{app_bundle_id}”;
PackageType = Developer;
SimulatorRootPath = “/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 9.3.simruntime/Contents/Resources/RuntimeRoot”;
SimulatorUserPath = “/Users/sohaiba/Library/Developer/CoreSimulator/Devices/2306D6FA-975E-4D94-B23A-B9172ED55CCA/data”;
}
Oct 21 16:16:03 apa-tomr installd[25347]: 0x700000094000 -[MIClientConnection _doBackgroundInstallationForPath:withOptions:completion:]: Install of “/Users/sohaiba/Desktop/{app_name}.app” type Developer (LSInstallType = (null)) requested by CoreSimulatorBridge (pid 25362)
Oct 21 16:16:03 apa-tomr installd[25347]: 0x700000094000 -[MIInstaller _extractPackageWithError:]: Did not construct delta; doing full copy for installation.
Oct 21 16:16:12 apa-tomr installd[25347]: 0x700000094000 -[MIInstaller performInstallationWithError:]: Installing
Oct 21 16:16:12 apa-tomr installd[25347]: 0x700000094000 -[MIContainer makeContainerLiveReplacingContainer:reason:withError:]: Made container live for {app_bundle_id} at /Users/sohaiba/Library/Developer/CoreSimulator/Devices/2306D6FA-975E-4D94-B23A-B9172ED55CCA/data/Containers/Data/Application/D7016917-C8F4-4057-BF25-65A3E0BCD3BA
Oct 21 16:16:12 apa-tomr installd[25347]: 0x700000094000 -[MIContainer makeContainerLiveReplacingContainer:reason:withError:]: Made container live for {app_bundle_id} at /Users/sohaiba/Library/Developer/CoreSimulator/Devices/2306D6FA-975E-4D94-B23A-B9172ED55CCA/data/Containers/Bundle/Application/D8B78410-7407-4296-B554-0A089C31A311
Oct 21 16:16:12 apa-tomr installd[25347]: 0x700000094000 -[MIInstaller performInstallationWithError:]: Install Successful; Staging: 9.07s; Waiting: 0.00s; Preflight/Patch: 0.00s, Verifying: 0.02s; Overall: 9.31s
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: Installed apps did change.
Added: {(
“{app_bundle_id}”
)}
Removed: {(
)}
Modified: {(
)}
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.MobileSMS
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: throwing out icon because it isn’t visible in the model : node=<SBApplicationIcon: 0x7f96ac25f9d0; nodeID: “com.apple.camera”> com.apple.camera
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.weather
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobiletimer
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.videos
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobilenotes
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.stocks
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.MobileStore
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.AppStore
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.iBooks
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.facetime
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.calculator
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.podcasts
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.Bridge
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.compass
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.tips
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.VoiceMemos
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobileme.fmf1
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobileme.fmip1
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobilephone
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.mobilemail
Oct 21 16:16:12 apa-tomr SpringBoard[25354]: could not find icon for representation → com.apple.Music
Oct 21 16:16:13 apa-tomr containermanagerd[25377]: 0x700000094000 systemGroupContainerPath: com.apple.containermanagerd.internal is not entitled for system group identifier: systemgroup.com.apple.lsd
Oct 21 16:16:13 apa-tomr containermanagerd[25377]: 0x70000021d000 systemGroupContainerPath: com.apple.containermanagerd.internal is not entitled for system group identifier: systemgroup.com.apple.lsd
Oct 21 16:16:52 apa-tomr routined[25342]: CoreLocation: Error occurred while trying to retrieve motion state update: CMErrorDomain Code:104
This error began to show up after updating to xcode 8 and using appium 1.6 instead of appium 1.5.3 (on which tests worked perfectly fine). The problem is that the the simulator runs, an error is thrown up without having installed the app. After the test throws the failure and finishes, however, the app is installed to the simulator. On Android, the app installs to the device and begins (although there are some other non-relevant issues). Please advise on how to fix this, if you require any further details let me know and I will do my best to provide them.