Use provided idb path in iOSBridge idb execs

Summary:
We pass the `idbPath` to only the log listener function, when in reality it should be used by all of these functions that call out to idb.

This could result in some bizzare inconsistencies where some idb functions to fail as they are not using the supplied path

Reviewed By: passy

Differential Revision: D33818298

fbshipit-source-id: f0fb7f26579c646a0d5265364d539dfded711c2e
This commit is contained in:
Lawrence Lomax
2022-01-28 00:34:05 -08:00
committed by Facebook GitHub Bot
parent e2abe1c89a
commit 2573462cec
2 changed files with 11 additions and 6 deletions

View File

@@ -36,18 +36,19 @@ export interface IOSBridge {
class IDBBridge implements IOSBridge {
constructor(private idbPath: string) {}
async navigate(serial: string, location: string): Promise<void> {
exec(`idb open --udid ${serial} "${location}"`);
this._execIdb(`open --udid ${serial} "${location}"`);
}
recordVideo(serial: string, outputFile: string): child_process.ChildProcess {
console.log(`Starting screen record via idb to ${outputFile}.`);
return exec(`idb record-video --udid ${serial} ${outputFile}`);
return this._execIdb(`record-video --udid ${serial} ${outputFile}`);
}
async screenshot(serial: string): Promise<Buffer> {
const imagePath = makeTempScreenshotFilePath();
await exec(`idb screenshot --udid ${serial} ${imagePath}`);
await this._execIdb(`screenshot --udid ${serial} ${imagePath}`);
return readScreenshotIntoBuffer(imagePath);
}
@@ -65,6 +66,10 @@ class IDBBridge implements IOSBridge {
},
);
}
_execIdb(command: string): child_process.ChildProcess {
return exec(`${this.idbPath} ${command}`);
}
}
class SimctlBridge implements IOSBridge {