@swmansion/argent 0.34.1-next.82 → 0.34.1-next.84
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.
package/dist/cli-cmds.mjs
CHANGED
|
@@ -36295,7 +36295,7 @@ function isCi(env = process.env) {
|
|
|
36295
36295
|
var SESSION_ID2 = randomUUID5();
|
|
36296
36296
|
function readCliVersion() {
|
|
36297
36297
|
if (true) {
|
|
36298
|
-
return "0.34.1-next.
|
|
36298
|
+
return "0.34.1-next.84";
|
|
36299
36299
|
}
|
|
36300
36300
|
return "0.0.0";
|
|
36301
36301
|
}
|
package/dist/installer.mjs
CHANGED
|
@@ -16995,7 +16995,7 @@ function isCi(env = process.env) {
|
|
|
16995
16995
|
var SESSION_ID = randomUUID4();
|
|
16996
16996
|
function readCliVersion() {
|
|
16997
16997
|
if (true) {
|
|
16998
|
-
return "0.34.1-next.
|
|
16998
|
+
return "0.34.1-next.84";
|
|
16999
16999
|
}
|
|
17000
17000
|
return "0.0.0";
|
|
17001
17001
|
}
|
package/dist/tool-server.cjs
CHANGED
|
@@ -72947,7 +72947,7 @@ function isCi(env = process.env) {
|
|
|
72947
72947
|
var SESSION_ID = (0, import_node_crypto3.randomUUID)();
|
|
72948
72948
|
function readCliVersion() {
|
|
72949
72949
|
if (true) {
|
|
72950
|
-
return "0.34.1-next.
|
|
72950
|
+
return "0.34.1-next.84";
|
|
72951
72951
|
}
|
|
72952
72952
|
return "0.0.0";
|
|
72953
72953
|
}
|
|
@@ -94637,6 +94637,7 @@ var FIRST_FRAME_WAIT_MS = 6e3;
|
|
|
94637
94637
|
var FIRST_FRAME_POLL_MS = 250;
|
|
94638
94638
|
var COMMAND_ACK_TIMEOUT_MS = 5e3;
|
|
94639
94639
|
var EDGE_DOWN_ACK_TIMEOUT_MS = 35e3;
|
|
94640
|
+
var KEY_ACK_TIMEOUT_MS = 15e3;
|
|
94640
94641
|
var connections = /* @__PURE__ */ new Map();
|
|
94641
94642
|
var cmdId = 0;
|
|
94642
94643
|
function pendingIdNamedBy(conn, message) {
|
|
@@ -94647,6 +94648,22 @@ function pendingIdNamedBy(conn, message) {
|
|
|
94647
94648
|
}
|
|
94648
94649
|
return void 0;
|
|
94649
94650
|
}
|
|
94651
|
+
function releaseHeldKeys(conn) {
|
|
94652
|
+
const held = conn.heldKeys.splice(0).reverse();
|
|
94653
|
+
if (conn.ws.readyState !== wrapper_default.OPEN) return;
|
|
94654
|
+
for (const code of held) {
|
|
94655
|
+
conn.ws.send(JSON.stringify({ id: String(++cmdId), cmd: "key", code, direction: "Up" }));
|
|
94656
|
+
}
|
|
94657
|
+
}
|
|
94658
|
+
function trackHeldKey(conn, cmd) {
|
|
94659
|
+
if (cmd.cmd !== "key" || typeof cmd.code !== "number") return;
|
|
94660
|
+
if (cmd.direction === "Down") {
|
|
94661
|
+
conn.heldKeys.push(cmd.code);
|
|
94662
|
+
return;
|
|
94663
|
+
}
|
|
94664
|
+
const index = conn.heldKeys.lastIndexOf(cmd.code);
|
|
94665
|
+
if (index !== -1) conn.heldKeys.splice(index, 1);
|
|
94666
|
+
}
|
|
94650
94667
|
function failAllPending(conn, makeError) {
|
|
94651
94668
|
const entries = [...conn.pending.values()];
|
|
94652
94669
|
conn.pending.clear();
|
|
@@ -94682,7 +94699,7 @@ function getOrCreateConnection(api) {
|
|
|
94682
94699
|
}
|
|
94683
94700
|
const { host } = new URL(api.apiUrl);
|
|
94684
94701
|
const ws = new wrapper_default(`ws://${host}/ws`);
|
|
94685
|
-
const conn = { ws, pending: /* @__PURE__ */ new Map() };
|
|
94702
|
+
const conn = { ws, pending: /* @__PURE__ */ new Map(), heldKeys: [] };
|
|
94686
94703
|
ws.on("message", (data) => {
|
|
94687
94704
|
const text = Buffer.isBuffer(data) ? data.toString() : Array.isArray(data) ? Buffer.concat(data).toString() : Buffer.from(data).toString();
|
|
94688
94705
|
let ack;
|
|
@@ -94727,7 +94744,7 @@ function getOrCreateConnection(api) {
|
|
|
94727
94744
|
connections.set(key2, conn);
|
|
94728
94745
|
return conn;
|
|
94729
94746
|
}
|
|
94730
|
-
async function sendCommand(api, cmd) {
|
|
94747
|
+
async function sendCommand(api, cmd, options = {}) {
|
|
94731
94748
|
const cmdName = typeof cmd.cmd === "string" ? cmd.cmd : "unknown";
|
|
94732
94749
|
if ((cmd.cmd === "rotate" || cmd.cmd === "button") && api.deviceId) {
|
|
94733
94750
|
forgetUiOrientation(api.deviceId);
|
|
@@ -94742,7 +94759,7 @@ async function sendCommand(api, cmd) {
|
|
|
94742
94759
|
const warning = turnWarning !== void 0 && screenWarning !== void 0 ? `${screenWarning} ${turnWarning}` : screenWarning ?? turnWarning;
|
|
94743
94760
|
const id = String(++cmdId);
|
|
94744
94761
|
const payload = JSON.stringify({ id, ...targeted });
|
|
94745
|
-
const ackTimeoutMs = cmdName === "edgeTouch" && cmd.type === "Down" ? EDGE_DOWN_ACK_TIMEOUT_MS : COMMAND_ACK_TIMEOUT_MS;
|
|
94762
|
+
const ackTimeoutMs = options.ackTimeoutMs ?? (cmdName === "edgeTouch" && cmd.type === "Down" ? EDGE_DOWN_ACK_TIMEOUT_MS : COMMAND_ACK_TIMEOUT_MS);
|
|
94746
94763
|
await new Promise((resolve21, reject) => {
|
|
94747
94764
|
let done = false;
|
|
94748
94765
|
const settle3 = (err) => {
|
|
@@ -94771,14 +94788,18 @@ async function sendCommand(api, cmd) {
|
|
|
94771
94788
|
);
|
|
94772
94789
|
timer.unref?.();
|
|
94773
94790
|
const settleAndDropConnection = (err) => {
|
|
94791
|
+
releaseHeldKeys(conn);
|
|
94774
94792
|
settle3(err);
|
|
94775
94793
|
connections.delete(api.apiUrl);
|
|
94776
94794
|
conn.ws.close();
|
|
94777
94795
|
};
|
|
94778
94796
|
conn.pending.set(id, { settle: settle3, cmd: cmdName });
|
|
94779
|
-
const write = () =>
|
|
94780
|
-
|
|
94781
|
-
|
|
94797
|
+
const write = () => {
|
|
94798
|
+
trackHeldKey(conn, targeted);
|
|
94799
|
+
conn.ws.send(payload, (err) => {
|
|
94800
|
+
if (err) settle3(transportError(cmdName, api.apiUrl, err.message));
|
|
94801
|
+
});
|
|
94802
|
+
};
|
|
94782
94803
|
if (conn.ws.readyState === wrapper_default.OPEN) write();
|
|
94783
94804
|
else conn.ws.once("open", write);
|
|
94784
94805
|
});
|
|
@@ -97945,7 +97966,11 @@ async function buildRemoteInstance(device) {
|
|
|
97945
97966
|
// session refuses reports the same failure as a refused touch instead of a
|
|
97946
97967
|
// bare SDK error the caller cannot classify.
|
|
97947
97968
|
pressKey: async (direction, keyCode) => {
|
|
97948
|
-
await sendCommand(
|
|
97969
|
+
await sendCommand(
|
|
97970
|
+
api,
|
|
97971
|
+
{ cmd: "key", code: keyCode, direction },
|
|
97972
|
+
{ ackTimeoutMs: KEY_ACK_TIMEOUT_MS }
|
|
97973
|
+
);
|
|
97949
97974
|
},
|
|
97950
97975
|
transport
|
|
97951
97976
|
};
|
|
@@ -97971,7 +97996,7 @@ async function buildAttachedInstance(device, externalDevice) {
|
|
|
97971
97996
|
deviceId: device.id,
|
|
97972
97997
|
external: true,
|
|
97973
97998
|
pressKey: async (direction, code) => {
|
|
97974
|
-
await sendCommand(api, { cmd: "key", code, direction });
|
|
97999
|
+
await sendCommand(api, { cmd: "key", code, direction }, { ackTimeoutMs: KEY_ACK_TIMEOUT_MS });
|
|
97975
98000
|
},
|
|
97976
98001
|
streamUrl: externalDevice.simulatorServer.streamUrl
|
|
97977
98002
|
/** `transport: undefined`, so the WS + HTTP path is reused unchanged. */
|
|
@@ -98248,17 +98273,28 @@ var simulatorServerBlueprint = {
|
|
|
98248
98273
|
proc.on("error", (err) => {
|
|
98249
98274
|
events.emit("terminated", err);
|
|
98250
98275
|
});
|
|
98276
|
+
const api = {
|
|
98277
|
+
apiUrl,
|
|
98278
|
+
streamUrl,
|
|
98279
|
+
deviceId: device.id,
|
|
98280
|
+
/**
|
|
98281
|
+
* Over the WebSocket, not stdin: simulator-server never replies on
|
|
98282
|
+
* stdin, so a stdin write resolved at once and a stalled server let keys
|
|
98283
|
+
* pile up and land in a burst while `keyboard` reported them typed
|
|
98284
|
+
* (#2030). The ack holds each press until the server has taken it, and
|
|
98285
|
+
* a server that stops answering for KEY_ACK_TIMEOUT_MS fails the press
|
|
98286
|
+
* with SIMULATOR_COMMAND_ACK_TIMEOUT.
|
|
98287
|
+
*/
|
|
98288
|
+
pressKey: async (direction, keyCode) => {
|
|
98289
|
+
await sendCommand(
|
|
98290
|
+
api,
|
|
98291
|
+
{ cmd: "key", code: keyCode, direction },
|
|
98292
|
+
{ ackTimeoutMs: KEY_ACK_TIMEOUT_MS }
|
|
98293
|
+
);
|
|
98294
|
+
}
|
|
98295
|
+
};
|
|
98251
98296
|
const instance = {
|
|
98252
|
-
api
|
|
98253
|
-
apiUrl,
|
|
98254
|
-
streamUrl,
|
|
98255
|
-
deviceId: device.id,
|
|
98256
|
-
pressKey: (direction, keyCode) => {
|
|
98257
|
-
proc.stdin?.write(`key ${direction} ${keyCode}
|
|
98258
|
-
`);
|
|
98259
|
-
return Promise.resolve();
|
|
98260
|
-
}
|
|
98261
|
-
},
|
|
98297
|
+
api,
|
|
98262
98298
|
dispose: async () => {
|
|
98263
98299
|
proc.kill();
|
|
98264
98300
|
},
|
|
@@ -124795,6 +124831,10 @@ function forgetNativeUnavailableOf(devices2) {
|
|
|
124795
124831
|
if (!covered || covered.has(key2.slice(0, key2.lastIndexOf(":")))) nativeUnavailable.delete(key2);
|
|
124796
124832
|
}
|
|
124797
124833
|
}
|
|
124834
|
+
function captureSweepUnderWay(udid) {
|
|
124835
|
+
const device = lockDevice(udid);
|
|
124836
|
+
return [...captureSweeps].some((sweep) => !sweep.devices || sweep.devices.has(device));
|
|
124837
|
+
}
|
|
124798
124838
|
function withCaptureLock(udid, bundleId, fn) {
|
|
124799
124839
|
const device = lockDevice(udid);
|
|
124800
124840
|
const sweeps = [...captureSweeps].filter((sweep) => !sweep.devices || sweep.devices.has(device)).map((sweep) => sweep.done);
|
|
@@ -127644,7 +127684,8 @@ function makeNetworkWaitReadScript(mark, metroPort2) {
|
|
|
127644
127684
|
url: e.request ? e.request.url : undefined,
|
|
127645
127685
|
status: e.response ? e.response.status : undefined,
|
|
127646
127686
|
durationMs: e.durationMs,
|
|
127647
|
-
errorText: e.errorText
|
|
127687
|
+
errorText: e.errorText,
|
|
127688
|
+
timestamp: e.timestamp
|
|
127648
127689
|
});
|
|
127649
127690
|
}
|
|
127650
127691
|
return JSON.stringify({
|
|
@@ -134835,6 +134876,7 @@ function charToKeyPress(char) {
|
|
|
134835
134876
|
// ../tool-server/src/tools/keyboard/simulator-server-keys.ts
|
|
134836
134877
|
init_capability();
|
|
134837
134878
|
var sleep10 = (ms3) => new Promise((r) => setTimeout(r, ms3));
|
|
134879
|
+
var KEY_HOLD = { ms: 20 };
|
|
134838
134880
|
async function typeSimulatorServer(registry2, device, params) {
|
|
134839
134881
|
const ref = simulatorServerRef(device);
|
|
134840
134882
|
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
@@ -134846,7 +134888,7 @@ async function typeSimulatorServer(registry2, device, params) {
|
|
|
134846
134888
|
await sleep10(10);
|
|
134847
134889
|
}
|
|
134848
134890
|
await api.pressKey("Down", keyCode);
|
|
134849
|
-
await sleep10(
|
|
134891
|
+
await sleep10(KEY_HOLD.ms);
|
|
134850
134892
|
await api.pressKey("Up", keyCode);
|
|
134851
134893
|
if (withShift) {
|
|
134852
134894
|
await sleep10(10);
|
|
@@ -134885,6 +134927,127 @@ async function typeSimulatorServer(registry2, device, params) {
|
|
|
134885
134927
|
return { typed: params.text ?? params.key ?? "", keys: keysPressed };
|
|
134886
134928
|
}
|
|
134887
134929
|
|
|
134930
|
+
// ../tool-server/src/tools/keyboard/ios-readback.ts
|
|
134931
|
+
var READBACK_TIMING = {
|
|
134932
|
+
/** Budget to reach the ax-service; past it, typing goes on unchecked. */
|
|
134933
|
+
resolveMs: 1500,
|
|
134934
|
+
/**
|
|
134935
|
+
* Budget for each tree read. Before typing, past it the typing goes on
|
|
134936
|
+
* unchecked; after typing, the ax-service check decides.
|
|
134937
|
+
*/
|
|
134938
|
+
treeMs: 1500,
|
|
134939
|
+
/**
|
|
134940
|
+
* Budget for the ax-service check after typing. It must outlast the
|
|
134941
|
+
* daemon's 1 s wait, or a field that does not hold the text never answers
|
|
134942
|
+
* "no". The daemon's wait also gives an app that applies input late the
|
|
134943
|
+
* time it needs.
|
|
134944
|
+
*/
|
|
134945
|
+
checkMs: 3500
|
|
134946
|
+
};
|
|
134947
|
+
var FOCUS_MOVING = /[\r\n\t]/;
|
|
134948
|
+
var READBACK_MISMATCH_WARNING = "After typing, the focused field does not hold the text that was sent. Keys may have been dropped or repeated (a stalled simulator does this, and the keys were still acknowledged), or the app or iOS changed the text (auto-capitalization, auto-correction, an input formatter, a length limit). Read the field before submitting; to retype, clear it first.";
|
|
134949
|
+
async function within(ms3, run2) {
|
|
134950
|
+
let timer;
|
|
134951
|
+
try {
|
|
134952
|
+
return await Promise.race([
|
|
134953
|
+
// Through `then`, so a synchronous throw is caught as well.
|
|
134954
|
+
Promise.resolve().then(run2).catch(() => void 0),
|
|
134955
|
+
new Promise((resolve21) => {
|
|
134956
|
+
timer = setTimeout(() => resolve21(void 0), ms3);
|
|
134957
|
+
timer.unref?.();
|
|
134958
|
+
})
|
|
134959
|
+
]);
|
|
134960
|
+
} finally {
|
|
134961
|
+
clearTimeout(timer);
|
|
134962
|
+
}
|
|
134963
|
+
}
|
|
134964
|
+
async function typeWithReadback(registry2, device, text, type) {
|
|
134965
|
+
if (!text || FOCUS_MOVING.test(text)) return { result: await type() };
|
|
134966
|
+
const ax = await within(READBACK_TIMING.resolveMs, async () => {
|
|
134967
|
+
const ref = axServiceRef(device);
|
|
134968
|
+
const api = await registry2.resolveService(ref.urn, ref.options);
|
|
134969
|
+
return api.degraded ? void 0 : api;
|
|
134970
|
+
});
|
|
134971
|
+
const readTree = async () => ax ? (await within(READBACK_TIMING.treeMs, () => ax.tree()))?.nodes : void 0;
|
|
134972
|
+
const before = await readTree();
|
|
134973
|
+
const field2 = before && focusedInput(before);
|
|
134974
|
+
const typedInto = field2 && heldText(field2) === "" ? field2 : void 0;
|
|
134975
|
+
const result = await type();
|
|
134976
|
+
if (!ax || !typedInto) return { result };
|
|
134977
|
+
const judge = async () => {
|
|
134978
|
+
const nodes = await readTree();
|
|
134979
|
+
return nodes ? judgeTree(nodes, typedInto, text) : "unread";
|
|
134980
|
+
};
|
|
134981
|
+
const verified = { result, readback: { verified: true } };
|
|
134982
|
+
const early = await judge();
|
|
134983
|
+
if (early === "holds") return verified;
|
|
134984
|
+
if (early === "moved") return { result };
|
|
134985
|
+
const after = await within(READBACK_TIMING.checkMs, () => ax.fill(text, { check: true }));
|
|
134986
|
+
if (after?.verified) return verified;
|
|
134987
|
+
if (!after || !after.focused || after.timedOut) return { result };
|
|
134988
|
+
const late = await judge();
|
|
134989
|
+
if (late === "holds") return verified;
|
|
134990
|
+
if (late === "moved" || late === "unread") return { result };
|
|
134991
|
+
return { result, readback: { verified: false, warning: READBACK_MISMATCH_WARNING } };
|
|
134992
|
+
}
|
|
134993
|
+
function judgeTree(nodes, typedInto, text) {
|
|
134994
|
+
const focused = focusedInput(nodes);
|
|
134995
|
+
if (!focused || !sameInput(focused, typedInto)) return "moved";
|
|
134996
|
+
const held = heldText(focused);
|
|
134997
|
+
return held !== void 0 && holdsTyped(text, held) ? "holds" : void 0;
|
|
134998
|
+
}
|
|
134999
|
+
var SECURE_TEXT_FIELD = 50;
|
|
135000
|
+
var TEXT_INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
135001
|
+
45,
|
|
135002
|
+
49,
|
|
135003
|
+
SECURE_TEXT_FIELD,
|
|
135004
|
+
52
|
|
135005
|
+
]);
|
|
135006
|
+
function focusedInput(nodes) {
|
|
135007
|
+
return nodes.find(
|
|
135008
|
+
(node2) => node2.traits?.includes("isEditing") && node2.elementType !== void 0 && TEXT_INPUT_TYPES.has(node2.elementType)
|
|
135009
|
+
);
|
|
135010
|
+
}
|
|
135011
|
+
function heldText(node2) {
|
|
135012
|
+
if (node2.hintShowing) return "";
|
|
135013
|
+
if (node2.elementType === SECURE_TEXT_FIELD) return node2.value ? void 0 : "";
|
|
135014
|
+
return node2.value ?? "";
|
|
135015
|
+
}
|
|
135016
|
+
function sameInput(a, b) {
|
|
135017
|
+
if (a.elementType !== b.elementType) return false;
|
|
135018
|
+
if (!a.frame || !b.frame) return true;
|
|
135019
|
+
const [p, q] = [a.frame, b.frame];
|
|
135020
|
+
const width = Math.min(p.x + p.width, q.x + q.width) - Math.max(p.x, q.x);
|
|
135021
|
+
const height = Math.min(p.y + p.height, q.y + q.height) - Math.max(p.y, q.y);
|
|
135022
|
+
if (width <= 0 || height <= 0) return false;
|
|
135023
|
+
const smaller = Math.min(p.width * p.height, q.width * q.height);
|
|
135024
|
+
return width * height >= smaller / 2;
|
|
135025
|
+
}
|
|
135026
|
+
function holdsTyped(typed, held) {
|
|
135027
|
+
const a = plainPunctuation(typed);
|
|
135028
|
+
const b = plainPunctuation(held);
|
|
135029
|
+
return a === b || capitalizedByIos(a, b);
|
|
135030
|
+
}
|
|
135031
|
+
function plainPunctuation(text) {
|
|
135032
|
+
return text.replace(/‹[\u00A0\u202F]?|[\u00A0\u202F]?›/gu, "'").replace(/«[\u00A0\u202F]?|[\u00A0\u202F]?»/gu, '"').replace(/[‘’‚‛]/gu, "'").replace(/[“”„‟]/gu, '"').replace(/--|–/gu, "\u2014");
|
|
135033
|
+
}
|
|
135034
|
+
var WORD_OPENER = /[\s"'([{¿¡]/u;
|
|
135035
|
+
function capitalizedByIos(typed, held) {
|
|
135036
|
+
const a = Array.from(typed);
|
|
135037
|
+
const b = Array.from(held);
|
|
135038
|
+
if (a.length !== b.length) return false;
|
|
135039
|
+
let changed = false;
|
|
135040
|
+
for (let i = 0; i < a.length; i++) {
|
|
135041
|
+
const char = a[i];
|
|
135042
|
+
if (char === b[i]) continue;
|
|
135043
|
+
const wordStart = i === 0 || WORD_OPENER.test(a[i - 1]);
|
|
135044
|
+
const lowercase2 = char !== char.toUpperCase();
|
|
135045
|
+
if (!wordStart || !lowercase2 || b[i] !== char.toUpperCase()) return false;
|
|
135046
|
+
changed = true;
|
|
135047
|
+
}
|
|
135048
|
+
return changed;
|
|
135049
|
+
}
|
|
135050
|
+
|
|
134888
135051
|
// ../tool-server/src/tools/keyboard/platforms/tv.ts
|
|
134889
135052
|
init_capability();
|
|
134890
135053
|
async function typeTv(registry2, device, params) {
|
|
@@ -134904,14 +135067,23 @@ async function typeTv(registry2, device, params) {
|
|
|
134904
135067
|
}
|
|
134905
135068
|
|
|
134906
135069
|
// ../tool-server/src/tools/keyboard/platforms/ios.ts
|
|
135070
|
+
async function typeAndReadBack(registry2, device, params) {
|
|
135071
|
+
const { result, readback } = await typeWithReadback(
|
|
135072
|
+
registry2,
|
|
135073
|
+
device,
|
|
135074
|
+
params.text ?? "",
|
|
135075
|
+
() => typeSimulatorServer(registry2, device, params)
|
|
135076
|
+
);
|
|
135077
|
+
return readback ? { ...result, ...readback } : result;
|
|
135078
|
+
}
|
|
134907
135079
|
function makeIosImpl3(registry2) {
|
|
134908
135080
|
return {
|
|
134909
|
-
handler: async (_services, params, device) => await isTvOsSimulator(device.id) ? typeTv(registry2, device, params) :
|
|
135081
|
+
handler: async (_services, params, device) => await isTvOsSimulator(device.id) ? typeTv(registry2, device, params) : typeAndReadBack(registry2, device, params)
|
|
134910
135082
|
};
|
|
134911
135083
|
}
|
|
134912
135084
|
function makeIosRemoteImpl(registry2) {
|
|
134913
135085
|
return {
|
|
134914
|
-
handler: async (_services, params, device) =>
|
|
135086
|
+
handler: async (_services, params, device) => typeAndReadBack(registry2, device, params)
|
|
134915
135087
|
};
|
|
134916
135088
|
}
|
|
134917
135089
|
|
|
@@ -135418,7 +135590,7 @@ function createKeyboardTool(registry2) {
|
|
|
135418
135590
|
description: `Type text or press special keys on the device (iOS simulator, Android emulator or device, <flag:harmonyos>HarmonyOS device, </flag:harmonyos>Chromium app, <flag:macos-apps>Mac app, </flag:macos-apps>Vega Virtual Device, or Apple TV / Android TV) using keyboard events.
|
|
135419
135591
|
Use when you need to enter text or trigger a named key such as enter, escape, or arrow keys. On Vega and Apple TV / Android TV, prefer the remote tools for D-pad navigation; focus a text field with \`tv-remote\` first (e.g. a search or login box), then type into it with keyboard.
|
|
135420
135592
|
Tap the field first: with no focus the text is dropped and the call still succeeds.
|
|
135421
|
-
Returns { typed: string, keys: number }. On physical iOS, reactivated: true = app was re-fronted; re-describe. Fails if an unsupported key name is provided (rejected before anything is sent) or if the device's input backend is not reachable.
|
|
135593
|
+
Returns { typed: string, keys: number }. On physical iOS, reactivated: true = app was re-fronted; re-describe. On an iOS simulator, when the focused field was empty before typing, the field is read back: verified: true = it holds the typed text, though iOS may have capitalized the first letter of a word or curled a quote; no verified = the field was not checked: it held text before typing, the text has a Return or Tab, focus moved to another field while typing, or the field could not be read in time (the app busy, the accessibility service missing or slow); verified: false comes with a warning (keys dropped or repeated, or the app or iOS changed the text), so read the field before submitting. Fails if an unsupported key name is provided (rejected before anything is sent) or if the device's input backend is not reachable.
|
|
135422
135594
|
A failure is not rolled back. Un-typeable text is rejected mid-string on the iOS simulator and Chromium, leaving the characters before it in the field (Android, <flag:harmonyos>HarmonyOS, </flag:harmonyos>Vega and TV targets check the whole string up front).<flag:macos-apps> A Mac app types any character.</flag:macos-apps> A transport failure partway also leaves the text already sent. On a retry, read the field's actual contents; do not assume it is unchanged.
|
|
135423
135595
|
React Native: after typing, the next tap outside the field may only close the keyboard. If only the keyboard closed, tap again; where the field submits on return, \`key: "enter"\` avoids the extra tap.`,
|
|
135424
135596
|
zodSchema: zodSchema26,
|
|
@@ -137108,7 +137280,7 @@ var ALLOWED_TOOLS = /* @__PURE__ */ new Set([
|
|
|
137108
137280
|
"fold",
|
|
137109
137281
|
"tv-remote",
|
|
137110
137282
|
AWAIT_UI_ELEMENT_TOOL_ID,
|
|
137111
|
-
// Returns its match, never an image: after network-capture-start, an
|
|
137283
|
+
// Returns its match or near misses, never an image: after network-capture-start, an
|
|
137112
137284
|
// action and its wait run as one sequence, and an unmet wait stops it.
|
|
137113
137285
|
AWAIT_NETWORK_REQUEST_TOOL_ID
|
|
137114
137286
|
]);
|
|
@@ -139850,7 +140022,7 @@ function createNetworkCaptureStartTool(registry2) {
|
|
|
139850
140022
|
id: "network-capture-start",
|
|
139851
140023
|
description: `Start network capture on iOS simulators and Android<flag:macos-apps> (also on Mac apps)</flag:macos-apps>. Use when you need to inspect traffic from an upcoming action or check a request with await-network-request. A new start keeps the log and begins a new window for the wait. Capture can slow the app.
|
|
139852
140024
|
On Chromium, Argent connects if needed and marks the start of the wait window. The log records while connected.
|
|
139853
|
-
The JavaScript layer needs an app connected to Metro.
|
|
140025
|
+
The JavaScript layer needs an app connected to Metro. After a reload or relaunch, start capture again once JavaScript loads and before triggering the request. Android native capture needs a debuggable build.<flag:macos-apps> For a supported React Native app launched from Xcode, use layer js and form udid as macos-app-<bundle id>. Native capture needs a supported build launched through Argent.</flag:macos-apps>
|
|
139854
140026
|
Returns { status, layers }: check armed and reason for each requested layer. A pending native layer can become ready when Argent launches or reconnects to the app. On a device whose devtools agent Argent attached to, start native capture again after a relaunch.
|
|
139855
140027
|
When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING.`,
|
|
139856
140028
|
zodSchema: captureSchema,
|
|
@@ -141927,6 +142099,8 @@ init_capability();
|
|
|
141927
142099
|
|
|
141928
142100
|
// ../tool-server/src/tools/await-network-request/layers.ts
|
|
141929
142101
|
var CAPTURE_ENDED = "its capture ended after the start (stop-all-simulator-servers, a stop of the device's services, or a tool-server restart); call network-capture-start again";
|
|
142102
|
+
var SWEEP_UNDER_WAY = "stop-all-simulator-servers or the tool-server's exit is ending the app's capture";
|
|
142103
|
+
var CAPTURE_CHANGED = "the app's capture changed during the read (a network-capture-start or -stop, or a teardown of the device), so the read left the app's JS runtime as it was";
|
|
141930
142104
|
async function liveService(registry2, ref) {
|
|
141931
142105
|
return isLiveService(registry2, ref.urn) ? registry2.resolveService(ref.urn, ref.options) : void 0;
|
|
141932
142106
|
}
|
|
@@ -141954,7 +142128,9 @@ function fromNative(record2) {
|
|
|
141954
142128
|
...record2.response ? { status: record2.response.status } : {},
|
|
141955
142129
|
state: lost ? "lost" : record2.state,
|
|
141956
142130
|
...record2.timing.durationMs !== void 0 ? { durationMs: Math.round(record2.timing.durationMs) } : {},
|
|
141957
|
-
...record2.errorText ? { errorText: record2.errorText } : {}
|
|
142131
|
+
...record2.errorText ? { errorText: record2.errorText } : {},
|
|
142132
|
+
// From the agent's wallTime, on the app's clock, as the start of a JS request.
|
|
142133
|
+
startedAt: record2.timing.startedAt
|
|
141958
142134
|
};
|
|
141959
142135
|
}
|
|
141960
142136
|
function nativeAfter(records, floor) {
|
|
@@ -142109,7 +142285,8 @@ function fromJs(entry) {
|
|
|
142109
142285
|
...typeof entry.status === "number" ? { status: entry.status } : {},
|
|
142110
142286
|
state: state3,
|
|
142111
142287
|
...typeof entry.durationMs === "number" ? { durationMs: Math.round(entry.durationMs) } : {},
|
|
142112
|
-
...entry.errorText ? { errorText: entry.errorText } : {}
|
|
142288
|
+
...entry.errorText ? { errorText: entry.errorText } : {},
|
|
142289
|
+
...typeof entry.timestamp === "number" ? { startedAt: entry.timestamp * 1e3 } : {}
|
|
142113
142290
|
};
|
|
142114
142291
|
}
|
|
142115
142292
|
function jsLayer(registry2, device, bundleId, startWindow) {
|
|
@@ -142124,22 +142301,33 @@ function jsLayer(registry2, device, bundleId, startWindow) {
|
|
|
142124
142301
|
if (!found2 || !mark) return unreadable("js", CAPTURE_ENDED);
|
|
142125
142302
|
const { payload, port, capture } = found2;
|
|
142126
142303
|
let stopped = capture.intent === "stopped";
|
|
142127
|
-
|
|
142304
|
+
const physical = capture.physicalDeviceId ?? device.id;
|
|
142305
|
+
if (captureSweepUnderWay(physical)) return unreadable("js", SWEEP_UNDER_WAY, stopped);
|
|
142306
|
+
const urn = `${JS_RUNTIME_DEBUGGER_NAMESPACE}:${payload}`;
|
|
142307
|
+
const live = isLiveService(registry2, urn);
|
|
142308
|
+
if (stopped && !live) {
|
|
142128
142309
|
return unreadable(
|
|
142129
142310
|
"js",
|
|
142130
|
-
|
|
142131
|
-
|
|
142311
|
+
"the app's JS runtime is not connected, and a stopped capture does not reconnect to it",
|
|
142312
|
+
true
|
|
142132
142313
|
);
|
|
142133
142314
|
}
|
|
142134
|
-
const
|
|
142315
|
+
const whileStarted = (change) => withCaptureLock(physical, bundleId, async () => {
|
|
142316
|
+
if (captureSweepUnderWay(physical)) return { note: SWEEP_UNDER_WAY };
|
|
142317
|
+
const now = findJsCaptureOfDevice(device.id, bundleId);
|
|
142318
|
+
if (!now?.capture.mark) return { note: CAPTURE_ENDED };
|
|
142319
|
+
if (now.capture !== capture || capture.intent !== "started") {
|
|
142320
|
+
return { note: CAPTURE_CHANGED };
|
|
142321
|
+
}
|
|
142322
|
+
return { value: await change() };
|
|
142323
|
+
});
|
|
142135
142324
|
const target = payload.slice(payload.indexOf(":") + 1);
|
|
142136
142325
|
try {
|
|
142137
|
-
const
|
|
142138
|
-
registry2,
|
|
142139
|
-
physical,
|
|
142140
|
-
target !== physical ? target : void 0,
|
|
142141
|
-
port
|
|
142326
|
+
const opened = live ? { value: await registry2.resolveService(urn) } : await whileStarted(
|
|
142327
|
+
() => resolveJsRuntime(registry2, physical, target !== physical ? target : void 0, port)
|
|
142142
142328
|
);
|
|
142329
|
+
if ("note" in opened) return unreadable("js", opened.note);
|
|
142330
|
+
const dbg = opened.value;
|
|
142143
142331
|
const appId = dbg.runtimeApp?.appId;
|
|
142144
142332
|
if (appId !== void 0 && appId !== bundleId) {
|
|
142145
142333
|
return unreadable(
|
|
@@ -142157,6 +142345,10 @@ function jsLayer(registry2, device, bundleId, startWindow) {
|
|
|
142157
142345
|
);
|
|
142158
142346
|
const pauseMissed = stopped && answer.installed && answer.paused === false;
|
|
142159
142347
|
if (pauseMissed) stopped = false;
|
|
142348
|
+
const resume = !stopped && !pauseMissed && (!answer.installed || answer.paused === true);
|
|
142349
|
+
if (resume && answer.xhr !== true) {
|
|
142350
|
+
return unreadable("js", "the app's JavaScript has not loaded yet", stopped);
|
|
142351
|
+
}
|
|
142160
142352
|
if (!answer.installed) {
|
|
142161
142353
|
if (stopped) {
|
|
142162
142354
|
return {
|
|
@@ -142168,29 +142360,45 @@ function jsLayer(registry2, device, bundleId, startWindow) {
|
|
|
142168
142360
|
note: "the app's JS runtime reloaded since the stop, which cleared its requests"
|
|
142169
142361
|
};
|
|
142170
142362
|
}
|
|
142363
|
+
const installed = await whileStarted(
|
|
142364
|
+
() => installNetworkInterceptor(dbg.cdp, payload, dbg.runtimeApp)
|
|
142365
|
+
);
|
|
142366
|
+
if ("note" in installed) return unreadable("js", installed.note);
|
|
142367
|
+
const install = installed.value;
|
|
142171
142368
|
return unreadable(
|
|
142172
142369
|
"js",
|
|
142173
|
-
|
|
142370
|
+
install.installed ? "the app's JS runtime had no interceptor (it reloaded, or its JavaScript had not loaded at the start), so the wait installed it: requests from now on are recorded, earlier ones in that runtime are missing" : `the interceptor did not install: ${install.reason}`
|
|
142174
142371
|
);
|
|
142175
142372
|
}
|
|
142176
|
-
|
|
142177
|
-
if (
|
|
142178
|
-
|
|
142179
|
-
|
|
142180
|
-
|
|
142181
|
-
|
|
142182
|
-
|
|
142183
|
-
|
|
142184
|
-
|
|
142185
|
-
|
|
142373
|
+
let note;
|
|
142374
|
+
if (resume) {
|
|
142375
|
+
const resumed = await whileStarted(
|
|
142376
|
+
() => installNetworkInterceptor(dbg.cdp, payload, dbg.runtimeApp)
|
|
142377
|
+
);
|
|
142378
|
+
if ("note" in resumed) return unreadable("js", resumed.note);
|
|
142379
|
+
const install = resumed.value;
|
|
142380
|
+
note = install.installed ? "a stop's pause was still in the app's JS runtime, so the wait resumed the capture: requests sent while it was paused are missing" : `a stop's pause is still in the app's JS runtime, and the wait could not resume it: ${install.reason}`;
|
|
142381
|
+
if (!install.installed) {
|
|
142382
|
+
return {
|
|
142383
|
+
layer: "js",
|
|
142384
|
+
readable: true,
|
|
142385
|
+
armed: false,
|
|
142386
|
+
stopped,
|
|
142387
|
+
records: (answer.entries ?? []).map(fromJs),
|
|
142388
|
+
note
|
|
142389
|
+
};
|
|
142390
|
+
}
|
|
142391
|
+
} else if (mark.install !== null && answer.token !== mark.install) {
|
|
142392
|
+
note = "the app's JS runtime reloaded after the start, so its requests between the reload and the interceptor's reinstall are missing";
|
|
142393
|
+
} else if (pauseMissed) {
|
|
142394
|
+
note = "the stop's pause did not reach the app's JS runtime, which still records: requests after the stop count";
|
|
142186
142395
|
}
|
|
142187
|
-
const note = mark.install !== null && answer.token !== mark.install ? "the app's JS runtime reloaded after the start, so its requests between the reload and the interceptor's reinstall are missing" : pauseMissed ? "the stop's pause did not reach the app's JS runtime, which still records: requests after the stop count" : void 0;
|
|
142188
142396
|
return {
|
|
142189
142397
|
layer: "js",
|
|
142190
142398
|
readable: true,
|
|
142191
142399
|
armed: true,
|
|
142192
142400
|
stopped,
|
|
142193
|
-
records,
|
|
142401
|
+
records: (answer.entries ?? []).map(fromJs),
|
|
142194
142402
|
...note ? { note } : {}
|
|
142195
142403
|
};
|
|
142196
142404
|
} catch (err) {
|
|
@@ -142206,6 +142414,9 @@ function jsLayer(registry2, device, bundleId, startWindow) {
|
|
|
142206
142414
|
}
|
|
142207
142415
|
|
|
142208
142416
|
// ../tool-server/src/tools/await-network-request/match.ts
|
|
142417
|
+
function withoutStart({ startedAt: _, ...record2 }) {
|
|
142418
|
+
return record2;
|
|
142419
|
+
}
|
|
142209
142420
|
var STATUS_CLASSES = ["1xx", "2xx", "3xx", "4xx", "5xx"];
|
|
142210
142421
|
function urlMatches(criteria, url2) {
|
|
142211
142422
|
switch (criteria.urlMatch) {
|
|
@@ -142240,7 +142451,28 @@ function mismatches(criteria, record2) {
|
|
|
142240
142451
|
return failed3;
|
|
142241
142452
|
}
|
|
142242
142453
|
function firstMatch(criteria, records) {
|
|
142243
|
-
|
|
142454
|
+
const found = records.find((record2) => mismatches(criteria, record2).length === 0);
|
|
142455
|
+
return found && withoutStart(found);
|
|
142456
|
+
}
|
|
142457
|
+
var MAX_NEAR_MISSES = 3;
|
|
142458
|
+
var SAME_REQUEST_MS = 1e3;
|
|
142459
|
+
function sameRequest(a, b) {
|
|
142460
|
+
return a.layer !== b.layer && a.method.toLowerCase() === b.method.toLowerCase() && a.url === b.url && a.status === b.status && a.state === b.state && // A retry with the same fields starts later.
|
|
142461
|
+
(a.startedAt === void 0 || b.startedAt === void 0 || Math.abs(a.startedAt - b.startedAt) <= SAME_REQUEST_MS);
|
|
142462
|
+
}
|
|
142463
|
+
function nearMisses(criteria, records) {
|
|
142464
|
+
const ranked = records.map((record2, index) => ({ record: record2, mismatch: mismatches(criteria, record2), index })).sort(
|
|
142465
|
+
(a, b) => Number(a.mismatch.includes("url")) - Number(b.mismatch.includes("url")) || a.mismatch.length - b.mismatch.length || // A record without a start counts as the oldest; NaN, when neither has one, falls through.
|
|
142466
|
+
(b.record.startedAt ?? -Infinity) - (a.record.startedAt ?? -Infinity) || b.index - a.index
|
|
142467
|
+
);
|
|
142468
|
+
const listed = [];
|
|
142469
|
+
for (const { record: record2, mismatch: mismatch2 } of ranked) {
|
|
142470
|
+
if (listed.length === MAX_NEAR_MISSES) break;
|
|
142471
|
+
const of = listed.find((entry) => !entry.twin && sameRequest(entry.record, record2));
|
|
142472
|
+
if (of) of.twin = true;
|
|
142473
|
+
else listed.push({ record: record2, mismatch: mismatch2, twin: false });
|
|
142474
|
+
}
|
|
142475
|
+
return listed.map(({ record: record2, mismatch: mismatch2 }) => ({ ...withoutStart(record2), mismatch: mismatch2 }));
|
|
142244
142476
|
}
|
|
142245
142477
|
var NOTE_URL_CHARS = 120;
|
|
142246
142478
|
function shortUrl(url2) {
|
|
@@ -142255,6 +142487,17 @@ function describeCriteria(criteria) {
|
|
|
142255
142487
|
criteria.outcome === "any" ? "complete or failed" : criteria.outcome
|
|
142256
142488
|
].filter(Boolean).join(", ");
|
|
142257
142489
|
}
|
|
142490
|
+
function describeRecord(record2) {
|
|
142491
|
+
const parts2 = [
|
|
142492
|
+
`${record2.method || "?"} ${shortUrl(record2.url)}`,
|
|
142493
|
+
record2.status !== void 0 ? String(record2.status) : void 0,
|
|
142494
|
+
record2.state,
|
|
142495
|
+
record2.errorText ? `"${shortUrl(record2.errorText)}"` : void 0,
|
|
142496
|
+
`[${record2.layer} ${record2.id}]`
|
|
142497
|
+
];
|
|
142498
|
+
const mismatch2 = "mismatch" in record2 ? ` (mismatch: ${record2.mismatch.join(", ")})` : "";
|
|
142499
|
+
return `${parts2.filter(Boolean).join(" ")}${mismatch2}`;
|
|
142500
|
+
}
|
|
142258
142501
|
|
|
142259
142502
|
// ../tool-server/src/tools/await-network-request/index.ts
|
|
142260
142503
|
var DEFAULT_TIMEOUT_MS4 = 1e4;
|
|
@@ -142336,8 +142579,8 @@ function createAwaitNetworkRequestTool(registry2) {
|
|
|
142336
142579
|
// A literal, so scripts/extract-tools.mjs finds the description it scores.
|
|
142337
142580
|
id: "await-network-request",
|
|
142338
142581
|
description: `Check whether a matching request finished. Use when an action should send a specific request. Call network-capture-start before the action, then call this tool. It searches requests started since the latest capture start and waits until a match finishes or the timeout expires. On Chromium, match the final URL, method and status after redirects.
|
|
142339
|
-
|
|
142340
|
-
If
|
|
142582
|
+
Pass match.id as requestId to view-network-request-details for headers and bodies. A request can match only if Argent saw its outcome. When success is false, check cause. For unmet or unreadable, nearMisses can show which criteria captured requests missed. For unreadable, follow the layer notes to restore capture and repeat the action. For cancelled, retry if needed. A false result fails an e2e step and stops a run-sequence.
|
|
142583
|
+
If the tool raises NETWORK_CAPTURE_NOT_STARTED, start capture and repeat the action. While the JavaScript capture window is active, the wait can reconnect to the runtime and restore recording. Requests sent before recording resumes may be missing.`,
|
|
142341
142584
|
zodSchema: zodSchema44,
|
|
142342
142585
|
searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
|
|
142343
142586
|
readOnly: true,
|
|
@@ -142473,17 +142716,25 @@ If capture has no start for the target, the tool raises NETWORK_CAPTURE_NOT_STAR
|
|
|
142473
142716
|
...last?.note ? { note: last.note } : {}
|
|
142474
142717
|
};
|
|
142475
142718
|
});
|
|
142719
|
+
const seen = [...latestReadable.values()].flatMap((read) => read.records);
|
|
142720
|
+
const misses = nearMisses(criteria, seen);
|
|
142476
142721
|
const counts = summaries.map(
|
|
142477
142722
|
(s) => `${s.layer} ${s.readable ? s.requests : "not read"}${s.armed ? "" : " (not armed)"}`
|
|
142478
142723
|
).join(", ");
|
|
142479
142724
|
const head = allStopped ? `No request matched (wanted: ${describeCriteria(criteria)}): capture is stopped on every marked layer, so only the requests captured between network-capture-start and network-capture-stop were searched.` : `No request since network-capture-start matched within this ${timeoutMs} ms wait (wanted: ${describeCriteria(criteria)}).`;
|
|
142480
142725
|
const notes = summaries.filter((s) => s.note).map((s) => `${s.layer}: ${s.note}`).join("; ");
|
|
142481
|
-
const note = [
|
|
142726
|
+
const note = [
|
|
142727
|
+
head,
|
|
142728
|
+
`Requests since the start: ${counts}.`,
|
|
142729
|
+
notes ? `${notes}.` : void 0,
|
|
142730
|
+
misses.length > 0 ? `Nearest: ${misses.map(describeRecord).join("; ")}.` : void 0
|
|
142731
|
+
].filter(Boolean).join(" ");
|
|
142482
142732
|
return {
|
|
142483
142733
|
success: false,
|
|
142484
142734
|
elapsed: elapsed(),
|
|
142485
142735
|
cause,
|
|
142486
142736
|
note,
|
|
142737
|
+
nearMisses: misses,
|
|
142487
142738
|
layers: summaries
|
|
142488
142739
|
};
|
|
142489
142740
|
}
|
|
@@ -158167,8 +158418,8 @@ function selectorToYaml(sel) {
|
|
|
158167
158418
|
if (sel.loose && sel.text !== void 0 && sel.identifier === void 0 && sel.role === void 0) {
|
|
158168
158419
|
return sel.text;
|
|
158169
158420
|
}
|
|
158170
|
-
const { loose: _loose, any: any2, identifier, textMatches: textMatches2, within, after, next, ...rest } = sel;
|
|
158171
|
-
const scopes = { within, after, next };
|
|
158421
|
+
const { loose: _loose, any: any2, identifier, textMatches: textMatches2, within: within2, after, next, ...rest } = sel;
|
|
158422
|
+
const scopes = { within: within2, after, next };
|
|
158172
158423
|
const out = { ...rest };
|
|
158173
158424
|
if (any2) out.any = true;
|
|
158174
158425
|
if (textMatches2 !== void 0) out.text = { matches: textMatches2 };
|
|
@@ -158194,8 +158445,8 @@ function escapeInline(value) {
|
|
|
158194
158445
|
);
|
|
158195
158446
|
}
|
|
158196
158447
|
function describeSelector(s) {
|
|
158197
|
-
const { loose: _loose, any: any2, within, after, next, ...rest } = s;
|
|
158198
|
-
const scopes = { within, after, next };
|
|
158448
|
+
const { loose: _loose, any: any2, within: within2, after, next, ...rest } = s;
|
|
158449
|
+
const scopes = { within: within2, after, next };
|
|
158199
158450
|
const fields = Object.entries(rest).map(
|
|
158200
158451
|
([k, v]) => k === "textMatches" ? `text=/${escapeInline(String(v))}/` : `${k === "identifier" ? "id" : k}=${JSON.stringify(String(v))}`
|
|
158201
158452
|
).join(" ");
|
|
@@ -161362,8 +161613,8 @@ function probeWhenCondition(env, cond) {
|
|
|
161362
161613
|
return waitForCondition(env, cond, DEFAULT_ASSERT_TIMEOUT_MS);
|
|
161363
161614
|
}
|
|
161364
161615
|
function selectorAlternatives(sel) {
|
|
161365
|
-
const { loose, any: _any2, within, after, next, ...own2 } = sel;
|
|
161366
|
-
const scopes = { within, after, next };
|
|
161616
|
+
const { loose, any: _any2, within: within2, after, next, ...own2 } = sel;
|
|
161617
|
+
const scopes = { within: within2, after, next };
|
|
161367
161618
|
let alts = loose && own2.text !== void 0 ? [{ identifier: own2.text }, { text: own2.text }] : [own2];
|
|
161368
161619
|
for (const relation of SELECTOR_RELATIONS) {
|
|
161369
161620
|
const scope = scopes[relation];
|
|
@@ -161555,7 +161806,7 @@ async function scrollIncrement(env, direction, region, limit = Infinity, anchor2
|
|
|
161555
161806
|
throw err;
|
|
161556
161807
|
}
|
|
161557
161808
|
}
|
|
161558
|
-
async function scrollToVisible(env, target, direction,
|
|
161809
|
+
async function scrollToVisible(env, target, direction, within2) {
|
|
161559
161810
|
let prevFp;
|
|
161560
161811
|
let prevShown;
|
|
161561
161812
|
let anchorSpent = false;
|
|
@@ -161564,9 +161815,9 @@ async function scrollToVisible(env, target, direction, within) {
|
|
|
161564
161815
|
if (env.signal?.aborted) return { aborted: true };
|
|
161565
161816
|
const tree = await settleTree(env);
|
|
161566
161817
|
if (!tree) return { aborted: true };
|
|
161567
|
-
const container =
|
|
161568
|
-
if (
|
|
161569
|
-
return { reason: `scroll container ${describeSelector(
|
|
161818
|
+
const container = within2 ? flowSelectorToNode(tree, within2) : void 0;
|
|
161819
|
+
if (within2 && !container) {
|
|
161820
|
+
return { reason: `scroll container ${describeSelector(within2)} is not visible` };
|
|
161570
161821
|
}
|
|
161571
161822
|
const targetNode = flowSelectorToNode(tree, target);
|
|
161572
161823
|
const frame2 = targetNode?.frame;
|
|
@@ -161587,7 +161838,7 @@ async function scrollToVisible(env, target, direction, within) {
|
|
|
161587
161838
|
anchorSpent = spentNow = true;
|
|
161588
161839
|
}
|
|
161589
161840
|
prevShown = shown;
|
|
161590
|
-
const scope =
|
|
161841
|
+
const scope = within2 ? [region] : anchorScrollFrames(tree, getDescribeTapPoint(region));
|
|
161591
161842
|
if (scope.length === 0) scope.push(FULL_SCREEN2);
|
|
161592
161843
|
const fp = treeFingerprint(tree, (node2) => scope.some((r) => framesOverlap(node2.frame, r)));
|
|
161593
161844
|
if (!spentNow && prevFp !== void 0 && fp === prevFp) {
|
|
@@ -161610,7 +161861,7 @@ async function scrollToVisible(env, target, direction, within) {
|
|
|
161610
161861
|
if (!(err instanceof Error && NO_SCROLLABLE_VIEW.test(err.message))) throw err;
|
|
161611
161862
|
if (frame2) return { frame: frame2, ...warnedBy(warning) };
|
|
161612
161863
|
return {
|
|
161613
|
-
reason: `nothing scrolls at the centre of ${
|
|
161864
|
+
reason: `nothing scrolls at the centre of ${within2 ? describeSelector(within2) : "the screen"}, so ${describeSelector(target)} cannot be scrolled into view; name its scroll container in within:`,
|
|
161614
161865
|
...warnedBy(warning)
|
|
161615
161866
|
};
|
|
161616
161867
|
}
|
|
@@ -163132,7 +163383,7 @@ function unmetWaitWarningFor(cause) {
|
|
|
163132
163383
|
if (cause === "cancelled") return CANCELLED_WAIT_WARNING;
|
|
163133
163384
|
return UNMET_WAIT_WARNING;
|
|
163134
163385
|
}
|
|
163135
|
-
var UNMET_NETWORK_WAIT_WARNING = "recorded, but the wait never held: `await-network-request` returned success:false, and at replay an unmet wait FAILS the step. `toolResult.
|
|
163386
|
+
var UNMET_NETWORK_WAIT_WARNING = "recorded, but the wait never held: `await-network-request` returned success:false, and at replay an unmet wait FAILS the step. `toolResult.nearMisses` lists the closest requests and the criteria each missed: fix the matcher, or record the action that sends the request, then record the wait again. Delete the failed step after `e2e-finish-recording`, not mid-recording";
|
|
163136
163387
|
var UNREADABLE_NETWORK_WAIT_WARNING = "recorded, but no armed capture layer was read near the deadline, so the request was never judged and whether it is sent is UNKNOWN: `toolResult.layers` says why. Get the layer back (for example call network-capture-start again once the app's JavaScript has loaded) and record the wait again. Do not delete the step on this warning alone";
|
|
163137
163388
|
var CANCELLED_NETWORK_WAIT_WARNING = "recorded, but this wait was cancelled before its deadline, so whether the request is sent is UNKNOWN: record the step again to find out";
|
|
163138
163389
|
function unmetNetworkWaitWarningFor(cause) {
|
|
@@ -167865,9 +168116,9 @@ async function runSnapshot(env, opts) {
|
|
|
167865
168116
|
}
|
|
167866
168117
|
};
|
|
167867
168118
|
}
|
|
167868
|
-
const
|
|
167869
|
-
const reason2 = `diff ${result.mismatchPercentage.toFixed(2)}% ${
|
|
167870
|
-
if (
|
|
168119
|
+
const within2 = result.mismatchPercentage <= opts.maxMismatch * (1 + 1e-14);
|
|
168120
|
+
const reason2 = `diff ${result.mismatchPercentage.toFixed(2)}% ${within2 ? "\u2264" : ">"} ${opts.maxMismatch}% (${key2})`;
|
|
168121
|
+
if (within2) {
|
|
167871
168122
|
return { status: "pass", reason: reason2, ...captureWarned };
|
|
167872
168123
|
}
|
|
167873
168124
|
const artifacts = {
|
|
@@ -168362,9 +168613,9 @@ function displayFlowName(params) {
|
|
|
168362
168613
|
const stem = params.e2e_test_path === void 0 ? void 0 : path66.basename(params.e2e_test_path, ".yaml");
|
|
168363
168614
|
return params.name || stem || params.e2e_test_path || "(unspecified)";
|
|
168364
168615
|
}
|
|
168365
|
-
function* walkSteps(steps,
|
|
168616
|
+
function* walkSteps(steps, within2 = "") {
|
|
168366
168617
|
for (const [i, step] of steps.entries()) {
|
|
168367
|
-
const where = `step ${i + 1}${
|
|
168618
|
+
const where = `step ${i + 1}${within2}`;
|
|
168368
168619
|
yield { step, where };
|
|
168369
168620
|
const inner = blockSteps(step);
|
|
168370
168621
|
if (inner) yield* walkSteps(inner, ` of the ${step.kind}: block at ${where}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.84",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "e952ba7dc326a7f7ca21f385fc5a786335f75424"
|
|
102
102
|
}
|
|
@@ -163,7 +163,7 @@ Keep the wait as a `tool:` step in YAML. Match on a part of the URL that contain
|
|
|
163
163
|
|
|
164
164
|
On Android, capture can slow the app. Start just before the triggering action and stop immediately after the wait, before checking the UI. For many related requests, keep capture running through the group and stop after the last wait. If a replay fails before the stop, stop capture before retrying.
|
|
165
165
|
|
|
166
|
-
If the recorder reports `NETWORK_CAPTURE_NOT_STARTED`, record the start and repeat the action. If it records a wait with `success: false`, read the warning. For `unmet`,
|
|
166
|
+
If the recorder reports `NETWORK_CAPTURE_NOT_STARTED`, record the start and repeat the action. If it records a wait with `success: false`, read the warning. For `unmet`, use `toolResult.nearMisses` and the request counts in `toolResult.note` to check the matcher and the recorded action. For `unreadable`, fix the layer named in the result before repeating the action. For `cancelled`, record the wait again. Remove superseded steps after `e2e-finish-recording`.
|
|
167
167
|
|
|
168
168
|
### Wrong turns
|
|
169
169
|
|