Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add launchApp via devicectl #2354

Merged
merged 24 commits into from
Mar 26, 2024
Merged

chore: add launchApp via devicectl #2354

merged 24 commits into from
Mar 26, 2024

Conversation

KazuCocoa
Copy link
Member

@KazuCocoa KazuCocoa commented Mar 25, 2024

#2356 is necessary to fix the build error.

The expected usage is appium/WebDriverAgent#870 . This Pr itself can be merged independently. After the WDA pr merge, we should update the dependency's major version but it can be after this pr.


ok:

[XCUITest] The process of the bundle id 'com.trident.WebDriverAgentRunner.xctrunner' was not running
[XCUITestDriver@e87b (466e3b15)] Launching WebDriverAgent on the device without xcodebuild
[XCUITestDriver@e87b (466e3b15)] Executing xcrun devicectl device process launch --device 00008020-000E5CDA0A23002E com.trident.WebDriverAgentRunner.xctrunner --terminate-existing --environment-variables '{"USE_PORT":"8100","WDA_PRODUCT_BUNDLE_IDENTIFIER":"com.trident.WebDriverAgentRunner.xctrunner"}' --quiet --json-output -
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[iProxy@00008020:8100] Connection was refused to port 8100
[WD Proxy] socket hang up
[XCUITestDriver@e87b (466e3b15)] WDA is not listening at 'http://127.0.0.1:8100/'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[iProxy@00008020:8100] Connection was refused to port 8100
[WD Proxy] socket hang up
[XCUITestDriver@e87b (466e3b15)] WDA is not listening at 'http://127.0.0.1:8100/'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[iProxy@00008020:8100] Connection was refused to port 8100
[WD Proxy] socket hang up
[XCUITestDriver@e87b (466e3b15)] WDA is not listening at 'http://127.0.0.1:8100/'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[iProxy@00008020:8100] Connection was refused to port 8100
[WD Proxy] socket hang up
[XCUITestDriver@e87b (466e3b15)] WDA is not listening at 'http://127.0.0.1:8100/'
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] Got response with status 200: {"value":{"build":{"time":"Mar 21 2024 18:39:01","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iPadOS","sdkVersion":"17.0","version":"17.4"},"device":"ipad","ios":{"ip":"192.168.5.6"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":null}
[WD Proxy] Matched '/status' to command name 'getStatus'
[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8100/status] with no body
[WD Proxy] Got response with status 200: {"value":{"build":{"time":"Mar 21 2024 18:39:01","productBundleIdentifier":"com.facebook.WebDriverAgentRunner"},"os":{"testmanagerdVersion":65535,"name":"iPadOS","sdkVersion":"17.0","version":"17.4"},"device":"ipad","ios":{"ip":"192.168.5.6"},"message":"WebDriverAgent is ready to accept commands","state":"success","ready":true},"sessionId":null}
[XCUITestDriver@e87b (466e3b15)] Event 'wdaSessionAttempted' logged at 1711329645200 (18:20:45 GMT-0700 (Pacific Daylight Time))
[XCUITestDriver@e87b (466e3b15)] Sending createSession command to WDA
[XCUITestDriver@e87b (466e3b15)] Matched '/session' to command name 'createSession'
[XCUITestDriver@e87b (466e3b15)] Proxying [POST /session] to [POST http://127.0.0.1:8100/session] with body: {"capabilities":{"firstMatch":[{"bundleId":"com.kazucocoa.apple-samplecode.UICatalog","arguments":[],"environment":{},"eventloopIdleDelaySec":0,"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true,"shouldTerminateApp":true,"forceAppLaunch":true,"useNativeCachingStrategy":true,"forceSimulatorSoftwareKeyboardPresence":true}],"alwaysMatch":{}}}
[XCUITestDriver@e87b (466e3b15)] Got response with status 200: {"value":{"sessionId":"5AE2BA02-C896-4AB6-9827-1A0F35C5B277","capabilities":{"sdkVersion":"17.4","device":"ipad"}},"sessionId":"5AE2BA02-C896-4AB6-9827-1A0F35C5B277"}
[XCUITestDriver@e87b (466e3b15)] Determined the downstream protocol as 'W3C'
[XCUITestDriver@e87b (466e3b15)] WDA session startup took 1506ms
[XCUITestDriver@e87b (466e3b15)] Event 'wdaSessionStarted' logged at 1711329646708 (18:20:46 GMT-0700 (Pacific Daylight Time))
[XCUITestDriver@e87b (466e3b15)] Event 'wdaStarted' logged at 1711329646708 (18:20:46 GMT-0700 (Pacific Daylight Time))
[BaseDriver] The value of 'elementResponseAttributes' setting did not change. Skipping the update for it
[BaseDriver] The value of 'shouldUseCompactResponses' setting did not change. Skipping the update for it
[AppiumDriver@ecd5] New XCUITestDriver session created successfully, session 466e3b15-31a5-487d-8217-065a75c254cc added to master session list
[AppiumDriver@ecd5] Event 'newSessionStarted' logged at 1711329646714 (18:20:46 GMT-0700 (Pacific Daylight Time))
[XCUITestDriver@e87b (466e3b15)] Cached the protocol value 'W3C' for the new session 466e3b15-31a5-487d-8217-065a75c254cc
[XCUITestDriver@e87b (466e3b15)] Responding to client with driver.createSession() result: {"capabilities":{"webStorageEnabled":false,"locationContextEnabled":false,"browserName":"","platform":"MAC","javascriptEnabled":true,"databaseEnabled":false,"takesScreenshot":true,"networkConnectionEnabled":false,"platformName":"ios","automationName":"xcuitest","platformVersion":"17.2","udid":"00008020-000E5CDA0A23002E","usePreinstalledWDA":true,"updatedWDABundleId":"com.trident.WebDriverAgentRunner","bundleId":"com.kazucocoa.apple-samplecode.UICatalog","skipDeviceCheck":true,"skipLogCapture":true}}
[HTTP] <-- POST /session 200 6717 ms - 565

error example:

client

Selenium::WebDriver::Error::UnknownError: An unknown server-side error occurred while processing the command. Original error: Unable to launch WebDriverAgent. Original error: 'xcrun devicectl device process launch --device 00008020-000E5CDA0A23002E --terminate-existing --environment-variables '{"USE_PORT":"8100","WDA_PRODUCT_BUNDLE_IDENTIFIER":"com.trident.WebDriverAgentRunner.xctrunner"}' bad --quiet --json-output -' failed. Original error: ERROR: The operation couldn’t be completed. (OSStatus error -10814.) (NSOSStatusErrorDomain error -10814.)
         _LSLine = 1741
         _LSFunction = runEvaluator
. Make sure the application com.trident.WebDriverAgentRunner.xctrunner exists and it is launchable. https://appium.github.io/appium-xcuitest-driver/latest/preparation/real-device-config/ may help to complete the preparation.

appium server

[XCUITestDriver@2570 (f061fb05)] Trying to start WebDriverAgent once since at least one of webDriverAgentUrl,usePreinstalledWDA capabilities is provided
[XCUITestDriver@2570 (f061fb05)] Event 'wdaStartAttempted' logged at 1711327979431 (17:52:59 GMT-0700 (Pacific Daylight Time))
[XCUITest] The executable name for the bundle id 'com.trident.WebDriverAgentRunner.xctrunner' was 'WebDriverAgentRunner-Runner'
[XCUITest] Calling devicectl to kill the process
[XCUITestDriver@2570 (f061fb05)] Executing xcrun devicectl device info processes --device 00008020-000E5CDA0A23002E --quiet --json-output -
[XCUITest] The process of the bundle id 'com.trident.WebDriverAgentRunner.xctrunner' was not running
[XCUITestDriver@2570 (f061fb05)] Launching WebDriverAgent on the device without xcodebuild
[XCUITestDriver@2570 (f061fb05)] Executing xcrun devicectl device process launch --device 00008020-000E5CDA0A23002E --terminate-existing --environment-variables '{"USE_PORT":"8100","WDA_PRODUCT_BUNDLE_IDENTIFIER":"com.trident.WebDriverAgentRunner.xctrunner"}' bad --quiet --json-output -
[XCUITestDriver@2570 (f061fb05)] Event 'wdaStartFailed' logged at 1711327982547 (17:53:02 GMT-0700 (Pacific Daylight Time))
[XCUITestDriver@2570 (f061fb05)] Error: 'xcrun devicectl device process launch --device 00008020-000E5CDA0A23002E --terminate-existing --environment-variables '{"USE_PORT":"8100","WDA_PRODUCT_BUNDLE_IDENTIFIER":"com.trident.WebDriverAgentRunner.xctrunner"}' bad --quiet --json-output -' failed. Original error: ERROR: The operation couldn’t be completed. (OSStatus error -10814.) (NSOSStatusErrorDomain error -10814.)
[XCUITestDriver@2570 (f061fb05)]          _LSLine = 1741
[XCUITestDriver@2570 (f061fb05)]          _LSFunction = runEvaluator
[XCUITestDriver@2570 (f061fb05)]
[XCUITestDriver@2570 (f061fb05)]     at Devicectl.execute (/Users/kazu/GitHub/appium-xcuitest-driver/lib/devicectl.js:138:13)
[XCUITestDriver@2570 (f061fb05)]     at Devicectl.launchApp (/Users/kazu/GitHub/appium-xcuitest-driver/lib/devicectl.js:289:5)
[XCUITestDriver@2570 (f061fb05)]     at WebDriverAgent._launchViaDevicectl (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/webdriveragent.js:314:5)
[XCUITestDriver@2570 (f061fb05)]     at WebDriverAgent.launchWithPreinstalledWDA (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/webdriveragent.js:363:9)
[XCUITestDriver@2570 (f061fb05)]     at WebDriverAgent.launch (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/appium-webdriveragent/lib/webdriveragent.js:417:14)
[XCUITestDriver@2570 (f061fb05)]     at /Users/kazu/GitHub/appium-xcuitest-driver/lib/driver.js:822:34
[XCUITestDriver@2570 (f061fb05)]     at wrapped (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:93:13)
[XCUITestDriver@2570 (f061fb05)]     at retry (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:66:13)
[XCUITestDriver@2570 (f061fb05)]     at retryInterval (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:103:10)
[XCUITestDriver@2570 (f061fb05)]     at /Users/kazu/GitHub/appium-xcuitest-driver/lib/driver.js:812:7
[XCUITest] The executable name for the bundle id 'com.trident.WebDriverAgentRunner.xctrunner' was 'WebDriverAgentRunner-Runner'
[XCUITest] Calling devicectl to kill the process
[XCUITestDriver@2570 (f061fb05)] Executing xcrun devicectl device info processes --device 00008020-000E5CDA0A23002E --quiet --json-output -
[XCUITest] The process of the bundle id 'com.trident.WebDriverAgentRunner.xctrunner' was not running
[XCUITestDriver@2570 (f061fb05)] {}
[DevCon Factory] Releasing connections for 00008020-000E5CDA0A23002E device on any port number
[DevCon Factory] Found cached connections to release: ["00008020-000E5CDA0A23002E:8100"]
[DevCon Factory] Releasing the listener for '00008020-000E5CDA0A23002E:8100'
[iProxy@00008020:8100] Closing the connection
[DevCon Factory] Cached connections count: 0
[iProxy@00008020:8100] The connection has been closed
[AppiumDriver@e26d] Event 'newSessionStarted' logged at 1711327984387 (17:53:04 GMT-0700 (Pacific Daylight Time))
[AppiumDriver@e26d] Encountered internal error running command: Error: Unable to launch WebDriverAgent. Original error: 'xcrun devicectl device process launch --device 00008020-000E5CDA0A23002E --terminate-existing --environment-variables '{"USE_PORT":"8100","WDA_PRODUCT_BUNDLE_IDENTIFIER":"com.trident.WebDriverAgentRunner.xctrunner"}' bad --quiet --json-output -' failed. Original error: ERROR: The operation couldn’t be completed. (OSStatus error -10814.) (NSOSStatusErrorDomain error -10814.)
[AppiumDriver@e26d]          _LSLine = 1741
[AppiumDriver@e26d]          _LSFunction = runEvaluator
[AppiumDriver@e26d] . Make sure the application com.trident.WebDriverAgentRunner.xctrunner exists and it is launchable. https://appium.github.io/appium-xcuitest-driver/latest/preparation/real-device-config/ may help to complete the preparation.
[AppiumDriver@e26d]     at /Users/kazu/GitHub/appium-xcuitest-driver/lib/driver.js:837:19
[AppiumDriver@e26d]     at wrapped (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:93:13)
[AppiumDriver@e26d]     at retry (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:66:13)
[AppiumDriver@e26d]     at retryInterval (/Users/kazu/GitHub/appium-xcuitest-driver/node_modules/asyncbox/lib/asyncbox.js:103:10)
[AppiumDriver@e26d]     at /Users/kazu/GitHub/appium-xcuitest-driver/lib/driver.js:812:7
[HTTP] <-- POST /session 500 5324 ms - 2122

@KazuCocoa KazuCocoa marked this pull request as ready for review March 25, 2024 05:53
@KazuCocoa
Copy link
Member Author

Moved the build error in #2356

lib/devicectl.js Outdated Show resolved Hide resolved
lib/devicectl.js Outdated Show resolved Hide resolved
lib/devicectl.js Outdated Show resolved Hide resolved
lib/devicectl.js Outdated Show resolved Hide resolved
lib/devicectl.js Outdated Show resolved Hide resolved
@KazuCocoa KazuCocoa changed the title feat: add launchApp via devicectl chore: add launchApp via devicectl Mar 26, 2024
lib/devicectl.js Outdated Show resolved Hide resolved
lib/devicectl.js Outdated Show resolved Hide resolved
@KazuCocoa KazuCocoa merged commit 3907455 into master Mar 26, 2024
18 checks passed
@KazuCocoa KazuCocoa deleted the add-launch branch March 26, 2024 16:07
github-actions bot pushed a commit that referenced this pull request Mar 26, 2024
## [7.5.5](v7.5.4...v7.5.5) (2024-03-26)

### Miscellaneous Chores

* add launchApp via devicectl ([#2354](#2354)) ([3907455](3907455))
Copy link
Contributor

🎉 This PR is included in version 7.5.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants