-
-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Allow to configure host/port/app path for Appium for mac app in appium-mac-driver #42
Changes from 1 commit
87f661e
5699614
2ed278e
d1b1f33
ebad077
965485c
5632c56
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,13 +15,14 @@ class AppiumForMac { | |
constructor (opts = {}) { | ||
this.proxyHost = opts.a4mHost || DEFAULT_A4M_HOST; | ||
this.proxyPort = opts.a4mPort || DEFAULT_A4M_PORT; | ||
this.a4mAppPath = opts.a4mAppPath || REQ_A4M_APP_PATH; | ||
this.proc = null; | ||
this.jwproxy = new JWProxy({server: this.proxyHost, port: this.proxyPort}); | ||
} | ||
|
||
async start () { | ||
if (!await fs.exists(REQ_A4M_APP_PATH)) { | ||
throw new Error('Could not verify AppiumForMacDriver install; please install to your /Applications folder'); | ||
if (!await fs.exists(this.a4mAppPath)) { | ||
throw new Error(`Could not verify AppiumForMacDriver install in ${this.a4mAppPath}; please install it to ${this.a4mAppPath}`); | ||
} | ||
|
||
const startDetector = (stdout, stderr) => { | ||
|
@@ -33,7 +34,7 @@ class AppiumForMac { | |
await this.killAll(); | ||
|
||
// set up our subprocess object | ||
const a4mBinary = path.resolve(REQ_A4M_APP_PATH, 'Contents', 'MacOS', 'AppiumForMac'); | ||
const a4mBinary = path.resolve(this.a4mAppPath, 'Contents', 'MacOS', 'AppiumForMac'); | ||
this.proc = new SubProcess(a4mBinary, []); | ||
processIsAlive = true; | ||
|
||
|
@@ -55,7 +56,7 @@ class AppiumForMac { | |
`signal ${signal}`; | ||
log.error(msg); | ||
}); | ||
log.info(`Spawning AppiumForMac with: ${this.appium4macdriver}`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyone did not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why where we spawning? And is there a way we can close the app after test, i mean another capability to kill /close the app on OS/machine? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handled the process by https://github.com/appium/node-teen_process/blob/56a139cbf86b819398d7736a442b6c4a985bc716/lib/subprocess.js#L23 The process will stop in delete the session in general. |
||
log.info(`Spawning AppiumForMac with: ${this.a4mAppPath}`); | ||
|
||
// start subproc and wait for startDetector | ||
await this.proc.start(startDetector); | ||
|
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.
it is a good practice to put variable values in quotes, so people could easily extract them if they contain spaces
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 below