execbro 2.12.3 → 2.13.0
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/README.md +15 -1
- package/build/__tests__/unit/autoReconnectOptOut.test.js +3 -0
- package/build/__tests__/unit/autoReconnectOptOut.test.js.map +1 -1
- package/build/__tests__/unit/cdpCommand.test.d.ts +2 -0
- package/build/__tests__/unit/cdpCommand.test.d.ts.map +1 -0
- package/build/__tests__/unit/cdpCommand.test.js +84 -0
- package/build/__tests__/unit/cdpCommand.test.js.map +1 -0
- package/build/__tests__/unit/chromium.test.d.ts +2 -0
- package/build/__tests__/unit/chromium.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromium.test.js +118 -0
- package/build/__tests__/unit/chromium.test.js.map +1 -0
- package/build/__tests__/unit/chromiumDevice.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumDevice.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumDevice.test.js +115 -0
- package/build/__tests__/unit/chromiumDevice.test.js.map +1 -0
- package/build/__tests__/unit/chromiumDialogAnswer.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumDialogAnswer.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumDialogAnswer.test.js +71 -0
- package/build/__tests__/unit/chromiumDialogAnswer.test.js.map +1 -0
- package/build/__tests__/unit/chromiumDialogRaces.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumDialogRaces.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumDialogRaces.test.js +100 -0
- package/build/__tests__/unit/chromiumDialogRaces.test.js.map +1 -0
- package/build/__tests__/unit/chromiumDialogs.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumDialogs.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumDialogs.test.js +167 -0
- package/build/__tests__/unit/chromiumDialogs.test.js.map +1 -0
- package/build/__tests__/unit/chromiumDiscovery.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumDiscovery.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumDiscovery.test.js +302 -0
- package/build/__tests__/unit/chromiumDiscovery.test.js.map +1 -0
- package/build/__tests__/unit/chromiumDom.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumDom.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumDom.test.js +119 -0
- package/build/__tests__/unit/chromiumDom.test.js.map +1 -0
- package/build/__tests__/unit/chromiumGate.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumGate.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumGate.test.js +149 -0
- package/build/__tests__/unit/chromiumGate.test.js.map +1 -0
- package/build/__tests__/unit/chromiumInput.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumInput.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumInput.test.js +113 -0
- package/build/__tests__/unit/chromiumInput.test.js.map +1 -0
- package/build/__tests__/unit/chromiumKeys.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumKeys.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumKeys.test.js +26 -0
- package/build/__tests__/unit/chromiumKeys.test.js.map +1 -0
- package/build/__tests__/unit/chromiumScreen.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumScreen.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumScreen.test.js +390 -0
- package/build/__tests__/unit/chromiumScreen.test.js.map +1 -0
- package/build/__tests__/unit/chromiumStaleTarget.test.d.ts +2 -0
- package/build/__tests__/unit/chromiumStaleTarget.test.d.ts.map +1 -0
- package/build/__tests__/unit/chromiumStaleTarget.test.js +26 -0
- package/build/__tests__/unit/chromiumStaleTarget.test.js.map +1 -0
- package/build/__tests__/unit/connectionGaps.test.d.ts +2 -0
- package/build/__tests__/unit/connectionGaps.test.d.ts.map +1 -0
- package/build/__tests__/unit/connectionGaps.test.js +14 -0
- package/build/__tests__/unit/connectionGaps.test.js.map +1 -0
- package/build/__tests__/unit/contextPreambleGlobals.test.d.ts +2 -0
- package/build/__tests__/unit/contextPreambleGlobals.test.d.ts.map +1 -0
- package/build/__tests__/unit/contextPreambleGlobals.test.js +25 -0
- package/build/__tests__/unit/contextPreambleGlobals.test.js.map +1 -0
- package/build/__tests__/unit/deviceResolver.test.js +9 -0
- package/build/__tests__/unit/deviceResolver.test.js.map +1 -1
- package/build/__tests__/unit/electronLaunch.test.d.ts +2 -0
- package/build/__tests__/unit/electronLaunch.test.d.ts.map +1 -0
- package/build/__tests__/unit/electronLaunch.test.js +165 -0
- package/build/__tests__/unit/electronLaunch.test.js.map +1 -0
- package/build/__tests__/unit/fiberRoots.test.d.ts +2 -0
- package/build/__tests__/unit/fiberRoots.test.d.ts.map +1 -0
- package/build/__tests__/unit/fiberRoots.test.js +95 -0
- package/build/__tests__/unit/fiberRoots.test.js.map +1 -0
- package/build/__tests__/unit/fiberRootsDrift.test.d.ts +2 -0
- package/build/__tests__/unit/fiberRootsDrift.test.d.ts.map +1 -0
- package/build/__tests__/unit/fiberRootsDrift.test.js +23 -0
- package/build/__tests__/unit/fiberRootsDrift.test.js.map +1 -0
- package/build/__tests__/unit/hostAddress.test.d.ts +2 -0
- package/build/__tests__/unit/hostAddress.test.d.ts.map +1 -0
- package/build/__tests__/unit/hostAddress.test.js +38 -0
- package/build/__tests__/unit/hostAddress.test.js.map +1 -0
- package/build/__tests__/unit/measureComponent.test.js +1 -1
- package/build/__tests__/unit/measureComponent.test.js.map +1 -1
- package/build/__tests__/unit/networkInterceptorFetchMock.test.d.ts +2 -0
- package/build/__tests__/unit/networkInterceptorFetchMock.test.d.ts.map +1 -0
- package/build/__tests__/unit/networkInterceptorFetchMock.test.js +90 -0
- package/build/__tests__/unit/networkInterceptorFetchMock.test.js.map +1 -0
- package/build/__tests__/unit/networkMockTool.test.js +12 -1
- package/build/__tests__/unit/networkMockTool.test.js.map +1 -1
- package/build/__tests__/unit/pressKeyMobile.test.d.ts +2 -0
- package/build/__tests__/unit/pressKeyMobile.test.d.ts.map +1 -0
- package/build/__tests__/unit/pressKeyMobile.test.js +63 -0
- package/build/__tests__/unit/pressKeyMobile.test.js.map +1 -0
- package/build/__tests__/unit/reloadAppAutoConnect.test.js +4 -1
- package/build/__tests__/unit/reloadAppAutoConnect.test.js.map +1 -1
- package/build/__tests__/unit/tapAndroidSerial.test.js +16 -0
- package/build/__tests__/unit/tapAndroidSerial.test.js.map +1 -1
- package/build/core/android.d.ts +10 -0
- package/build/core/android.d.ts.map +1 -1
- package/build/core/android.js +17 -0
- package/build/core/android.js.map +1 -1
- package/build/core/appContext.d.ts.map +1 -1
- package/build/core/appContext.js +11 -13
- package/build/core/appContext.js.map +1 -1
- package/build/core/appDetection.d.ts.map +1 -1
- package/build/core/appDetection.js +7 -4
- package/build/core/appDetection.js.map +1 -1
- package/build/core/cdpCommand.d.ts +4 -0
- package/build/core/cdpCommand.d.ts.map +1 -0
- package/build/core/cdpCommand.js +58 -0
- package/build/core/cdpCommand.js.map +1 -0
- package/build/core/chromium.d.ts +157 -0
- package/build/core/chromium.d.ts.map +1 -0
- package/build/core/chromium.js +480 -0
- package/build/core/chromium.js.map +1 -0
- package/build/core/chromiumCapabilities.d.ts +11 -0
- package/build/core/chromiumCapabilities.d.ts.map +1 -0
- package/build/core/chromiumCapabilities.js +35 -0
- package/build/core/chromiumCapabilities.js.map +1 -0
- package/build/core/chromiumDialogAnswer.d.ts +11 -0
- package/build/core/chromiumDialogAnswer.d.ts.map +1 -0
- package/build/core/chromiumDialogAnswer.js +61 -0
- package/build/core/chromiumDialogAnswer.js.map +1 -0
- package/build/core/chromiumDialogs.d.ts +46 -0
- package/build/core/chromiumDialogs.d.ts.map +1 -0
- package/build/core/chromiumDialogs.js +88 -0
- package/build/core/chromiumDialogs.js.map +1 -0
- package/build/core/chromiumScreen.d.ts +97 -0
- package/build/core/chromiumScreen.d.ts.map +1 -0
- package/build/core/chromiumScreen.js +498 -0
- package/build/core/chromiumScreen.js.map +1 -0
- package/build/core/componentSearch.d.ts.map +1 -1
- package/build/core/componentSearch.js +7 -26
- package/build/core/componentSearch.js.map +1 -1
- package/build/core/componentSource.d.ts.map +1 -1
- package/build/core/componentSource.js +3 -11
- package/build/core/componentSource.js.map +1 -1
- package/build/core/componentTree.d.ts.map +1 -1
- package/build/core/componentTree.js +4 -18
- package/build/core/componentTree.js.map +1 -1
- package/build/core/connection.d.ts +13 -0
- package/build/core/connection.d.ts.map +1 -1
- package/build/core/connection.js +99 -18
- package/build/core/connection.js.map +1 -1
- package/build/core/connectionState.d.ts +2 -1
- package/build/core/connectionState.d.ts.map +1 -1
- package/build/core/connectionState.js +3 -0
- package/build/core/connectionState.js.map +1 -1
- package/build/core/deviceResolver.d.ts.map +1 -1
- package/build/core/deviceResolver.js +8 -5
- package/build/core/deviceResolver.js.map +1 -1
- package/build/core/electronLaunch.d.ts +25 -0
- package/build/core/electronLaunch.d.ts.map +1 -0
- package/build/core/electronLaunch.js +113 -0
- package/build/core/electronLaunch.js.map +1 -0
- package/build/core/errors.d.ts +1 -1
- package/build/core/errors.d.ts.map +1 -1
- package/build/core/errors.js.map +1 -1
- package/build/core/guides.d.ts.map +1 -1
- package/build/core/guides.js +9 -6
- package/build/core/guides.js.map +1 -1
- package/build/core/hostAddress.d.ts +6 -0
- package/build/core/hostAddress.d.ts.map +1 -0
- package/build/core/hostAddress.js +32 -0
- package/build/core/hostAddress.js.map +1 -0
- package/build/core/injected/fiberRoots.d.ts +2 -0
- package/build/core/injected/fiberRoots.d.ts.map +1 -0
- package/build/core/injected/fiberRoots.js +60 -0
- package/build/core/injected/fiberRoots.js.map +1 -0
- package/build/core/inputTarget.d.ts.map +1 -1
- package/build/core/inputTarget.js +4 -9
- package/build/core/inputTarget.js.map +1 -1
- package/build/core/inspector.d.ts.map +1 -1
- package/build/core/inspector.js +6 -22
- package/build/core/inspector.js.map +1 -1
- package/build/core/ios.d.ts +12 -0
- package/build/core/ios.d.ts.map +1 -1
- package/build/core/ios.js +32 -0
- package/build/core/ios.js.map +1 -1
- package/build/core/jsExecute.d.ts.map +1 -1
- package/build/core/jsExecute.js +20 -1
- package/build/core/jsExecute.js.map +1 -1
- package/build/core/measureComponent.d.ts.map +1 -1
- package/build/core/measureComponent.js +4 -8
- package/build/core/measureComponent.js.map +1 -1
- package/build/core/metro.d.ts +20 -1
- package/build/core/metro.d.ts.map +1 -1
- package/build/core/metro.js +146 -9
- package/build/core/metro.js.map +1 -1
- package/build/core/mockRules.d.ts +1 -0
- package/build/core/mockRules.d.ts.map +1 -1
- package/build/core/mockRules.js +8 -0
- package/build/core/mockRules.js.map +1 -1
- package/build/core/nativeLogs.js +1 -1
- package/build/core/nativeLogs.js.map +1 -1
- package/build/core/navigation.d.ts.map +1 -1
- package/build/core/navigation.js +4 -18
- package/build/core/navigation.js.map +1 -1
- package/build/core/networkInterceptor.d.ts +2 -2
- package/build/core/networkInterceptor.d.ts.map +1 -1
- package/build/core/networkInterceptor.js +90 -3
- package/build/core/networkInterceptor.js.map +1 -1
- package/build/core/pressables.d.ts.map +1 -1
- package/build/core/pressables.js +6 -13
- package/build/core/pressables.js.map +1 -1
- package/build/core/redux.d.ts.map +1 -1
- package/build/core/redux.js +6 -10
- package/build/core/redux.js.map +1 -1
- package/build/core/register.d.ts.map +1 -1
- package/build/core/register.js +5 -2
- package/build/core/register.js.map +1 -1
- package/build/core/rnGlobalsBootstrap.d.ts.map +1 -1
- package/build/core/rnGlobalsBootstrap.js +3 -1
- package/build/core/rnGlobalsBootstrap.js.map +1 -1
- package/build/core/screenLayout.d.ts.map +1 -1
- package/build/core/screenLayout.js +4 -13
- package/build/core/screenLayout.js.map +1 -1
- package/build/core/screenStaleness.d.ts.map +1 -1
- package/build/core/screenStaleness.js +2 -0
- package/build/core/screenStaleness.js.map +1 -1
- package/build/core/screenState.d.ts.map +1 -1
- package/build/core/screenState.js +4 -11
- package/build/core/screenState.js.map +1 -1
- package/build/core/swipeDiagnosis.d.ts.map +1 -1
- package/build/core/swipeDiagnosis.js +3 -10
- package/build/core/swipeDiagnosis.js.map +1 -1
- package/build/core/textEntry.d.ts +1 -1
- package/build/core/textEntry.d.ts.map +1 -1
- package/build/core/types.d.ts +4 -2
- package/build/core/types.d.ts.map +1 -1
- package/build/pro/chromiumKeys.d.ts +19 -0
- package/build/pro/chromiumKeys.d.ts.map +1 -0
- package/build/pro/chromiumKeys.js +68 -0
- package/build/pro/chromiumKeys.js.map +1 -0
- package/build/pro/chromiumSwipe.d.ts +35 -0
- package/build/pro/chromiumSwipe.d.ts.map +1 -0
- package/build/pro/chromiumSwipe.js +105 -0
- package/build/pro/chromiumSwipe.js.map +1 -0
- package/build/pro/chromiumTap.d.ts +12 -0
- package/build/pro/chromiumTap.d.ts.map +1 -0
- package/build/pro/chromiumTap.js +155 -0
- package/build/pro/chromiumTap.js.map +1 -0
- package/build/pro/tap.d.ts +1 -0
- package/build/pro/tap.d.ts.map +1 -1
- package/build/pro/tap.js +7 -1
- package/build/pro/tap.js.map +1 -1
- package/build/tools/componentTools.d.ts.map +1 -1
- package/build/tools/componentTools.js +31 -3
- package/build/tools/componentTools.js.map +1 -1
- package/build/tools/connectionTools.d.ts.map +1 -1
- package/build/tools/connectionTools.js +66 -28
- package/build/tools/connectionTools.js.map +1 -1
- package/build/tools/deviceTools.d.ts.map +1 -1
- package/build/tools/deviceTools.js +42 -1
- package/build/tools/deviceTools.js.map +1 -1
- package/build/tools/interactionTools.d.ts.map +1 -1
- package/build/tools/interactionTools.js +132 -7
- package/build/tools/interactionTools.js.map +1 -1
- package/build/tools/networkTools.d.ts.map +1 -1
- package/build/tools/networkTools.js +20 -5
- package/build/tools/networkTools.js.map +1 -1
- package/build/tools/screenshotTools.d.ts.map +1 -1
- package/build/tools/screenshotTools.js +452 -373
- package/build/tools/screenshotTools.js.map +1 -1
- package/package.json +1 -1
- package/tools.json +27 -1
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import { evaluateJson } from "./cdpCommand.js";
|
|
2
|
+
import { FIBER_ROOTS_JS } from "./injected/fiberRoots.js";
|
|
3
|
+
import { pxPerCss, chromiumViewport, collectDomTargets } from "./chromium.js";
|
|
4
|
+
export const SCREEN_NODE_CAP = 400;
|
|
5
|
+
export const DOM_HELPERS_JS = `
|
|
6
|
+
function norm(s) { return String(s == null ? "" : s).split(/\\s+/).join(" ").trim(); }
|
|
7
|
+
function testIdOf(el) { return el.getAttribute("data-testid") || el.getAttribute("data-test-id") || el.id || null; }
|
|
8
|
+
function reactProp(el, prefix) {
|
|
9
|
+
var ks = Object.keys(el);
|
|
10
|
+
for (var i = 0; i < ks.length; i++) if (ks[i].indexOf(prefix) === 0) return el[ks[i]];
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
function nameOf(t) {
|
|
14
|
+
if (!t || (typeof t !== "function" && typeof t !== "object")) return null;
|
|
15
|
+
return t.displayName || t.name || (t.render && (t.render.displayName || t.render.name)) || (t.type ? nameOf(t.type) : null) || null;
|
|
16
|
+
}
|
|
17
|
+
function componentOf(el) {
|
|
18
|
+
for (var f = reactProp(el, "__reactFiber$"); f; f = f.return) {
|
|
19
|
+
var n = typeof f.type === "string" ? null : nameOf(f.type);
|
|
20
|
+
if (n) return n;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
var NOT_TEXT = ["button", "submit", "reset", "checkbox", "radio", "file", "image", "range", "color", "hidden"];
|
|
25
|
+
function isEditable(el) {
|
|
26
|
+
if (!el || !el.tagName) return false;
|
|
27
|
+
if (el.isContentEditable || el.tagName === "TEXTAREA") return true;
|
|
28
|
+
return el.tagName === "INPUT" && NOT_TEXT.indexOf(String(el.type).toLowerCase()) < 0;
|
|
29
|
+
}
|
|
30
|
+
// A password never leaves the page, even into an agent's transcript.
|
|
31
|
+
function safeValue(el) {
|
|
32
|
+
if (el.isContentEditable) return el.innerText;
|
|
33
|
+
if (el.value == null) return null;
|
|
34
|
+
return String(el.type).toLowerCase() === "password" ? (el.value ? "[password]" : "") : String(el.value);
|
|
35
|
+
}
|
|
36
|
+
function labelOf(el) {
|
|
37
|
+
// A select's own <label> usually wraps it, so the label's innerText lists every option.
|
|
38
|
+
var s = el.getAttribute("aria-label") ||
|
|
39
|
+
(el.tagName === "SELECT" && el.selectedIndex >= 0 ? el.options[el.selectedIndex].text : "") ||
|
|
40
|
+
(el.labels && el.labels[0] ? el.labels[0].innerText : "") ||
|
|
41
|
+
(isEditable(el) || el.tagName === "SELECT" ? "" : el.innerText) ||
|
|
42
|
+
el.getAttribute("title") || el.getAttribute("alt");
|
|
43
|
+
if (!s && el.querySelector) { var img = el.querySelector("img[alt]"); s = img ? img.getAttribute("alt") : ""; }
|
|
44
|
+
s = norm(s);
|
|
45
|
+
return s ? s.slice(0, 80) : null;
|
|
46
|
+
}
|
|
47
|
+
function describe(el) {
|
|
48
|
+
var cls = typeof el.className === "string" ? el.className.split(/\\s+/).filter(Boolean).slice(0, 2) : [];
|
|
49
|
+
return "<" + el.tagName.toLowerCase() + (el.id ? "#" + el.id : "") + (cls.length ? "." + cls.join(".") : "") + ">";
|
|
50
|
+
}
|
|
51
|
+
// The part of el (or of box, a rect inside it) actually on screen: clipped to the
|
|
52
|
+
// viewport and to every overflow-clipping ancestor. null = not rendered,
|
|
53
|
+
// "off" = rendered but scrolled or clipped out of view.
|
|
54
|
+
function visibleRect(el, box) {
|
|
55
|
+
var b = box || el.getBoundingClientRect();
|
|
56
|
+
if (b.width <= 0 || b.height <= 0) return null;
|
|
57
|
+
if (el.checkVisibility && !el.checkVisibility({ opacityProperty: true, visibilityProperty: true })) return null;
|
|
58
|
+
var x1 = Math.max(b.left, 0), y1 = Math.max(b.top, 0), x2 = Math.min(b.right, innerWidth), y2 = Math.min(b.bottom, innerHeight);
|
|
59
|
+
// Only ancestors on the containing-block chain clip: a fixed element escapes
|
|
60
|
+
// every one, an absolute one skips static ancestors up to its positioned one.
|
|
61
|
+
// ponytail: transform / contain ancestors also make containing blocks; ignored.
|
|
62
|
+
var pos = getComputedStyle(el).position;
|
|
63
|
+
for (var p = el.parentElement; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {
|
|
64
|
+
if (pos === "fixed") break;
|
|
65
|
+
var s = getComputedStyle(p);
|
|
66
|
+
if (pos === "absolute" && s.position === "static") continue;
|
|
67
|
+
if (s.overflowX !== "visible" || s.overflowY !== "visible") {
|
|
68
|
+
var c = p.getBoundingClientRect();
|
|
69
|
+
x1 = Math.max(x1, c.left); y1 = Math.max(y1, c.top); x2 = Math.min(x2, c.right); y2 = Math.min(y2, c.bottom);
|
|
70
|
+
}
|
|
71
|
+
pos = s.position;
|
|
72
|
+
}
|
|
73
|
+
return x2 - x1 >= 1 && y2 - y1 >= 1 ? { x: x1, y: y1, w: x2 - x1, h: y2 - y1 } : "off";
|
|
74
|
+
}
|
|
75
|
+
// The element a wheel at (x, y) scrolls on this axis: the nearest ancestor whose
|
|
76
|
+
// overflow scrolls and whose content overflows, else the page if it scrolls. A
|
|
77
|
+
// scroller on the other axis is returned when nothing scrolls on this one, so the
|
|
78
|
+
// verdict can say "wrong axis" instead of "nothing here".
|
|
79
|
+
function canScroll(el, horizontal) {
|
|
80
|
+
var s = getComputedStyle(el);
|
|
81
|
+
return /(auto|scroll|overlay)/.test(horizontal ? s.overflowX : s.overflowY) &&
|
|
82
|
+
(horizontal ? el.scrollWidth > el.clientWidth : el.scrollHeight > el.clientHeight);
|
|
83
|
+
}
|
|
84
|
+
function scrollerAt(x, y, horizontal) {
|
|
85
|
+
var root = document.scrollingElement || document.documentElement;
|
|
86
|
+
var other = null;
|
|
87
|
+
for (var el = document.elementFromPoint(x, y); el && el !== root; el = el.parentElement) {
|
|
88
|
+
if (canScroll(el, horizontal)) return el;
|
|
89
|
+
if (!other && canScroll(el, !horizontal)) other = el;
|
|
90
|
+
}
|
|
91
|
+
function pageScrolls(h) {
|
|
92
|
+
var hidden = function (e) { var s = getComputedStyle(e); return (h ? s.overflowX : s.overflowY) === "hidden"; };
|
|
93
|
+
return !hidden(root) && !hidden(document.body) && (h ? root.scrollWidth > root.clientWidth : root.scrollHeight > root.clientHeight);
|
|
94
|
+
}
|
|
95
|
+
if (!document.elementFromPoint(x, y)) return null;
|
|
96
|
+
if (pageScrolls(horizontal)) return root;
|
|
97
|
+
return other || (pageScrolls(!horizontal) ? root : null);
|
|
98
|
+
}
|
|
99
|
+
function readScroller(el) {
|
|
100
|
+
if (!el || el.isConnected === false) return { container: null };
|
|
101
|
+
var isRoot = el === (document.scrollingElement || document.documentElement);
|
|
102
|
+
return {
|
|
103
|
+
container: isRoot ? "the page" : describe(el),
|
|
104
|
+
top: el.scrollTop, left: el.scrollLeft,
|
|
105
|
+
maxTop: isRoot || canScroll(el, false) ? Math.max(0, el.scrollHeight - el.clientHeight) : 0,
|
|
106
|
+
maxLeft: isRoot || canScroll(el, true) ? Math.max(0, el.scrollWidth - el.clientWidth) : 0,
|
|
107
|
+
// A scroller at its end hands the wheel on to the page; these show whether it moved.
|
|
108
|
+
// ponytail: only the scrolling element is watched, not intermediate scrollers in the chain.
|
|
109
|
+
page: isRoot ? undefined : { top: (document.scrollingElement || document.documentElement).scrollTop, left: (document.scrollingElement || document.documentElement).scrollLeft }
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
// Pressables with no other pressable inside. Only these own the text under them as
|
|
113
|
+
// their label: a click-wrapper (a modal backdrop, an app shell listening for clicks
|
|
114
|
+
// outside) would otherwise swallow every text line on the screen.
|
|
115
|
+
// ponytail: O(n^2) contains() over pressables; fine for hundreds, index by depth if pages get huge.
|
|
116
|
+
function leafPresses(els) {
|
|
117
|
+
return els.filter(function (el) { return !els.some(function (o) { return o !== el && el.contains(o); }); });
|
|
118
|
+
}
|
|
119
|
+
function joinRect(a, b) {
|
|
120
|
+
if (!a) return b;
|
|
121
|
+
if (!b) return a;
|
|
122
|
+
var x = Math.min(a.x, b.x), y = Math.min(a.y, b.y);
|
|
123
|
+
return { x: x, y: y, w: Math.max(a.x + a.w, b.x + b.w) - x, h: Math.max(a.y + a.h, b.y + b.h) - y };
|
|
124
|
+
}
|
|
125
|
+
// The DOM elements a component renders at its top level (through fragments and
|
|
126
|
+
// nested components, not into child elements).
|
|
127
|
+
function hostsOf(f, acc) {
|
|
128
|
+
for (var c = f.child; c; c = c.sibling) {
|
|
129
|
+
if (c.stateNode && c.stateNode.nodeType === 1) acc.push(c.stateNode);
|
|
130
|
+
else hostsOf(c, acc);
|
|
131
|
+
}
|
|
132
|
+
return acc;
|
|
133
|
+
}
|
|
134
|
+
// A wrapped text node's union box spans lines, and its centre can sit on an inline
|
|
135
|
+
// sibling: aim at the first line box with an area (a line boundary can leave an
|
|
136
|
+
// empty fragment first). One line, or no usable fragment: the union box.
|
|
137
|
+
function textBox(range) {
|
|
138
|
+
var rs = range.getClientRects();
|
|
139
|
+
if (rs.length > 1) for (var i = 0; i < rs.length; i++) if (rs[i].width > 0 && rs[i].height > 0) return rs[i];
|
|
140
|
+
return range.getBoundingClientRect();
|
|
141
|
+
}
|
|
142
|
+
// A password field's value stays in the page, in props as everywhere else.
|
|
143
|
+
function maskProps(props, isPassword) {
|
|
144
|
+
if (!isPassword) return props;
|
|
145
|
+
["value", "defaultValue"].forEach(function (k) { if (props[k] != null && props[k] !== "") props[k] = "[password]"; });
|
|
146
|
+
return props;
|
|
147
|
+
}
|
|
148
|
+
var STYLE_KEYS = ["display", "position", "flexDirection", "justifyContent", "alignItems", "gap", "padding", "margin",
|
|
149
|
+
"width", "height", "backgroundColor", "color", "fontSize", "fontWeight", "borderRadius", "opacity", "overflow", "zIndex"];
|
|
150
|
+
var STYLE_SKIP = ["", "0px", "none", "normal", "static", "visible", "auto", "rgba(0, 0, 0, 0)"];
|
|
151
|
+
function styleOf(el) {
|
|
152
|
+
var cs = getComputedStyle(el), out = {};
|
|
153
|
+
STYLE_KEYS.forEach(function (k) {
|
|
154
|
+
var v = cs[k];
|
|
155
|
+
if (v && STYLE_SKIP.indexOf(v) < 0 && !(k === "opacity" && v === "1") && !(k === "fontWeight" && v === "400")) out[k] = v;
|
|
156
|
+
});
|
|
157
|
+
return out;
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
const VIEWPORT_FIELDS_JS = `{ w: innerWidth, h: innerHeight, dpr: devicePixelRatio, hidden: document.visibilityState === "hidden" }`;
|
|
161
|
+
export function buildScreenCollectJs() {
|
|
162
|
+
return `(function () {
|
|
163
|
+
${DOM_HELPERS_JS}
|
|
164
|
+
var CAP = ${SCREEN_NODE_CAP};
|
|
165
|
+
var PRESS_SEL = "button, a[href], summary, select, input:not([type=hidden]), textarea, [contenteditable=''], [contenteditable=true], " +
|
|
166
|
+
"[role=button], [role=link], [role=checkbox], [role=switch], [role=tab], [role=menuitem], [role=option], [role=radio], [onclick]";
|
|
167
|
+
var OVERLAY_SEL = "dialog[open], [role=dialog], [role=alertdialog], [aria-modal=true]";
|
|
168
|
+
var SKIP_TEXT = ["SCRIPT", "STYLE", "NOSCRIPT", "TEMPLATE", "TEXTAREA", "OPTION", "SELECT"];
|
|
169
|
+
var vp = ${VIEWPORT_FIELDS_JS};
|
|
170
|
+
var all = document.body ? Array.prototype.slice.call(document.body.querySelectorAll("*")) : [];
|
|
171
|
+
function isPress(el) {
|
|
172
|
+
// Not el.onclick: a handler assigned as a property is usually delegation
|
|
173
|
+
// on a container (FluentTalk's #root has one), not a target.
|
|
174
|
+
if (el.matches(PRESS_SEL)) return true;
|
|
175
|
+
var p = reactProp(el, "__reactProps$");
|
|
176
|
+
return !!(p && (p.onClick || p.onMouseDown || p.onMouseUp || p.onPointerDown || p.onPointerUp));
|
|
177
|
+
}
|
|
178
|
+
var pressEls = all.filter(isPress);
|
|
179
|
+
var pressSet = new Set(leafPresses(pressEls));
|
|
180
|
+
function insidePress(el) { for (var p = el; p; p = p.parentElement) if (pressSet.has(p)) return true; return false; }
|
|
181
|
+
function shown(el) { var r = visibleRect(el); return r && r !== "off"; }
|
|
182
|
+
var layers = all.filter(function (el) { return el.matches(OVERLAY_SEL) && shown(el); });
|
|
183
|
+
layers = layers.filter(function (el) { return !layers.some(function (o) { return o !== el && o.contains(el); }); });
|
|
184
|
+
var overlays = layers.map(function (el) {
|
|
185
|
+
var h = el.querySelector("h1, h2, h3, [role=heading]");
|
|
186
|
+
return {
|
|
187
|
+
type: el.getAttribute("role") === "alertdialog" ? "Alert" : "Modal",
|
|
188
|
+
title: norm(el.getAttribute("aria-label") || (h ? h.innerText : "")).slice(0, 80) || null
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
var found = [], offscreen = 0;
|
|
192
|
+
function consider(kind, el, box, extra) {
|
|
193
|
+
var r = visibleRect(el, box);
|
|
194
|
+
if (r === "off") { offscreen++; return; }
|
|
195
|
+
if (r) found.push({ kind: kind, el: el, rect: r, extra: extra });
|
|
196
|
+
}
|
|
197
|
+
pressEls.forEach(function (el) {
|
|
198
|
+
var info = { label: labelOf(el), component: componentOf(el), testID: testIdOf(el) };
|
|
199
|
+
if (isEditable(el)) info.input = { value: safeValue(el) || null, placeholder: el.getAttribute("placeholder") };
|
|
200
|
+
var type = String(el.type || "").toLowerCase();
|
|
201
|
+
if (el.tagName === "INPUT" && (type === "checkbox" || type === "radio")) info.checked = !!el.checked;
|
|
202
|
+
else if (el.hasAttribute("aria-checked")) info.checked = el.getAttribute("aria-checked") === "true";
|
|
203
|
+
consider("press", el, null, info);
|
|
204
|
+
});
|
|
205
|
+
Array.prototype.slice.call(document.querySelectorAll("img, [role=img]")).forEach(function (el) {
|
|
206
|
+
if (!insidePress(el)) consider("img", el, null, { src: el.getAttribute("src"), alt: el.getAttribute("alt") || el.getAttribute("aria-label") });
|
|
207
|
+
});
|
|
208
|
+
if (document.body) {
|
|
209
|
+
var walker = document.createTreeWalker(document.body, NodeFilter.SHOW_TEXT);
|
|
210
|
+
for (var t = walker.nextNode(); t; t = walker.nextNode()) {
|
|
211
|
+
var s = norm(t.nodeValue), pe = t.parentElement;
|
|
212
|
+
if (!s || !pe || SKIP_TEXT.indexOf(pe.tagName) >= 0 || insidePress(pe)) continue;
|
|
213
|
+
var range = document.createRange();
|
|
214
|
+
range.selectNodeContents(t);
|
|
215
|
+
consider("text", pe, textBox(range), { text: s });
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
// Pass 1: what a tap at each visible centre would actually hit. The hit is
|
|
219
|
+
// promoted to its outermost positioned ancestor, so everything under one sheet
|
|
220
|
+
// reports the same layer.
|
|
221
|
+
// ponytail: a later layer that contains an earlier one is not merged; merge if two groups for one sheet ever show up.
|
|
222
|
+
found.forEach(function (n) {
|
|
223
|
+
var hit = document.elementFromPoint(n.rect.x + n.rect.w / 2, n.rect.y + n.rect.h / 2);
|
|
224
|
+
if (!hit || hit === n.el || n.el.contains(hit) || hit.contains(n.el)) return;
|
|
225
|
+
var layer = hit;
|
|
226
|
+
for (var p = hit.parentElement; p && p !== document.body && !p.contains(n.el); p = p.parentElement) {
|
|
227
|
+
var pos = getComputedStyle(p).position;
|
|
228
|
+
if (pos === "fixed" || pos === "absolute" || pos === "sticky") layer = p;
|
|
229
|
+
}
|
|
230
|
+
var i = -1;
|
|
231
|
+
for (var j = 0; j < layers.length; j++) if (layers[j] === layer || layers[j].contains(layer)) { i = j; break; }
|
|
232
|
+
if (i < 0) { layers.push(layer); overlays.push({ type: "Unknown", title: describe(layer) }); i = layers.length - 1; }
|
|
233
|
+
n.coveredBy = i;
|
|
234
|
+
});
|
|
235
|
+
// Pass 2: membership, pressables first so the cap drops text before targets.
|
|
236
|
+
var rank = { press: 0, img: 1, text: 2 };
|
|
237
|
+
found.sort(function (a, b) { return rank[a.kind] - rank[b.kind]; });
|
|
238
|
+
var nodes = [], dropped = 0;
|
|
239
|
+
found.forEach(function (n) {
|
|
240
|
+
if (nodes.length >= CAP) { dropped++; return; }
|
|
241
|
+
var home = null;
|
|
242
|
+
for (var j = 0; j < layers.length; j++) if (layers[j] === n.el || layers[j].contains(n.el)) { home = j; break; }
|
|
243
|
+
var covered = n.coveredBy !== undefined;
|
|
244
|
+
var node = { kind: n.kind, rect: n.rect, overlay: covered ? n.coveredBy : home, covered: covered };
|
|
245
|
+
for (var k in n.extra) node[k] = n.extra[k];
|
|
246
|
+
nodes.push(node);
|
|
247
|
+
});
|
|
248
|
+
return JSON.stringify({ viewport: vp, url: location.href, title: document.title, overlays: overlays, nodes: nodes, offscreen: offscreen, dropped: dropped });
|
|
249
|
+
})()`;
|
|
250
|
+
}
|
|
251
|
+
function routeOf(url) {
|
|
252
|
+
try {
|
|
253
|
+
const u = new URL(url);
|
|
254
|
+
const name = u.protocol === "data:" ? "(data: URL)" : u.pathname + u.hash;
|
|
255
|
+
const params = [...u.searchParams.keys()].length > 0 ? Object.fromEntries(u.searchParams) : null;
|
|
256
|
+
return { name, params, stack: [name] };
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
export function rawToScreenState(raw) {
|
|
263
|
+
const k = pxPerCss(raw.viewport);
|
|
264
|
+
const geom = (r) => ({
|
|
265
|
+
center: { x: Math.round((r.x + r.w / 2) * k), y: Math.round((r.y + r.h / 2) * k) },
|
|
266
|
+
bounds: { x: Math.round(r.x * k), y: Math.round(r.y * k), width: Math.round(r.w * k), height: Math.round(r.h * k) },
|
|
267
|
+
});
|
|
268
|
+
const overlays = raw.overlays.map((o) => ({ type: o.type, title: o.title, pressables: [], texts: [], images: [] }));
|
|
269
|
+
const ss = { route: routeOf(raw.url), overlays, pressables: [], texts: [], images: [], notes: [] };
|
|
270
|
+
for (const n of raw.nodes) {
|
|
271
|
+
const g = geom(n.rect);
|
|
272
|
+
const blocked = n.covered ? { blockedByOverlay: true } : {};
|
|
273
|
+
const home = n.overlay !== null && !n.covered ? overlays[n.overlay] : null;
|
|
274
|
+
if (n.kind === "press") {
|
|
275
|
+
const p = {
|
|
276
|
+
...g,
|
|
277
|
+
...blocked,
|
|
278
|
+
label: n.label ?? null,
|
|
279
|
+
component: n.component ?? null,
|
|
280
|
+
testID: n.testID ?? null,
|
|
281
|
+
...(n.input ? { isInput: true, inputValue: n.input.value, inputPlaceholder: n.input.placeholder } : {}),
|
|
282
|
+
...(n.checked !== undefined ? { switchValue: n.checked } : {}),
|
|
283
|
+
};
|
|
284
|
+
(home ? home.pressables : ss.pressables).push(p);
|
|
285
|
+
}
|
|
286
|
+
else if (n.kind === "text") {
|
|
287
|
+
(home ? home.texts : ss.texts).push({ ...g, ...blocked, text: n.text ?? "" });
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
(home ? home.images : ss.images).push({ ...g, ...blocked, src: n.src ?? null, alt: n.alt ?? null });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const notes = ss.notes;
|
|
294
|
+
notes.push(`chromium page "${raw.title}": the route is the page location, so a router that never changes the URL is not seen.`);
|
|
295
|
+
if (raw.viewport.hidden)
|
|
296
|
+
notes.push("The window is hidden (document.visibilityState). Nothing listed is visible or tappable until it is shown.");
|
|
297
|
+
if (raw.offscreen > 0)
|
|
298
|
+
notes.push(`${raw.offscreen} more element(s) are scrolled or clipped out of view. tap(testID/text/component) scrolls its target into view first.`);
|
|
299
|
+
if (raw.dropped > 0)
|
|
300
|
+
notes.push(`${raw.dropped} element(s) past the ${SCREEN_NODE_CAP}-element cap are not listed.`);
|
|
301
|
+
return ss;
|
|
302
|
+
}
|
|
303
|
+
export async function chromiumScreenState(app) {
|
|
304
|
+
return rawToScreenState(await evaluateJson(app.ws, buildScreenCollectJs()));
|
|
305
|
+
}
|
|
306
|
+
export const LAYOUT_NODE_CAP = 500;
|
|
307
|
+
export function buildLayoutCollectJs(extended) {
|
|
308
|
+
return `(function () {
|
|
309
|
+
${FIBER_ROOTS_JS}
|
|
310
|
+
${DOM_HELPERS_JS}
|
|
311
|
+
var vp = ${VIEWPORT_FIELDS_JS};
|
|
312
|
+
var roots = __eb_fiberRoots(true);
|
|
313
|
+
if (roots.length === 0) return JSON.stringify({ viewport: vp, nodes: [], offscreen: 0, dropped: 0, error: "No React root found on this page. get_screen_state lists its DOM elements without React." });
|
|
314
|
+
var out = [], offscreen = 0, dropped = 0;
|
|
315
|
+
function walk(f, depth) {
|
|
316
|
+
for (; f; f = f.sibling) {
|
|
317
|
+
var name = typeof f.type === "string" ? null : nameOf(f.type);
|
|
318
|
+
if (!name) { walk(f.child, depth); continue; }
|
|
319
|
+
var hs = hostsOf(f, []), r = null, any = false;
|
|
320
|
+
hs.forEach(function (h) { var v = visibleRect(h); if (v === "off") any = true; else if (v) r = joinRect(r, v); });
|
|
321
|
+
if (!r) { if (any) offscreen++; continue; }
|
|
322
|
+
if (out.length >= ${LAYOUT_NODE_CAP}) { dropped++; continue; }
|
|
323
|
+
var node = { depth: depth, name: name, rect: r };
|
|
324
|
+
var tid = hs[0] && testIdOf(hs[0]);
|
|
325
|
+
if (tid) node.testID = tid;
|
|
326
|
+
var txt = hs.length === 1 ? norm(hs[0].innerText) : "";
|
|
327
|
+
if (txt && txt.length <= 60) node.text = txt;
|
|
328
|
+
if (${extended} && hs[0]) node.style = styleOf(hs[0]);
|
|
329
|
+
out.push(node);
|
|
330
|
+
walk(f.child, depth + 1);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
roots.forEach(function (root) { walk(root.current, 0); });
|
|
334
|
+
return JSON.stringify({ viewport: vp, nodes: out, offscreen: offscreen, dropped: dropped });
|
|
335
|
+
})()`;
|
|
336
|
+
}
|
|
337
|
+
export function formatChromiumLayout(raw, summary) {
|
|
338
|
+
const k = pxPerCss(raw.viewport);
|
|
339
|
+
const px = (v) => Math.round(v * k);
|
|
340
|
+
if (summary) {
|
|
341
|
+
const counts = new Map();
|
|
342
|
+
for (const n of raw.nodes)
|
|
343
|
+
counts.set(n.name, (counts.get(n.name) ?? 0) + 1);
|
|
344
|
+
return [...counts].sort((a, b) => b[1] - a[1]).map(([name, c]) => `${name}: ${c}`).join("\n");
|
|
345
|
+
}
|
|
346
|
+
const lines = raw.nodes.map((n, i) => {
|
|
347
|
+
const next = raw.nodes[i + 1];
|
|
348
|
+
const text = n.text && !(next && next.depth > n.depth && next.text === n.text) ? ` "${n.text}"` : "";
|
|
349
|
+
const style = n.style && Object.keys(n.style).length > 0
|
|
350
|
+
? ` {${Object.entries(n.style).map(([a, b]) => `${a}: ${b}`).join(", ")}}`
|
|
351
|
+
: "";
|
|
352
|
+
return `${" ".repeat(n.depth)}${n.name} (${px(n.rect.x)},${px(n.rect.y)} ${px(n.rect.w)}x${px(n.rect.h)})` +
|
|
353
|
+
`${n.testID ? ` testID="${n.testID}"` : ""}${text}${style}`;
|
|
354
|
+
});
|
|
355
|
+
if (raw.viewport.hidden)
|
|
356
|
+
lines.push("", "The window is hidden (document.visibilityState). Nothing listed is visible until it is shown.");
|
|
357
|
+
if (raw.offscreen > 0)
|
|
358
|
+
lines.push("", `${raw.offscreen} component(s) are scrolled or clipped out of view and not listed.`);
|
|
359
|
+
if (raw.dropped > 0)
|
|
360
|
+
lines.push("", `${raw.dropped} component(s) past the ${LAYOUT_NODE_CAP}-component cap are not listed.`);
|
|
361
|
+
return lines.join("\n");
|
|
362
|
+
}
|
|
363
|
+
export async function chromiumScreenLayout(app, opts) {
|
|
364
|
+
const raw = await evaluateJson(app.ws, buildLayoutCollectJs(opts.extended));
|
|
365
|
+
if (raw.error)
|
|
366
|
+
throw new Error(raw.error);
|
|
367
|
+
return formatChromiumLayout(raw, opts.summary);
|
|
368
|
+
}
|
|
369
|
+
export function buildInspectJs(cssX, cssY, includeProps) {
|
|
370
|
+
return `(function () {
|
|
371
|
+
${DOM_HELPERS_JS}
|
|
372
|
+
var vp = ${VIEWPORT_FIELDS_JS};
|
|
373
|
+
var el = document.elementFromPoint(${cssX}, ${cssY});
|
|
374
|
+
if (!el) return JSON.stringify({ viewport: vp, error: "Nothing at this point: it is outside the viewport." });
|
|
375
|
+
function box(e) { var r = e.getBoundingClientRect(); return { x: r.x, y: r.y, w: r.width, h: r.height }; }
|
|
376
|
+
function unionBox(els) { var r = null; els.forEach(function (e) { var b = box(e); if (b.w > 0 || b.h > 0) r = joinRect(r, b); }); return r; }
|
|
377
|
+
function propsOf(mp) {
|
|
378
|
+
var out = {};
|
|
379
|
+
Object.keys(mp || {}).forEach(function (k) {
|
|
380
|
+
if (k === "children") return;
|
|
381
|
+
var v = mp[k];
|
|
382
|
+
if (typeof v === "function") out[k] = "[Function" + (v.name ? " " + v.name : "") + "]";
|
|
383
|
+
else if (v && typeof v === "object") {
|
|
384
|
+
if (v.nodeType === 1) { out[k] = describe(v); return; }
|
|
385
|
+
try {
|
|
386
|
+
var s = JSON.stringify(v);
|
|
387
|
+
out[k] = s.length > 200 ? (Array.isArray(v) ? "[Array(" + v.length + ")]" : "[Object]") : v;
|
|
388
|
+
} catch (e) { out[k] = "[Object]"; }
|
|
389
|
+
} else out[k] = v;
|
|
390
|
+
});
|
|
391
|
+
return out;
|
|
392
|
+
}
|
|
393
|
+
var res = { viewport: vp, element: describe(el), testID: testIdOf(el), frame: box(el), style: styleOf(el), hierarchy: [] };
|
|
394
|
+
var named = null, seen = {};
|
|
395
|
+
for (var f = reactProp(el, "__reactFiber$"); f; f = f.return) {
|
|
396
|
+
var n = typeof f.type === "string" ? null : nameOf(f.type);
|
|
397
|
+
if (!n) continue;
|
|
398
|
+
if (!named) named = f;
|
|
399
|
+
if (seen[n] || res.hierarchy.length >= 15) continue;
|
|
400
|
+
seen[n] = true;
|
|
401
|
+
res.hierarchy.push({ name: n, frame: unionBox(hostsOf(f, [])) });
|
|
402
|
+
}
|
|
403
|
+
if (named) {
|
|
404
|
+
res.component = nameOf(named.type);
|
|
405
|
+
var src = named._debugSource;
|
|
406
|
+
if (src && src.fileName) res.source = { file: src.fileName, line: src.lineNumber, column: src.columnNumber };
|
|
407
|
+
if (${includeProps}) res.props = maskProps(propsOf(named.memoizedProps), el.tagName === "INPUT" && String(el.type).toLowerCase() === "password");
|
|
408
|
+
} else {
|
|
409
|
+
for (var p = el.parentElement; p && res.hierarchy.length < 8; p = p.parentElement) res.hierarchy.push({ name: describe(p), frame: box(p) });
|
|
410
|
+
}
|
|
411
|
+
return JSON.stringify(res);
|
|
412
|
+
})()`;
|
|
413
|
+
}
|
|
414
|
+
export function formatChromiumInspect(raw, includeFrame) {
|
|
415
|
+
const k = pxPerCss(raw.viewport);
|
|
416
|
+
const frame = (r) => ({ x: Math.round(r.x * k), y: Math.round(r.y * k), width: Math.round(r.w * k), height: Math.round(r.h * k) });
|
|
417
|
+
const out = {
|
|
418
|
+
element: raw.element,
|
|
419
|
+
...(raw.component ? { component: raw.component } : {}),
|
|
420
|
+
...(raw.testID ? { testID: raw.testID } : {}),
|
|
421
|
+
...(includeFrame ? { frame: frame(raw.frame) } : {}),
|
|
422
|
+
style: raw.style,
|
|
423
|
+
...(raw.props ? { props: raw.props } : {}),
|
|
424
|
+
hierarchy: raw.hierarchy.map((h) => (includeFrame && h.frame ? { name: h.name, frame: frame(h.frame) } : { name: h.name })),
|
|
425
|
+
};
|
|
426
|
+
const source = raw.source
|
|
427
|
+
? `Source: ${raw.source.file}:${raw.source.line}:${raw.source.column}`
|
|
428
|
+
: raw.component
|
|
429
|
+
? "Source: unavailable on chromium (React 19 records no _debugSource). Grep the component name to find its file."
|
|
430
|
+
: "Source: no React component at this point; the hierarchy lists DOM ancestors.";
|
|
431
|
+
return `${JSON.stringify(out, null, 2)}\n\n${source}`;
|
|
432
|
+
}
|
|
433
|
+
export async function chromiumInspectAtPoint(app, x, y, opts) {
|
|
434
|
+
const k = pxPerCss(await chromiumViewport(app));
|
|
435
|
+
const raw = await evaluateJson(app.ws, buildInspectJs(x / k, y / k, opts.includeProps));
|
|
436
|
+
if (raw.error)
|
|
437
|
+
throw new Error(raw.error);
|
|
438
|
+
return formatChromiumInspect(raw, opts.includeFrame);
|
|
439
|
+
}
|
|
440
|
+
export function formatChromiumMeasure(name, rect, vp, visible) {
|
|
441
|
+
const k = pxPerCss(vp);
|
|
442
|
+
const fmt = (r) => {
|
|
443
|
+
const [x, y, w, h] = [r.x, r.y, r.w, r.h].map((v) => v * k);
|
|
444
|
+
return { frame: `(${x.toFixed(1)}, ${y.toFixed(1)}) ${w.toFixed(1)}x${h.toFixed(1)}`, centre: `(${(x + w / 2).toFixed(1)}, ${(y + h / 2).toFixed(1)})` };
|
|
445
|
+
};
|
|
446
|
+
const full = fmt(rect);
|
|
447
|
+
const lines = [`Component: ${name}`, `Frame: ${full.frame}`, `Center: ${full.centre}`];
|
|
448
|
+
if (visible === "off") {
|
|
449
|
+
lines.push("It is scrolled or clipped out of view (outside the viewport or its scroll container), so a tap at this centre lands on whatever is shown there. tap({ component }) scrolls it into view first.");
|
|
450
|
+
}
|
|
451
|
+
else if (visible && (Math.abs(visible.w - rect.w) >= 1 || Math.abs(visible.h - rect.h) >= 1)) {
|
|
452
|
+
const v = fmt(visible);
|
|
453
|
+
lines.push(`Visible part: ${v.frame}`, `Visible centre: ${v.centre} (the element is partly scrolled or clipped; tap here, not at Center)`);
|
|
454
|
+
}
|
|
455
|
+
return lines.join("\n");
|
|
456
|
+
}
|
|
457
|
+
export function measureRangeError(name, index, total) {
|
|
458
|
+
return total === 0
|
|
459
|
+
? `No visible element renders component "${name}". find_components lists component names.`
|
|
460
|
+
: `index ${index} is out of range: ${total} visible instance(s) of "${name}".`;
|
|
461
|
+
}
|
|
462
|
+
function buildMeasureJs(i) {
|
|
463
|
+
return `(function () {
|
|
464
|
+
${DOM_HELPERS_JS}
|
|
465
|
+
var el = (globalThis.__eb_domTargets || [])[${i}];
|
|
466
|
+
if (!el) return JSON.stringify(null);
|
|
467
|
+
var r = el.getBoundingClientRect();
|
|
468
|
+
return JSON.stringify({ rect: { x: r.x, y: r.y, w: r.width, h: r.height }, visible: visibleRect(el) });
|
|
469
|
+
})()`;
|
|
470
|
+
}
|
|
471
|
+
export async function chromiumMeasure(app, componentName, index) {
|
|
472
|
+
const found = await collectDomTargets(app, { mode: "tap", component: componentName });
|
|
473
|
+
const m = index >= 0 && index < found.total
|
|
474
|
+
? await evaluateJson(app.ws, buildMeasureJs(index))
|
|
475
|
+
: null;
|
|
476
|
+
if (!m)
|
|
477
|
+
throw new Error(measureRangeError(componentName, index, found.total));
|
|
478
|
+
return formatChromiumMeasure(componentName, m.rect, found.viewport, m.visible);
|
|
479
|
+
}
|
|
480
|
+
export function buildScrollProbeJs(x, y, horizontal) {
|
|
481
|
+
return `(function () {
|
|
482
|
+
${DOM_HELPERS_JS}
|
|
483
|
+
var el = scrollerAt(${x}, ${y}, ${horizontal});
|
|
484
|
+
globalThis.__eb_scroller = el;
|
|
485
|
+
return JSON.stringify(readScroller(el));
|
|
486
|
+
})()`;
|
|
487
|
+
}
|
|
488
|
+
export const SCROLL_READ_JS = `(function () {
|
|
489
|
+
${DOM_HELPERS_JS}
|
|
490
|
+
return JSON.stringify(readScroller(globalThis.__eb_scroller));
|
|
491
|
+
})()`;
|
|
492
|
+
export const ACTIVE_ELEMENT_JS = `(function () {
|
|
493
|
+
${DOM_HELPERS_JS}
|
|
494
|
+
var el = document.activeElement;
|
|
495
|
+
if (!el || el === document.body || el === document.documentElement) return JSON.stringify(null);
|
|
496
|
+
return JSON.stringify({ element: describe(el), testID: testIdOf(el), label: labelOf(el), placeholder: el.getAttribute("placeholder"), value: isEditable(el) ? safeValue(el) : null });
|
|
497
|
+
})()`;
|
|
498
|
+
//# sourceMappingURL=chromiumScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chromiumScreen.js","sourceRoot":"","sources":["../../src/core/chromiumScreen.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,iBAAiB,EAAyB,MAAM,eAAe,CAAC;AAMrG,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAMnC,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AiB,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;IACtF,MAAM,CAAC,GAAG,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,KAAK;QACvC,CAAC,CAAC,MAAM,YAAY,CAA4D,GAAG,CAAC,EAAE,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC;QAC9G,CAAC,CAAC,IAAI,CAAC;IACX,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9E,OAAO,qBAAqB,CAAC,aAAa,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AACnF,CAAC;AAGD,MAAM,UAAU,kBAAkB,CAAC,CAAS,EAAE,CAAS,EAAE,UAAmB;IACxE,OAAO;MACL,cAAc;0BACM,CAAC,KAAK,CAAC,KAAK,UAAU;;;KAG3C,CAAC;AACN,CAAC;AAGD,MAAM,CAAC,MAAM,cAAc,GAAG;MACxB,cAAc;;KAEf,CAAC;AAGN,MAAM,CAAC,MAAM,iBAAiB,GAAG;MAC3B,cAAc;;;;KAIf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentSearch.d.ts","sourceRoot":"","sources":["../../src/core/componentSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"componentSearch.d.ts","sourceRoot":"","sources":["../../src/core/componentSearch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAqDlD,wBAAsB,gBAAgB,CAClC,aAAa,EAAE,MAAM,EACrB,OAAO,GAAE;IACL,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACjB,GACP,OAAO,CAAC,eAAe,CAAC,CAiZ1B;AAKD,wBAAsB,cAAc,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACL,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACpB,GACP,OAAO,CAAC,eAAe,CAAC,CAmJ1B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { executeInApp, delay } from "./jsExecute.js";
|
|
2
2
|
import { formatSummaryCompact } from "./screenLayout.js";
|
|
3
3
|
import { VISIBILITY_HELPERS_JS } from "./injected/visibility.js";
|
|
4
|
+
import { FIBER_ROOTS_JS } from "./injected/fiberRoots.js";
|
|
4
5
|
function formatFoundComponentsCompact(components) {
|
|
5
6
|
const lines = ["#found{component,path,depth,key,layout}"];
|
|
6
7
|
for (const c of components) {
|
|
@@ -19,19 +20,9 @@ export async function inspectComponent(componentName, options = {}) {
|
|
|
19
20
|
const expression = `
|
|
20
21
|
(function() {
|
|
21
22
|
const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (hook.getFiberRoots) {
|
|
26
|
-
roots = [...(hook.getFiberRoots(1) || [])];
|
|
27
|
-
}
|
|
28
|
-
if (roots.length === 0 && hook.renderers) {
|
|
29
|
-
for (const [id] of hook.renderers) {
|
|
30
|
-
const r = hook.getFiberRoots ? [...(hook.getFiberRoots(id) || [])] : [];
|
|
31
|
-
if (r.length > 0) { roots = r; break; }
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
if (roots.length === 0) return { error: 'No fiber roots found.' };
|
|
23
|
+
${FIBER_ROOTS_JS}
|
|
24
|
+
const roots = __eb_fiberRoots(false);
|
|
25
|
+
if (roots.length === 0) return { error: __eb_noRootsReason() };
|
|
35
26
|
|
|
36
27
|
const targetName = '${escapedName}';
|
|
37
28
|
const targetIndex = ${index};
|
|
@@ -419,19 +410,9 @@ export async function findComponents(pattern, options = {}) {
|
|
|
419
410
|
const expression = `
|
|
420
411
|
(function() {
|
|
421
412
|
const hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
if (hook.getFiberRoots) {
|
|
426
|
-
roots = [...(hook.getFiberRoots(1) || [])];
|
|
427
|
-
}
|
|
428
|
-
if (roots.length === 0 && hook.renderers) {
|
|
429
|
-
for (const [id] of hook.renderers) {
|
|
430
|
-
const r = hook.getFiberRoots ? [...(hook.getFiberRoots(id) || [])] : [];
|
|
431
|
-
if (r.length > 0) { roots = r; break; }
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
if (roots.length === 0) return { error: 'No fiber roots found.' };
|
|
413
|
+
${FIBER_ROOTS_JS}
|
|
414
|
+
const roots = __eb_fiberRoots(false);
|
|
415
|
+
if (roots.length === 0) return { error: __eb_noRootsReason() };
|
|
435
416
|
|
|
436
417
|
const pattern = '${escapedPattern}';
|
|
437
418
|
const regex = new RegExp(pattern, 'i');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentSearch.js","sourceRoot":"","sources":["../../src/core/componentSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"componentSearch.js","sourceRoot":"","sources":["../../src/core/componentSearch.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAe1D,SAAS,4BAA4B,CAAC,UAA4B;IAC9D,MAAM,KAAK,GAAa,CAAC,yCAAyC,CAAC,CAAC;IACpE,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM;YACnB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;iBACnB,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;iBAC5B,IAAI,CAAC,GAAG,CAAC;YAChB,CAAC,CAAC,EAAE,CAAC;QACT,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC;AAuBD,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,aA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AO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,MAAM,CAAC,OAAO,YAAY,MAAM,CAAC,KAAK,KAAK,OAAO,EAAE,EAAE,CAAC;gBACvG,CAAC;YACL,CAAC;QACL,CAAC;QAAC,MAAM,CAAC;QAET,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"componentSource.d.ts","sourceRoot":"","sources":["../../src/core/componentSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"componentSource.d.ts","sourceRoot":"","sources":["../../src/core/componentSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3E,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAcD,wBAAgB,6BAA6B,IAAI,MAAM,CAmEtD;AAiBD,wBAAgB,gCAAgC,CAC5C,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,YAAY,GAAE,MAAW,GAC1B,MAAM,CAwGR;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC3B,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC9B;AASD,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CA6DhG"}
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import { parseStackString, symbolicateFrames } from "./symbolicate.js";
|
|
2
|
+
import { FIBER_ROOTS_JS } from "./injected/fiberRoots.js";
|
|
2
3
|
const ROOTS_SNIPPET = `
|
|
3
4
|
var hook = globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (hook.renderers) {
|
|
7
|
-
for (var entry of hook.renderers) {
|
|
8
|
-
try { roots = roots.concat(Array.from(hook.getFiberRoots(entry[0]) || [])); } catch (e) {}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
if (roots.length === 0) {
|
|
12
|
-
try { roots = Array.from(hook.getFiberRoots(1) || []); } catch (e) {}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
5
|
+
${FIBER_ROOTS_JS}
|
|
6
|
+
var roots = __eb_fiberRoots(true);
|
|
15
7
|
`;
|
|
16
8
|
export function buildSelectionProbeExpression() {
|
|
17
9
|
return `
|