-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: add webDriverAgentMacUrl #41
Conversation
1758dac
to
9640b44
Compare
} | ||
return { | ||
scheme, | ||
server: hostname ?? DEFAULT_SYSTEM_HOST, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say we should throw an exception if hostname cannot be parsed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same about protocol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do this later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this raising an exception in https://github.com/appium/appium-mac2-driver/pull/41/files#diff-cb3604d19b5cec159d0260eb8b8739d21bf074cf54584fd2b555e9969caaa92fR335-R341 (url.URL)
lib/wda-mac.js
Outdated
let wasProcessInitNecessary; | ||
if (this.isProxyingToRemoteServer) { | ||
if (this.process) { | ||
await this.process.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like below error happened only await cleanupObsoleteProcesses();
case.
[debug] [HTTP] Request idempotency key: 20ac39e4-5f3c-47ae-904a-cc197b645fed
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"platformName":"mac","automationName":"mac2","webDriverAgentMacUrl":"http://localhost:10100"},"capabilities":{"firstMatch":[{"platformName":"mac","appium:automationName":"mac2","appium:webDriverAgentMacUrl":"http://localhost:10100"}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"mac","automationName":"mac2","webDriverAgentMacUrl":"http://localhost:10100"},null,{"firstMatch":[{"platformName":"mac","appium:automationName":"mac2","appium:webDriverAgentMacUrl":"http://localhost:10100"}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1609921937694 (00:32:17 GMT-0800 (Pacific Standard Time))
[Appium] Appium v1.20.0-rc.1 creating new Mac2Driver (v0.8.1) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] "alwaysMatch": {
[debug] [BaseDriver] "platformName": "mac",
[debug] [BaseDriver] "appium:automationName": "mac2",
[debug] [BaseDriver] "appium:webDriverAgentMacUrl": "http://localhost:10100"
[debug] [BaseDriver] },
[debug] [BaseDriver] "firstMatch": [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Session created with session id: 7f3ec82f-86fe-47f6-8710-43746bd24077
[debug] [WebDriverAgentMac] Cleaning up 4 obsolete processes
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:10100/status] with no body
[WebDriverAgentMac] Mac2Driver host process has exited with code null, signal SIGKILL
[WD Proxy] connect ECONNREFUSED 127.0.0.1:10100
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1609921937749 (00:32:17 GMT-0800 (Pacific Standard Time))
[debug] [W3C] Encountered internal error running command: Error: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: connect ECONNREFUSED 127.0.0.1:10100
[debug] [W3C] at WDAMacServer.isProxyReady (/Users/kazuaki/GitHub/appium-mac2-driver/lib/wda-mac.js:301:15)
[debug] [W3C] at processTicksAndRejections (internal/process/task_queues.js:97:5)
[debug] [W3C] at waitMs (/Users/kazuaki/GitHub/appium-mac2-driver/lib/wda-mac.js:395:44)
[debug] [W3C] at spin (/Users/kazuaki/GitHub/appium-mac2-driver/node_modules/asyncbox/lib/asyncbox.js:113:20)
[debug] [W3C] at waitForCondition (/Users/kazuaki/GitHub/appium-mac2-driver/node_modules/asyncbox/lib/asyncbox.js:129:10)
[debug] [W3C] at WDAMacServer.startSession (/Users/kazuaki/GitHub/appium-mac2-driver/lib/wda-mac.js:395:9)
[debug] [W3C] at Mac2Driver.createSession (/Users/kazuaki/GitHub/appium-mac2-driver/lib/driver.js:84:7)
[debug] [W3C] at AppiumDriver.createSession (/Users/kazuaki/.nodebrew/node/v14.3.0/lib/node_modules/appium/lib/appium.js:371:35)
[HTTP] <-- POST /wd/hub/session 500 171 ms - 915
[HTTP]
But kills/stops processes by await this.process.stop();
like current implementation could wait like below log. So, for now, cleanupObsoleteProcesses
is to cleanup RUNNING_PROCESS_IDS.. (.stop
worked, then this method only clean RUNNING_PROCESS_IDS)
[debug] [HTTP] Request idempotency key: 07159145-27ac-4d3f-9724-a3ab455e0ca7
[HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"platformName":"mac","automationName":"mac2","webDriverAgentMacUrl":"http://localhost:10100"},"capabilities":{"firstMatch":[{"platformName":"mac","appium:automationName":"mac2","appium:webDriverAgentMacUrl":"http://localhost:10100"}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"platformName":"mac","automationName":"mac2","webDriverAgentMacUrl":"http://localhost:10100"},null,{"firstMatch":[{"platformName":"mac","appium:automationName":"mac2","appium:webDriverAgentMacUrl":"http://localhost:10100"}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1609922453348 (00:40:53 GMT-0800 (Pacific Standard Time))
[Appium] Appium v1.20.0-rc.1 creating new Mac2Driver (v0.8.1) session
[debug] [BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[debug] [BaseDriver] Creating session with W3C capabilities: {
[debug] [BaseDriver] "alwaysMatch": {
[debug] [BaseDriver] "platformName": "mac",
[debug] [BaseDriver] "appium:automationName": "mac2",
[debug] [BaseDriver] "appium:webDriverAgentMacUrl": "http://localhost:10100"
[debug] [BaseDriver] },
[debug] [BaseDriver] "firstMatch": [
[debug] [BaseDriver] {}
[debug] [BaseDriver] ]
[debug] [BaseDriver] }
[BaseDriver] Session created with session id: 5103782c-9eb7-49b7-b5d7-9d24cac34ed1
[WebDriverAgentMac] Mac2Driver host process has exited with code null, signal SIGTERM
[debug] [WebDriverAgentMac] Cleaning up 3 obsolete processes
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:10100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:10100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:10100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:10100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:10100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:10100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET http://localhost:10100/status] with no body
[WD Proxy] connect ECONNREFUSED 127.0.0.1:10100
[debug] [WD Proxy] Matched '/status' to command name 'getStatus'
[debug] [WD Proxy] Proxying [GET /status] to [GET
hm..
(I tweaked the order of killing process etc in cleanupObsoleteProcesses
, but no luck. So something other things affected?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I know what the issue might be. Please call this.process.kill()
first and then cleanupObsoleteProcesses
. The issue there is that the process gets killed from the outside
(by the kill -9 command line utility), so the original process object does not get notified about it is killed, which is ok when we close the server, but not ok when we about to start a new session
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Only #41 (comment) is left
}; | ||
} | ||
|
||
let parsed_url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parsedUrl
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops...
webDriverAgentMacUrl
works as same as iOS/webDriverAgentUrl.This allows us to launch an appium server on a machine and handle mac2 driver on another macOS machine.
(Mainly I want this capability to develop mac2 driver on my environment so far)