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.86k stars 6.08k forks source link

[Feat]: Get rid of `xcode-select` dependency in appium-xcuitest-driver `uesPreinstalledWDA` usage #18641

Closed eyJhb closed 1 year ago

eyJhb commented 1 year ago

I am not entirely sure, if this is a bug, butt trying to utilize the merged PR in https://github.com/appium/appium-xcuitest-driver/pull/1609 fails, as it still requires xcode-select -p to work, which I don't think it should?

Can somebody either confirm/deny this.

I would expect it to work on any computer now, not just Mac OS X.

This is my package.json.

{
  "dependencies": {
    "appium": "^2.0.0-beta.66",
    "appium-uiautomator2-driver": "^2.24.0",
    "appium-xcuitest-driver": "^4.28.0"
  }
}

EDIT: here are the caps I am using

{
  "appium:automationName": "XCUITest",
  "platformName": "iOS",
  "appium:udid": "00008020-xxxxxxxxxxxxx",
  "appium:usePreinstalledWDA": true,
  "appium:updatedWDABundleId": "com.facebook.WebDriverAgentRunner.xctrunner",
  "appium:platformVersion": "16.4.1"
}

Have tried with/without the platform version and with/without the updatedWDABundleId

KazuCocoa commented 1 year ago

What environment did you use? For now, xcuitest driver requires macOS environment, so if it happens only non-macOS host, it is expected. https://appium.github.io/appium-xcuitest-driver/4.28/setup/#requirements I haven't tested with bad xcode-select -p environment, but i guess some commands still check the xcode dependency to run some commands correctly. (e.g. xcrun etc. potentially they can be removed from the dependency for real devices, but not sure if we can for all commands. This is not bug right now as required environment, but potentially could.) Had you tried webDriverAgentUrl, btw?

eyJhb commented 1 year ago

I am running Linux, so it might be expected.

However, I assumed with the new release, that it would be possible to run on non-macOS hosts, as it seems it shouldn't require any Xcode things anymore.

My understanding was, that once https://github.com/appium/appium-ios-device/pull/110 was merged, then xcode would not be required to start the WDA anymore, and it could be done on Linux.

This would remove go-ios as a dependency for me, and non-macOS hosts would be able to run the WDA, if it was preinstalled on the iPhone.

It seems I am misunderstanding what is possible here?

KazuCocoa commented 1 year ago

The module did at the module level, but it does not mean xcuitest driver entirely also does. For instance, you can use the appium-ios-device directly from your JS code to start a WDA process outside Appium session.

