-
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to run iOS tests in non-mac machines (#1256)
* initial support with go-ios * pick go_ios from path * catch tunnel start * ignore tunnel start error * move tunnel start to top level * fix tunnel start * add console.log to test in pi * add go-ios for tracing * update submodule * add ios test script * liveStreaming flag to true * add checks for go-ios * update submodule * update submodule for ios linux support --------- Co-authored-by: sudharsan selvaraj <[email protected]>
- Loading branch information
1 parent
235ae90
commit 26b5732
Showing
16 changed files
with
138 additions
and
22 deletions.
There are no files selected for viewing
Submodule dashboard-frontend
updated
from e67442 to 20218a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import _ from 'lodash'; | ||
import { EventEmitter } from 'stream'; | ||
import { SubProcess } from 'teen_process'; | ||
import { cachePath } from './helpers'; | ||
import log from './logger'; | ||
export default class GoIosTracker extends EventEmitter { | ||
private static instance: GoIosTracker; | ||
private deviceMap: Map<number, string> = new Map(); | ||
private process!: SubProcess; | ||
private started = true; | ||
|
||
constructor() { | ||
super(); | ||
this.start(); | ||
} | ||
|
||
public static getInstance(): GoIosTracker { | ||
if (!GoIosTracker.instance) { | ||
GoIosTracker.instance = new GoIosTracker(); | ||
} | ||
|
||
return GoIosTracker.instance; | ||
} | ||
|
||
start() { | ||
if (!_.isNil(this.process) && this.process.isRunning) { | ||
return; | ||
} | ||
let goIOSPath; | ||
if (process.env.GO_IOS) { | ||
log.info('Found GO_IOS in env'); | ||
goIOSPath = process.env.GO_IOS; | ||
} else { | ||
goIOSPath = `${cachePath('goIOS')}/ios`; | ||
} | ||
try { | ||
this.process = new SubProcess(goIOSPath, ['listen']); | ||
} catch (err: any) { | ||
log.info( | ||
`Failed to load go-ios ${goIOSPath}, iOS real device tracking not possible, please refer to link https://appium-device-farm-eight.vercel.app/troubleshooting/#ios-tracking for more details`, | ||
); | ||
} | ||
|
||
this.process.on('lines-stdout', (out) => { | ||
const parsedOutput = this.parseOutput(out); | ||
if (!_.isNil(parsedOutput)) { | ||
this.notify(parsedOutput); | ||
} | ||
}); | ||
|
||
this.process.on('exit', () => { | ||
this.started = false; | ||
this.emit('stop'); | ||
}); | ||
|
||
this.process.start(0); | ||
} | ||
|
||
async stop() { | ||
if (_.isNil(this.process) || !this.process.isRunning) { | ||
return; | ||
} | ||
this.process.stop('SIGINT'); | ||
this.started = false; | ||
} | ||
|
||
private parseOutput(output: any) { | ||
try { | ||
if (_.isArray(output)) { | ||
return output.map((o) => JSON.parse(o)); | ||
} | ||
} catch (err) { | ||
return null; | ||
} | ||
} | ||
|
||
private notify(messages: any[]) { | ||
messages.forEach((message) => { | ||
if (message.MessageType == 'Attached') { | ||
this.deviceMap.set(message.DeviceID, message.Properties.SerialNumber); | ||
this.emit('attached', message.Properties.SerialNumber); | ||
} else { | ||
const id = this.deviceMap.get(message.DeviceID); | ||
this.emit('detached', id); | ||
} | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule modules
updated
from a22e2c to 99c05b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters