@houwert/conductor 0.13.0 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.HELP = void 0;
|
|
4
|
+
exports.getInstalledAppIds = getInstalledAppIds;
|
|
4
5
|
exports.foregroundApp = foregroundApp;
|
|
5
6
|
exports.HELP = ` foreground-app Print bundle ID / package of the foreground app`;
|
|
6
7
|
const runner_js_1 = require("../runner.js");
|
package/dist/commands/memory.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.memory = memory;
|
|
|
5
5
|
exports.HELP = ` memory [<appId>] Show device + app memory usage and object counts`;
|
|
6
6
|
const runner_js_1 = require("../runner.js");
|
|
7
7
|
const session_js_1 = require("../session.js");
|
|
8
|
+
const foreground_app_js_1 = require("./foreground-app.js");
|
|
8
9
|
const output_js_1 = require("../output.js");
|
|
9
10
|
const bootstrap_js_1 = require("../drivers/bootstrap.js");
|
|
10
11
|
const ios_js_1 = require("../drivers/ios.js");
|
|
@@ -16,21 +17,22 @@ async function resolveDeviceId(sessionName) {
|
|
|
16
17
|
const session = await (0, session_js_1.getSession)(sessionName);
|
|
17
18
|
return session.deviceId ?? (await (0, runner_js_1.detectFirstDevice)());
|
|
18
19
|
}
|
|
19
|
-
async function resolveAppId(explicit, sessionName) {
|
|
20
|
+
async function resolveAppId(explicit, sessionName, deviceId) {
|
|
20
21
|
if (explicit)
|
|
21
22
|
return explicit;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Fall back to whatever's in the foreground.
|
|
23
|
+
// No arg: always resolve from the live foreground app, not the session file.
|
|
24
|
+
// The session's appId reflects the last `launch-app` call, which can be stale
|
|
25
|
+
// if the user switched apps on the device by other means.
|
|
26
26
|
try {
|
|
27
27
|
const driver = await (0, runner_js_1.getDriver)(sessionName);
|
|
28
28
|
if (driver instanceof android_js_1.AndroidDriver)
|
|
29
29
|
return await driver.getForegroundApp();
|
|
30
30
|
if (driver instanceof web_js_1.WebDriver)
|
|
31
31
|
return await driver.runningApp();
|
|
32
|
-
if (driver instanceof ios_js_1.IOSDriver)
|
|
33
|
-
|
|
32
|
+
if (driver instanceof ios_js_1.IOSDriver) {
|
|
33
|
+
const appIds = await (0, foreground_app_js_1.getInstalledAppIds)(deviceId);
|
|
34
|
+
return await driver.runningApp(appIds);
|
|
35
|
+
}
|
|
34
36
|
}
|
|
35
37
|
catch {
|
|
36
38
|
/* ignore */
|
|
@@ -469,7 +471,7 @@ async function memory(appIdArg, opts = {}, sessionName = 'default', _memOpts = {
|
|
|
469
471
|
report = await collectWeb(deviceId, sessionName);
|
|
470
472
|
}
|
|
471
473
|
else {
|
|
472
|
-
const appId = await resolveAppId(appIdArg, sessionName);
|
|
474
|
+
const appId = await resolveAppId(appIdArg, sessionName, deviceId);
|
|
473
475
|
if (platform === 'android') {
|
|
474
476
|
report = await collectAndroid(deviceId, appId);
|
|
475
477
|
}
|