If webDriverAgentUrl worked without xcode-select (I haven't tested), it is probably easy to find possible places the xcuitest driver can drop the xcode-select. We should investigate the place actually can be removed in the uesPreinstalledWDA then though.

mykola-mokhnach commented 1 year ago

@eyJhb Please provide the full server log where you expect xcode-select to not be called

eyJhb commented 1 year ago
eyjhb@jhbws01 ~/c/u/a/serverv2 ",
error: Error when renaming history file: Invalid cross-device link
2023-05-25 10:34:06:825 - [Appium] Welcome to Appium v2.0.0-beta.66 ",
2023-05-25 10:34:06:826 - [Appium] Non-default server args:
2023-05-25 10:34:06:827 - [Appium] {
2023-05-25 10:34:06:827 - [Appium]   address: 'localhost',
2023-05-25 10:34:06:827 - [Appium]   logTimestamp: true
2023-05-25 10:34:06:827 - [Appium] }
2023-05-25 10:34:06:827 - [Appium] Attempting to load driver uiautomator2...
2023-05-25 10:34:06:827 - [debug] [Appium] Requiring driver at /state/home/code/appium/serverv2/node_modules/appium-uiautomator2-driver
reusing global emitter
2023-05-25 10:34:07:077 - [Appium] Attempting to load driver xcuitest...
2023-05-25 10:34:07:077 - [debug] [Appium] Requiring driver at /state/home/code/appium/serverv2/node_modules/appium-xcuitest-driver
2023-05-25 10:34:07:335 - [Appium] Appium REST http interface listener started on localhost:4723
2023-05-25 10:34:07:335 - [Appium] Available drivers:
2023-05-25 10:34:07:335 - [Appium]   - uiautomator2@2.24.0 ",
2023-05-25 10:34:07:335 - [Appium]   - xcuitest@4.28.0 ",
2023-05-25 10:34:07:336 - [Appium] Available plugins:
2023-05-25 10:34:07:336 - [Appium]   - go-ios@0.0.1
2023-05-25 10:34:07:336 - [Appium] No plugins activated. Use the --use-plugins flag with names of plugins to activate
2023-05-25 10:34:10:524 - [HTTP] --> POST /session
2023-05-25 10:34:10:524 - [HTTP] {"capabilities":{"alwaysMatch":{"appium:automationName":"XCUITest","platformName":"iOS","appium:udid":"00008020-001655400E82002E","appium:usePrebuiltWDA":true,"appium:usePreinstalledWDA":true,"appium:updatedWDABundleId":"com.facebook.WebDriverAgentRunner.xctrunner","appium:platformVersion":"16.4.1","appium:includeSafariInWebviews":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true},"firstMatch":[{}]},"desiredCapabilities":{"appium:automationName":"XCUITest","platformName":"iOS","appium:udid":"00008020-001655400E82002E","appium:usePrebuiltWDA":true,"appium:usePreinstalledWDA":true,"appium:updatedWDABundleId":"com.facebook.WebDriverAgentRunner.xctrunner","appium:platformVersion":"16.4.1","appium:includeSafariInWebviews":true,"appium:newCommandTimeout":3600,"appium:connectHardwareKeyboard":true}}
2023-05-25 10:34:10:525 - [debug] [AppiumDriver@ffc5] Calling AppiumDriver.createSession",
2023-05-25 10:34:10:525 - [debug] [AppiumDriver@ffc5] Event 'newSessionRequested' logged at 1685010850525 ",
2023-05-25 10:34:10:527 - [Appium] Attempting to find matching driver for automationName 'XCUITest' and platformName 'iOS'
2023-05-25 10:34:10:527 - [Appium] The 'xcuitest' driver was installed and matched caps.
2023-05-25 10:34:10:527 - [Appium] Will require it at /state/home/code/appium/serverv2/node_modules/appium-xcuitest-driver
2023-05-25 10:34:10:527 - [debug] [Appium] Requiring driver at /state/home/code/appium/serverv2/node_modules/appium-xcuitest-driver
2023-05-25 10:34:10:527 - [AppiumDriver@ffc5] Appium v2.0.0-beta.66 creating new XCUITestDriver ",
2023-05-25 10:34:10:527 - [AppiumDriver@ffc5] Checking BaseDriver versions for Appium and XCUITestDriver
2023-05-25 10:34:10:527 - [AppiumDriver@ffc5] Appium's BaseDriver version is 9.3.7
2023-05-25 10:34:10:527 - [AppiumDriver@ffc5] XCUITestDriver's BaseDriver version is 9.3.6
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e] Creating session with W3C capabilities: {
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]   "alwaysMatch": {
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "platformName": "iOS",
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:automationName": "XCUITest",
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:udid": "00008020-001655400E82002E",
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:usePrebuiltWDA": true,
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:usePreinstalledWDA": true,
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:updatedWDABundleId": "com.facebook.WebDriverAgentRunner.xctrunner",
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:platformVersion": "16.4.1",
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:includeSafariInWebviews": true,
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:newCommandTimeout": 3600,
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     "appium:connectHardwareKeyboard": true
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]   },
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]   "firstMatch": [
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]     {}
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e]   ]
2023-05-25 10:34:10:529 - [debug] [XCUITestDriver@652e] }
2023-05-25 10:34:10:533 - [XCUITestDriver@652e] The desired capabilities include neither an app nor a bundleId. WebDriverAgent will be started without the default app
2023-05-25 10:34:10:533 - [XCUITestDriver@652e ",
2023-05-25 10:34:10:541 - [debug] [XCUITest] Current user: 'eyjhb'
2023-05-25 10:34:10:547 - [debug] [XCUITestDriver@652e ",
2023-05-25 10:34:10:547 - [debug] [XCUITest] Creating iDevice object with udid '00008020-001655400E82002E'
2023-05-25 10:34:10:547 - [XCUITestDriver@652e ",
2023-05-25 10:34:10:547 - [XCUITestDriver@652e ",
2023-05-25 10:34:10:555 - [Xcode] Cannot determine the path to Xcode by running 'xcode-select -p' command. Original error: spawn xcode-select ENOENT
2023-05-25 10:34:10:569 - [debug] [XCUITest] Error: Cannot determine the path to Xcode by running 'xcode-select -p' command. Original error: spawn xcode-select ENOENT
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at getPathFromXcodeSelect ",
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at getVersionWithoutRetry ",
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at retry ",
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at Object.getVersion ",
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at getAndCheckXcodeVersion ",
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at XCUITestDriver.start ",
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at XCUITestDriver.createSession ",
2023-05-25 10:34:10:569 - [debug] [XCUITest]     at AppiumDriver.createSession ",
2023-05-25 10:34:10:569 - [XCUITest] Could not determine Xcode version: Cannot determine the path to Xcode by running 'xcode-select -p' command. Original error: spawn xcode-select ENOENT
2023-05-25 10:34:10:569 - [XCUITestDriver@652e ",
2023-05-25 10:34:10:570 - [DevCon Factory] Releasing connections for 00008020-001655400E82002E device on any port number
2023-05-25 10:34:10:570 - [DevCon Factory] No cached connections have been found
2023-05-25 10:34:10:574 - [debug] [AppiumDriver@ffc5] Event 'newSessionStarted' logged at 1685010850574 ",
2023-05-25 10:34:10:574 - [debug] [AppiumDriver@ffc5] Encountered internal error running command: Error: Could not determine Xcode version: Cannot determine the path to Xcode by running 'xcode-select -p' command. Original error: spawn xcode-select ENOENT
2023-05-25 10:34:10:574 - [debug] [AppiumDriver@ffc5]     at Object.wrappedLogger.errorAndThrow ",
2023-05-25 10:34:10:574 - [debug] [AppiumDriver@ffc5]     at getAndCheckXcodeVersion ",
2023-05-25 10:34:10:574 - [debug] [AppiumDriver@ffc5]     at XCUITestDriver.start ",
2023-05-25 10:34:10:574 - [debug] [AppiumDriver@ffc5]     at XCUITestDriver.createSession ",
2023-05-25 10:34:10:574 - [debug] [AppiumDriver@ffc5]     at AppiumDriver.createSession ",
2023-05-25 10:34:10:581 - [HTTP] <-- POST /session 500 56 ms - 822
2023-05-25 10:34:10:581 - [HTTP]