Skip to content

Commit

Permalink
create port forward when mjpegServerPort is provided in caps
Browse files Browse the repository at this point in the history
Co-authored-by: SrinivasanTarget <srinivasan.sekar1990@gmail.com>
  • Loading branch information
saikrishna321 and SrinivasanTarget committed Jan 20, 2025
1 parent 08418ed commit e5a4530
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,23 @@ export class XCUITestDriver extends BaseDriver {
// ensure WDA gets our defaults instead of whatever its own might be
await this.updateSettings(wdaSettings);

if(this.opts.mjpegServerPort) {

Check failure on line 470 in lib/driver.js

View workflow job for this annotation

GitHub Actions / test (20)

Expected space(s) after "if"

Check failure on line 470 in lib/driver.js

View workflow job for this annotation

GitHub Actions / test (22)

Expected space(s) after "if"
this.log.debug(
`MJPEG broadcasting requested, forwarding MJPEG server port ${this.opts.mjpegServerPort} ` +
`to local port ${this.opts.mjpegServerPort}`
);
try {
await DEVICE_CONNECTIONS_FACTORY.requestConnection(caps.udid, this.opts.mjpegServerPort, {
devicePort: this.opts.mjpegServerPort,
usePortForwarding: true,
});
} catch {
this.log.warn(
`Cannot forward the local port ${this.opts.mjpegServerPort} to ${this.opts.mjpegServerPort} ` +
`on the device ${caps.udid}.`,
);
}
}
// turn on mjpeg stream reading if requested
if (this.opts.mjpegScreenshotUrl) {
this.log.info(`Starting MJPEG stream reading URL: '${this.opts.mjpegScreenshotUrl}'`);
Expand Down

0 comments on commit e5a4530

Please sign in to comment.