Automate set team developer for WebDriverAgent [Appium 1.6, iOS10]

Hi !

I have used:
macOS Sierra 10.12
iPhone (real device) with iOS 10.1
Xcode 8.1
Appium 1.6.0-beta3

I have build the WebDriverAgent with this command from shell:

xcodebuild -project “path del xcodeproj del WebDriverAgent” -target WebDriverAgentRunner -configuration Debug -sdk iphoneos clean build CODE_SIGN_IDENTITY=XXX-XXXXX-XXXXXXX

After, i have installed in my iPhone with this command:

ideviceinstaller -i …WebDriverAgent-Runner.app

Successful build and installation. The tests are performed correctly.

First question: For each test, appium reinstall the agent ?

Second question: Is it possible automate set team developer for WebDriverAgent without open the XCode?

Third question: Why if try to perform test from another computer get this error? (The WebDriverAgent is already installed correctly in my iPhone)

2016-12-07 18:03:41:523 - info: [Xcode]
Testing failed:
Signing for “WebDriverAgentRunner” requires a development team. Select a development team in the project editor.
Code signing is required for product type ‘UI Testing Bundle’ in SDK ‘iOS 10.1’
** TEST FAILED **

Thanks for your help

First Question: Unsure with real device but in simulator, upon test completion the simulator is cleaned and WDA is uninstalled so it must be reinstalled when initiating a new test.

Second Question:
Including this should solve that:

capabilities.SetCapability(“xcodeConfigFile”, "/path/to/file.xcconfig); // This config file manages the code signing for WebDriverAgent

The .xcconfig file should contain the following:

DEVELOPMENT_TEAM = [TeamID]
CODE_SIGN_IDENTITY = iPhone Developer

Your team ID can be found here after logging in.

Third Question: Solution for question 2 should solve this as well because it will use the config file to get the signing identity.

Hi. Thank you for helping me. I have tried to create file configuration (.xcconfig) but i have not solved my problem.
I have tried to create the script:

awk -F ‘=’ ‘/DevelopmentTeam/ {print $2; exit}’ /Users/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/project.pbxproj
sed -i ‘’ ‘s/none/xxxxxxxxxx/g’ /Users/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj/project.pbxproj

Also this solution not solved my problem

@antoios You need not create a script to set the team developer for WebDriver Agent, all you need to do is pass “xcodeConfigFile” as one of the capability

@pavanbachu Ok, but unfortunately don’t set team developer for WebDriver Agent.

This is capability:

capabilities.setCapability(“xcodeConfigFile”, “/Users/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/configuredevelopment.xcconfig”);

Testing failed:

[Xcode] Signing for “IntegrationApp” requires a development team. Select a development team in the project editor.
Code signing is required for product type ‘Application’ in SDK ‘iOS 10.1’
** TEST FAILED **

The following build commands failed:
Check dependencies
(1 failure)

Can you share the complete logs as gist file ?

[Appium] Creating new XCUITestDriver session
[Appium] Capabilities:
[Appium] realDeviceLogger: ‘/usr/local/lib/node_modules/deviceconsole/deviceconsole’
[Appium] automationName: ‘XCUITest’
[Appium] bundleId: ‘com.google.ios.youtube’
[Appium] xcodeConfigFile: ‘/Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig’
[Appium] udid: ‘2xxxxxxxxxxxxx8’
[Appium] platformName: ‘iOS’
[Appium] deviceName: ‘iPhone di Media’
[Appium] platform: ‘iOS’
[BaseDriver] The following capabilities were provided, but are not recognized by appium: realDeviceLogger, xcodeConfigFile, platform.
[BaseDriver] Session created with session id: 71f86cd3-1c69-4ff3-8604-9e357f102a0d
[debug] [XCUITest] Xcode version set to ‘8.1’
[debug] [XCUITest] iOS SDK Version set to ‘10.1’
[debug] [XCUITest] Available devices: 2xxxxxxxxxxxxxxxxxxxxxx8
[debug] [XCUITest] Creating iDevice object with udid 2xxxxxxxxxxxxxxxxxxxx8
[XCUITest] Determining device to run tests on: udid: ‘2xxxxxxxxxxxxxxx8’, real device: true
[debug] [iOSLog] Attempting iOS device log capture via libimobiledevice idevicesyslog
[debug] [iOSLog] Found idevicesyslog: ‘/usr/local/bin/idevicesyslog’
[XCUITest] Setting up real device
[debug] [XCUITest] Stdout from app isInstalled check: […] Waiting for iOS device to be connected
[…] Using iPhone 5s (Global/CDMA) ‘iPhone di Media’ (2xxxxxxxxxxxxxxxxxxx8).
true

[debug] [XCUITest] App is installed.
[debug] [XCUITest] fullReset not requested. No need to install.
[XCUITest] Using default agent: /Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj
[XCUITest] Using default bootstrap: /Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: /usr/local/bin/carthage
[debug] [XCUITest] Beginning test with command ‘xcodebuild -project /Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=2xxxxxxxxxxxxxxxx8 build test’ in directory ‘/Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-dnlenklnzvsrljbhfotctvqbrfvn/Logs/Test/44ABEE20-ADFF-4BC8-8D1C-F950AF219C24/Session-WebDriverAgentRunner-2016-12-15_180026-MoNDoL.log
[Xcode] 2016-12-15 18:00:26.888 xcodebuild[10830:216636] Error Domain=IDETestOperationsObserverErrorDomain Code=3 “Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-dnlenklnzvsrljbhfotctvqbrfvn/Logs/Test/44ABEE20-ADFF-4BC8-8D1C-F950AF219C24/Session-WebDriverAgentRunner-2016-12-15_180026-MoNDoL.log” UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-dnlenklnzvsrljbhfotctvqbrfvn/Logs/Test/44ABEE20-ADFF-4BC8-8D1C-F950AF219C24/Session-WebDriverAgentRunner-2016-12-15_180026-MoNDoL.log}

[Xcode]
Testing failed:
IntegrationApp requires a provisioning profile. Select a provisioning profile for the “Debug” build configuration in the project editor.
Code signing is required for product type ‘Application’ in SDK ‘iOS 10.1’
** TEST FAILED **

The following build commands failed:
Check dependencies
(1 failure)

[XCUITest] xcodebuild exited with code ‘65’ and signal ‘null’
[debug] [XCUITest] xcodebuild failure warrants retry. Retrying…
[XCUITest] Shutting down WebDriverAgent
[XCUITest] System log exited with code ‘null’
[XCUITest] Launching WebDriverAgent on the device
[debug] [XCUITest] Carthage found: /usr/local/bin/carthage
[debug] [XCUITest] Beginning test with command ‘xcodebuild -project /Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=2xxxxxxxxxx8 build test’ in directory ‘/Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent’
[XCUITest] Waiting for WebDriverAgent to start on device
[debug] [XCUITest] Log file for xcodebuild test: /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-dnlenklnzvsrljbhfotctvqbrfvn/Logs/Test/4A08EDC3-D965-4427-AE90-F67E4516B4B4/Session-WebDriverAgentRunner-2016-12-15_180028-WIrQ2P.log
[Xcode] 2016-12-15 18:00:28.480 xcodebuild[10845:216743] Error Domain=IDETestOperationsObserverErrorDomain Code=3 “Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-dnlenklnzvsrljbhfotctvqbrfvn/Logs/Test/4A08EDC3-D965-4427-AE90-F67E4516B4B4/Session-WebDriverAgentRunner-2016-12-15_180028-WIrQ2P.log” UserInfo={NSLocalizedDescription=Test operation was canceled. If you believe this error represents a bug, please attach the log file at /Users/Library/Developer/Xcode/DerivedData/WebDriverAgent-dnlenklnzvsrljbhfotctvqbrfvn/Logs/Test/4A08EDC3-D965-4427-AE90-F67E4516B4B4/Session-WebDriverAgentRunner-2016-12-15_180028-WIrQ2P.log}

[Xcode] 2016-12-15 18:00:28.482 xcodebuild[10845:216744] Connection peer refused channel request for “dtxproxy:XCTestManager_IDEInterface:XCTestManager_DaemonConnectionInterface”; channel canceled <DTXChannel: 0x7fca83e51800>

Testing failed:
IntegrationApp requires a provisioning profile. Select a provisioning profile for the “Debug” build configuration in the project editor.
Code signing is required for product type ‘Application’ in SDK ‘iOS 10.1’
** TEST FAILED **

The following build commands failed:
Check dependencies
(1 failure)

[XCUITest] xcodebuild exited with code ‘65’ and signal ‘null’
[XCUITest] Error: xcodebuild failed with code 65
at SubProcess. (lib/webdriveragent.js:244:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess. (lib/teen_process.js:191:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
Error: xcodebuild failed with code 65
at SubProcess. (lib/webdriveragent.js:244:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess. (lib/teen_process.js:191:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
[XCUITest] Shutting down WebDriverAgent
[XCUITest] System log exited with code ‘null’
[debug] [XCUITest] Resetting simulator
[debug] [iOSLog] Stopping iOS log capture
[MJSONWP] Encountered internal error running command: Error: xcodebuild failed with code 65
at SubProcess. (lib/webdriveragent.js:244:25)
at emitTwo (events.js:106:13)
at SubProcess.emit (events.js:191:7)
at ChildProcess. (lib/teen_process.js:191:14)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
[HTTP] ← POST /wd/hub/session 500 9539 ms - 167

My Capabilities is:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.PLATFORM, “iOS”);
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, “XCUITest”);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, “iPhone di Media”);
capabilities.setCapability(MobileCapabilityType.UDID, “2xxxxxxxxxx8”);
capabilities.setCapability(“bundleId”, “com.google.ios.youtube”);
capabilities.setCapability(“realDeviceLogger”, “/usr/local/lib/node_modules/deviceconsole/deviceconsole”);
capabilities.setCapability(“xcodeConfigFile”, “/Users/workspace/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig”);

    AppiumDriver driver = null;
    try {
        driver = new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    } catch (MalformedURLException e) {
        e.printStackTrace();
    }
    driver.quit();

Thank you for help !!! :slight_smile:

What is the iOS version of device ?

macOS Sierra 10.12
iPhone 5s with iOS 10.1
Xcode 8.1
Appium 1.6.3

Can you please share the output of idevicepair pair and idevicepair validate

MacMini:appium user$ idevicepair pair
SUCCESS: Paired with device 2c3a1dd6ee17d2203a28
MacMini:appium user$ idevicepair validate
SUCCESS: Validated pairing with device 2c3a1dd6ee17d2203a28

Adding Capability of xcodeConfigFile[quote=“antoios, post:3, topic:13676”]
ed to create file configuration (.xcconfig) but i have not solved my problem.
[/quote]

Can you share your XCConfig file…

DEVELOPMENT_TEAM = S8xxxxxxx3F
CODE_SIGN_IDENTITY = iPhone Developer