spana-test 0.12.0 → 0.14.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 +1 -1
- package/dist/agent/index.js +28 -10
- package/dist/agent/index.js.map +1 -1
- package/dist/api/app.d.ts +40 -0
- package/dist/api/app.d.ts.map +1 -1
- package/dist/api/expect.d.ts +13 -0
- package/dist/api/expect.d.ts.map +1 -1
- package/dist/app-JTWXTFDY.js +13 -0
- package/dist/appium-CC77BJNK.js +935 -0
- package/dist/appium-CC77BJNK.js.map +1 -0
- package/dist/bridge-server-S3DHK7XE.js +12 -0
- package/dist/channels/cdp-client.d.ts +65 -0
- package/dist/channels/cdp-client.d.ts.map +1 -1
- package/dist/channels/dom-channel.d.ts +10 -1
- package/dist/channels/dom-channel.d.ts.map +1 -1
- package/dist/{chunk-OQRGR542.js → chunk-2SJNPLLU.js} +7 -7
- package/dist/chunk-2SJNPLLU.js.map +1 -0
- package/dist/chunk-4LJ3KYCX.js +94 -0
- package/dist/chunk-4LJ3KYCX.js.map +1 -0
- package/dist/{chunk-GAWJL6Q3.js → chunk-63OBFF2I.js} +601 -95
- package/dist/chunk-63OBFF2I.js.map +1 -0
- package/dist/{screenshot-compare-V4JQG73R.js → chunk-6C2EILMC.js} +185 -6
- package/dist/chunk-6C2EILMC.js.map +1 -0
- package/dist/{chunk-LQQNE2OE.js → chunk-7EMHU56B.js} +397 -44
- package/dist/chunk-7EMHU56B.js.map +1 -0
- package/dist/chunk-7WC7NPRU.js +1186 -0
- package/dist/chunk-7WC7NPRU.js.map +1 -0
- package/dist/chunk-A7Z52TDQ.js +97 -0
- package/dist/chunk-A7Z52TDQ.js.map +1 -0
- package/dist/chunk-DMF2BPPA.js +547 -0
- package/dist/chunk-DMF2BPPA.js.map +1 -0
- package/dist/chunk-E2JJOVPP.js +1962 -0
- package/dist/chunk-E2JJOVPP.js.map +1 -0
- package/dist/{chunk-QOL44BNJ.js → chunk-GDVHJBR2.js} +4 -4
- package/dist/chunk-GLNTGHR6.js +330 -0
- package/dist/chunk-GLNTGHR6.js.map +1 -0
- package/dist/chunk-HNQLWFHL.js +40 -0
- package/dist/chunk-HNQLWFHL.js.map +1 -0
- package/dist/chunk-HUYC4OAL.js +72 -0
- package/dist/chunk-HUYC4OAL.js.map +1 -0
- package/dist/chunk-HWS3XUEF.js +109 -0
- package/dist/chunk-HWS3XUEF.js.map +1 -0
- package/dist/chunk-IWGRZNKU.js +845 -0
- package/dist/chunk-IWGRZNKU.js.map +1 -0
- package/dist/chunk-JHJSAIPG.js +1114 -0
- package/dist/chunk-JHJSAIPG.js.map +1 -0
- package/dist/chunk-K4K2ACT2.js +179 -0
- package/dist/chunk-K4K2ACT2.js.map +1 -0
- package/dist/chunk-KWIB77C7.js +654 -0
- package/dist/chunk-KWIB77C7.js.map +1 -0
- package/dist/chunk-MPJCUL2B.js +154 -0
- package/dist/chunk-MPJCUL2B.js.map +1 -0
- package/dist/{chunk-F3AFZ6UX.js → chunk-MTCRATOA.js} +3 -1
- package/dist/chunk-MTCRATOA.js.map +1 -0
- package/dist/chunk-MUMIMDRJ.js +24 -0
- package/dist/chunk-MUMIMDRJ.js.map +1 -0
- package/dist/chunk-NMN2ENQZ.js +1046 -0
- package/dist/chunk-NMN2ENQZ.js.map +1 -0
- package/dist/{chunk-XQRXQBDQ.js → chunk-NWGA3R2E.js} +2 -19
- package/dist/chunk-NWGA3R2E.js.map +1 -0
- package/dist/chunk-PCVXXIEJ.js +529 -0
- package/dist/chunk-PCVXXIEJ.js.map +1 -0
- package/dist/chunk-RGLPQNJG.js +272 -0
- package/dist/chunk-RGLPQNJG.js.map +1 -0
- package/dist/{chunk-F2YUBD4E.js → chunk-RQ5TJJZU.js} +3 -3
- package/dist/{chunk-BWEQ4XT2.js → chunk-T4FCROSE.js} +458 -1180
- package/dist/chunk-T4FCROSE.js.map +1 -0
- package/dist/{chunk-AMBU26PB.js → chunk-U7633AII.js} +5 -4
- package/dist/chunk-U7633AII.js.map +1 -0
- package/dist/{chunk-53TGNQTM.js → chunk-WKN6ZW7V.js} +32 -18
- package/dist/{chunk-53TGNQTM.js.map → chunk-WKN6ZW7V.js.map} +1 -1
- package/dist/chunk-X5FRYDZ3.js +91 -0
- package/dist/chunk-X5FRYDZ3.js.map +1 -0
- package/dist/chunk-YFTHJRDO.js +37 -0
- package/dist/chunk-YFTHJRDO.js.map +1 -0
- package/dist/cli/config-loader.d.ts +1 -0
- package/dist/cli/config-loader.d.ts.map +1 -1
- package/dist/cli/test-command.d.ts +2 -0
- package/dist/cli/test-command.d.ts.map +1 -1
- package/dist/cli.js +18 -18
- package/dist/config-loader-4X7R7XDL.js +10 -0
- package/dist/core/engine.d.ts.map +1 -1
- package/dist/{discover-43C3BE7I.js → discover-6ULCTB5T.js} +3 -3
- package/dist/{doctor-command-CLKEEOAX.js → doctor-command-BYKRBS4V.js} +16 -9
- package/dist/{doctor-command-CLKEEOAX.js.map → doctor-command-BYKRBS4V.js.map} +1 -1
- package/dist/driver-GOPO5ZZP.js +19 -0
- package/dist/driver-HK4HQAYL.js +19 -0
- package/dist/drivers/cdp-browser.d.ts +31 -3
- package/dist/drivers/cdp-browser.d.ts.map +1 -1
- package/dist/drivers/electron.d.ts +1 -1
- package/dist/drivers/electron.d.ts.map +1 -1
- package/dist/drivers/playwright.d.ts +1 -5
- package/dist/drivers/playwright.d.ts.map +1 -1
- package/dist/drivers/raw-driver.d.ts +4 -0
- package/dist/drivers/raw-driver.d.ts.map +1 -1
- package/dist/drivers/wasm-utils.d.ts +100 -0
- package/dist/drivers/wasm-utils.d.ts.map +1 -0
- package/dist/drivers/wasm.d.ts +57 -0
- package/dist/drivers/wasm.d.ts.map +1 -0
- package/dist/electrobun-65Z6KOVN.js +15 -0
- package/dist/electrobun-65Z6KOVN.js.map +1 -0
- package/dist/electron-SQACDON3.js +9 -0
- package/dist/electron-SQACDON3.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +409 -53
- package/dist/index.js.map +1 -1
- package/dist/installer-KL2NCILK.js +17 -0
- package/dist/installer-KL2NCILK.js.map +1 -0
- package/dist/{local-RH5EFGYF.js → local-6NRVD5VP.js} +8 -9
- package/dist/local-6NRVD5VP.js.map +1 -0
- package/dist/pagesource-KIQ5T5MA.js +9 -0
- package/dist/pagesource-KIQ5T5MA.js.map +1 -0
- package/dist/pagesource-KKG7WMFJ.js +9 -0
- package/dist/pagesource-KKG7WMFJ.js.map +1 -0
- package/dist/playwright-JUAD3TT4.js +28 -0
- package/dist/playwright-JUAD3TT4.js.map +1 -0
- package/dist/runtime/local.d.ts +2 -2
- package/dist/runtime/local.d.ts.map +1 -1
- package/dist/schemas/config.d.ts +37 -4
- package/dist/schemas/config.d.ts.map +1 -1
- package/dist/schemas/device.d.ts +1 -1
- package/dist/schemas/device.d.ts.map +1 -1
- package/dist/screenshot-compare-BJRJHKNQ.js +12 -0
- package/dist/screenshot-compare-BJRJHKNQ.js.map +1 -0
- package/dist/{server-D45AO34E.js → server-2RCONJCW.js} +30 -12
- package/dist/{server-D45AO34E.js.map → server-2RCONJCW.js.map} +1 -1
- package/dist/{server-KLZBJOMQ.js → server-UJ3RDZWT.js} +2 -2
- package/dist/server-UJ3RDZWT.js.map +1 -0
- package/dist/session-7N5XYDXQ.js +39 -0
- package/dist/session-7N5XYDXQ.js.map +1 -0
- package/dist/smart/auto-wait.d.ts +2 -0
- package/dist/smart/auto-wait.d.ts.map +1 -1
- package/dist/smart/coordinator.d.ts.map +1 -1
- package/dist/{studio-command-TNSJGTFA.js → studio-command-ZCR64XWV.js} +2 -2
- package/dist/{test-command-EXPYFDTF.js → test-command-ENL3DRN4.js} +74 -1041
- package/dist/test-command-ENL3DRN4.js.map +1 -0
- package/dist/watch-mode-NR5MHNNL.js +10 -0
- package/dist/watch-mode-NR5MHNNL.js.map +1 -0
- package/native/win32-x64/spana_native.dll +0 -0
- package/package.json +2 -2
- package/dist/app-CBHH5GMB.js +0 -10
- package/dist/chunk-AMBU26PB.js.map +0 -1
- package/dist/chunk-BWEQ4XT2.js.map +0 -1
- package/dist/chunk-F3AFZ6UX.js.map +0 -1
- package/dist/chunk-GAWJL6Q3.js.map +0 -1
- package/dist/chunk-GDDCZ2PL.js +0 -2619
- package/dist/chunk-GDDCZ2PL.js.map +0 -1
- package/dist/chunk-LQQNE2OE.js.map +0 -1
- package/dist/chunk-OQRGR542.js.map +0 -1
- package/dist/chunk-PPAPRKQU.js +0 -4739
- package/dist/chunk-PPAPRKQU.js.map +0 -1
- package/dist/chunk-VOYJQDSI.js +0 -188
- package/dist/chunk-VOYJQDSI.js.map +0 -1
- package/dist/chunk-XQRXQBDQ.js.map +0 -1
- package/dist/config-loader-V26XXHPH.js +0 -10
- package/dist/screenshot-compare-V4JQG73R.js.map +0 -1
- package/dist/session-N6DEYVPM.js +0 -21
- package/dist/test-command-EXPYFDTF.js.map +0 -1
- /package/dist/{app-CBHH5GMB.js.map → app-JTWXTFDY.js.map} +0 -0
- /package/dist/{config-loader-V26XXHPH.js.map → bridge-server-S3DHK7XE.js.map} +0 -0
- /package/dist/{chunk-QOL44BNJ.js.map → chunk-GDVHJBR2.js.map} +0 -0
- /package/dist/{chunk-F2YUBD4E.js.map → chunk-RQ5TJJZU.js.map} +0 -0
- /package/dist/{discover-43C3BE7I.js.map → config-loader-4X7R7XDL.js.map} +0 -0
- /package/dist/{local-RH5EFGYF.js.map → discover-6ULCTB5T.js.map} +0 -0
- /package/dist/{server-KLZBJOMQ.js.map → driver-GOPO5ZZP.js.map} +0 -0
- /package/dist/{session-N6DEYVPM.js.map → driver-HK4HQAYL.js.map} +0 -0
- /package/dist/{studio-command-TNSJGTFA.js.map → studio-command-ZCR64XWV.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
withActiveStepRecorder,
|
|
30
30
|
writeRichTraceBundle,
|
|
31
31
|
writeWorkerProcessReport
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-2SJNPLLU.js";
|
|
33
33
|
import {
|
|
34
34
|
NetworkEventBuffer,
|
|
35
35
|
SPANA_MCP_TOOLS,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
buildFlowFileFromLines,
|
|
39
39
|
buildPerformanceProfileScript,
|
|
40
40
|
formatSelectorCode
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-RQ5TJJZU.js";
|
|
42
42
|
import {
|
|
43
43
|
clearReplayCache,
|
|
44
44
|
formatCacheInspectTable,
|
|
@@ -63,29 +63,22 @@ import {
|
|
|
63
63
|
} from "./chunk-FSPMFRJO.js";
|
|
64
64
|
import {
|
|
65
65
|
defineConfig
|
|
66
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-MTCRATOA.js";
|
|
67
67
|
import "./chunk-U56N5JCJ.js";
|
|
68
68
|
import {
|
|
69
|
-
UPLOAD_ATTACH_TIMEOUT_MS,
|
|
70
|
-
applyExtensionChromeArgs,
|
|
71
69
|
defineDomTransport,
|
|
72
70
|
defineDriverAdapter,
|
|
73
|
-
getLoadedExtensions,
|
|
74
|
-
launchDirectCdpBrowser,
|
|
75
71
|
listDomTransports,
|
|
76
72
|
listDriverAdapters,
|
|
77
|
-
makeLightweightCdpDriver,
|
|
78
73
|
registerDomTransport,
|
|
79
74
|
registerDriverAdapter,
|
|
80
|
-
resolveBrowserExtensions,
|
|
81
75
|
resolveDomTransport,
|
|
82
76
|
resolveDriverAdapter,
|
|
83
77
|
resolveWebEngine,
|
|
84
|
-
runOAuthPopupFlow,
|
|
85
78
|
speculativelyPrelaunchWebBrowser,
|
|
86
79
|
unregisterDomTransport,
|
|
87
80
|
unregisterDriverAdapter
|
|
88
|
-
} from "./chunk-
|
|
81
|
+
} from "./chunk-JHJSAIPG.js";
|
|
89
82
|
import {
|
|
90
83
|
ReplayCacheStore,
|
|
91
84
|
ReplaySession,
|
|
@@ -99,42 +92,27 @@ import {
|
|
|
99
92
|
secret,
|
|
100
93
|
unique
|
|
101
94
|
} from "./chunk-HIGFQRWM.js";
|
|
95
|
+
import "./chunk-PRQTAIYA.js";
|
|
96
|
+
import {
|
|
97
|
+
cloneIOSSimulator,
|
|
98
|
+
deleteIOSSimulator
|
|
99
|
+
} from "./chunk-2MA5G2VH.js";
|
|
100
|
+
import "./chunk-YFTHJRDO.js";
|
|
102
101
|
import {
|
|
103
102
|
connectPlaywrightOverCDP,
|
|
104
103
|
connectPlaywrightOverWS,
|
|
105
104
|
ensureWarmBrowserDaemon,
|
|
106
|
-
launchPlaywrightBrowser
|
|
107
|
-
|
|
108
|
-
} from "./chunk-PPAPRKQU.js";
|
|
105
|
+
launchPlaywrightBrowser
|
|
106
|
+
} from "./chunk-E2JJOVPP.js";
|
|
109
107
|
import {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
createCompositeDomChannel,
|
|
119
|
-
createSpanaBridgeChannel,
|
|
120
|
-
createWebKitInspectorChannel,
|
|
121
|
-
decodeWebInspectorFrames,
|
|
122
|
-
encodeWebInspectorPacket,
|
|
123
|
-
findSimulatorWebInspectorSocket,
|
|
124
|
-
formatTargetMatrixTable,
|
|
125
|
-
makeElectrobunDriver,
|
|
126
|
-
parseAndroidWebViewSockets,
|
|
127
|
-
parseWebInspectorXmlFrame,
|
|
128
|
-
resolveElectrobunEngine,
|
|
129
|
-
resolveElectrobunLaunchPlan,
|
|
130
|
-
resolveTargetDescriptor
|
|
131
|
-
} from "./chunk-GDDCZ2PL.js";
|
|
132
|
-
import "./chunk-XVL4FHXA.js";
|
|
133
|
-
import {
|
|
134
|
-
cloneIOSSimulator,
|
|
135
|
-
deleteIOSSimulator
|
|
136
|
-
} from "./chunk-2MA5G2VH.js";
|
|
137
|
-
import "./chunk-XD6A3VXB.js";
|
|
108
|
+
UPLOAD_ATTACH_TIMEOUT_MS,
|
|
109
|
+
applyExtensionChromeArgs,
|
|
110
|
+
getLoadedExtensions,
|
|
111
|
+
launchDirectCdpBrowser,
|
|
112
|
+
makeLightweightCdpDriver,
|
|
113
|
+
resolveBrowserExtensions,
|
|
114
|
+
runOAuthPopupFlow
|
|
115
|
+
} from "./chunk-T4FCROSE.js";
|
|
138
116
|
import {
|
|
139
117
|
DEFAULT_WARM_DAEMON_IDLE_TTL_MS,
|
|
140
118
|
defaultDaemonStateDir,
|
|
@@ -146,18 +124,49 @@ import {
|
|
|
146
124
|
sweepOrphanedSpanaBrowsers,
|
|
147
125
|
updateWarmDaemonSession
|
|
148
126
|
} from "./chunk-FHCOPLYB.js";
|
|
127
|
+
import {
|
|
128
|
+
makeElectronDriver
|
|
129
|
+
} from "./chunk-GLNTGHR6.js";
|
|
130
|
+
import {
|
|
131
|
+
TARGET_CHANNEL_MATRIX,
|
|
132
|
+
formatTargetMatrixTable,
|
|
133
|
+
makeElectrobunDriver,
|
|
134
|
+
resolveElectrobunEngine,
|
|
135
|
+
resolveElectrobunLaunchPlan,
|
|
136
|
+
resolveTargetDescriptor
|
|
137
|
+
} from "./chunk-PCVXXIEJ.js";
|
|
138
|
+
import {
|
|
139
|
+
AppleWebInspectorClient,
|
|
140
|
+
WebKitInspectorChannel,
|
|
141
|
+
createWebKitInspectorChannel,
|
|
142
|
+
decodeWebInspectorFrames,
|
|
143
|
+
encodeWebInspectorPacket,
|
|
144
|
+
findSimulatorWebInspectorSocket,
|
|
145
|
+
parseWebInspectorXmlFrame
|
|
146
|
+
} from "./chunk-KWIB77C7.js";
|
|
147
|
+
import {
|
|
148
|
+
AndroidWebViewCdpChannel,
|
|
149
|
+
createAndroidWebViewCdpChannel,
|
|
150
|
+
parseAndroidWebViewSockets
|
|
151
|
+
} from "./chunk-RGLPQNJG.js";
|
|
152
|
+
import "./chunk-HWS3XUEF.js";
|
|
153
|
+
import "./chunk-HNQLWFHL.js";
|
|
149
154
|
import {
|
|
150
155
|
allocateFreePort,
|
|
151
156
|
assertPortAvailable,
|
|
152
157
|
isPortAvailable
|
|
153
158
|
} from "./chunk-7Q7TSUNL.js";
|
|
154
|
-
import "./chunk-
|
|
159
|
+
import "./chunk-XVL4FHXA.js";
|
|
155
160
|
import {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
SpanaBridgeChannel,
|
|
162
|
+
createCompositeDomChannel,
|
|
163
|
+
createSpanaBridgeChannel
|
|
164
|
+
} from "./chunk-DMF2BPPA.js";
|
|
165
|
+
import {
|
|
166
|
+
CdpDomChannel,
|
|
167
|
+
CdpWebSocketMultiplexer,
|
|
168
|
+
createCdpDomChannel
|
|
169
|
+
} from "./chunk-7WC7NPRU.js";
|
|
161
170
|
import {
|
|
162
171
|
and,
|
|
163
172
|
assertDataSnapshot,
|
|
@@ -184,10 +193,12 @@ import {
|
|
|
184
193
|
resolveElementAcrossChannels,
|
|
185
194
|
systemUI,
|
|
186
195
|
within
|
|
187
|
-
} from "./chunk-
|
|
188
|
-
import "./chunk-
|
|
196
|
+
} from "./chunk-7EMHU56B.js";
|
|
197
|
+
import "./chunk-MUMIMDRJ.js";
|
|
198
|
+
import "./chunk-NWGA3R2E.js";
|
|
189
199
|
import {
|
|
190
200
|
SPANA_INJECTED_RUNTIME_SCRIPT,
|
|
201
|
+
SPANA_WASM_HOOK_SCRIPT,
|
|
191
202
|
buildDomActionabilityDiagScript,
|
|
192
203
|
buildDomFillScript,
|
|
193
204
|
buildDomQueryScript,
|
|
@@ -196,8 +207,21 @@ import {
|
|
|
196
207
|
buildDomWaitForHiddenScript,
|
|
197
208
|
buildDomWaitForMatchScript,
|
|
198
209
|
buildDomWaitForSelectorScript,
|
|
199
|
-
buildInjectedCallScript
|
|
200
|
-
|
|
210
|
+
buildInjectedCallScript,
|
|
211
|
+
formatByteSize,
|
|
212
|
+
isWasmTrapError,
|
|
213
|
+
parseByteSize,
|
|
214
|
+
resolveChromiumGpuArgs
|
|
215
|
+
} from "./chunk-63OBFF2I.js";
|
|
216
|
+
import {
|
|
217
|
+
DriverError
|
|
218
|
+
} from "./chunk-A7Z52TDQ.js";
|
|
219
|
+
import {
|
|
220
|
+
comparePngNative,
|
|
221
|
+
getNativeAcceleratorPath,
|
|
222
|
+
isNativeAcceleratorActive,
|
|
223
|
+
tokenizeXmlNative
|
|
224
|
+
} from "./chunk-6C2EILMC.js";
|
|
201
225
|
import {
|
|
202
226
|
init_esm_shims
|
|
203
227
|
} from "./chunk-FTXUQMGH.js";
|
|
@@ -279,7 +303,8 @@ var DeviceInfo = Schema2.Struct({
|
|
|
279
303
|
"wda",
|
|
280
304
|
"appium",
|
|
281
305
|
"electron",
|
|
282
|
-
"electrobun"
|
|
306
|
+
"electrobun",
|
|
307
|
+
"wasm"
|
|
283
308
|
])
|
|
284
309
|
});
|
|
285
310
|
|
|
@@ -1127,11 +1152,334 @@ var BidiDomChannel = class {
|
|
|
1127
1152
|
function createBidiDomChannel(options) {
|
|
1128
1153
|
return new BidiDomChannel(options);
|
|
1129
1154
|
}
|
|
1155
|
+
|
|
1156
|
+
// src/drivers/wasm.ts
|
|
1157
|
+
init_esm_shims();
|
|
1158
|
+
import { readFile } from "fs/promises";
|
|
1159
|
+
import { execFile } from "child_process";
|
|
1160
|
+
import { promisify } from "util";
|
|
1161
|
+
import { Effect } from "effect";
|
|
1162
|
+
var execFileAsync = promisify(execFile);
|
|
1163
|
+
function emptyRoot() {
|
|
1164
|
+
return {
|
|
1165
|
+
id: "wasm-root",
|
|
1166
|
+
elementType: "WasmModule",
|
|
1167
|
+
bounds: { x: 0, y: 0, width: 1280, height: 720 },
|
|
1168
|
+
enabled: true,
|
|
1169
|
+
visible: true,
|
|
1170
|
+
clickable: false,
|
|
1171
|
+
children: []
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
function findPrimaryMemory(exports) {
|
|
1175
|
+
if (!exports) return void 0;
|
|
1176
|
+
if (exports.memory instanceof WebAssembly.Memory) return exports.memory;
|
|
1177
|
+
for (const val of Object.values(exports)) {
|
|
1178
|
+
if (val instanceof WebAssembly.Memory) return val;
|
|
1179
|
+
}
|
|
1180
|
+
return void 0;
|
|
1181
|
+
}
|
|
1182
|
+
function createWasmDriver(options) {
|
|
1183
|
+
return Effect.sync(() => {
|
|
1184
|
+
const runtime = options.runtime ?? "in-process";
|
|
1185
|
+
let instance = null;
|
|
1186
|
+
let compiledModule = null;
|
|
1187
|
+
let lastBytes = null;
|
|
1188
|
+
let peakMemoryBytes = 0;
|
|
1189
|
+
let instantiateMs = 0;
|
|
1190
|
+
let moduleCount = 0;
|
|
1191
|
+
const consoleLogs = [];
|
|
1192
|
+
const jsErrors = [];
|
|
1193
|
+
const wasmTraps = [];
|
|
1194
|
+
const recordError = (err) => {
|
|
1195
|
+
const name = err instanceof Error ? err.name : "Error";
|
|
1196
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
1197
|
+
const stack = err instanceof Error ? err.stack : void 0;
|
|
1198
|
+
jsErrors.push({ name, message, stack });
|
|
1199
|
+
if (isWasmTrapError({ name, message, stack }) || err instanceof WebAssembly.RuntimeError) {
|
|
1200
|
+
wasmTraps.push({
|
|
1201
|
+
name,
|
|
1202
|
+
message,
|
|
1203
|
+
source: "wasm",
|
|
1204
|
+
stack,
|
|
1205
|
+
timestamp: Date.now()
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
};
|
|
1209
|
+
const readMemoryBytes = () => {
|
|
1210
|
+
const mem = findPrimaryMemory(instance?.exports ?? null);
|
|
1211
|
+
const bytes = mem ? mem.buffer.byteLength : 0;
|
|
1212
|
+
if (bytes > peakMemoryBytes) peakMemoryBytes = bytes;
|
|
1213
|
+
return bytes;
|
|
1214
|
+
};
|
|
1215
|
+
const loadBytes = async (bundleId) => {
|
|
1216
|
+
if (options.wasmBytes) return options.wasmBytes;
|
|
1217
|
+
const targetPath = options.modulePath || (bundleId && bundleId.endsWith(".wasm") ? bundleId : void 0);
|
|
1218
|
+
if (!targetPath) {
|
|
1219
|
+
throw new Error("WASM driver requires `modulePath` or `wasmBytes`.");
|
|
1220
|
+
}
|
|
1221
|
+
const buf = await readFile(targetPath);
|
|
1222
|
+
return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
1223
|
+
};
|
|
1224
|
+
const instantiateNow = async (bundleId) => {
|
|
1225
|
+
const t0 = performance.now();
|
|
1226
|
+
const bytes = await loadBytes(bundleId);
|
|
1227
|
+
lastBytes = bytes;
|
|
1228
|
+
if (runtime === "wasmtime") {
|
|
1229
|
+
const binary = options.wasmtimeBinary ?? "wasmtime";
|
|
1230
|
+
const cliArgs = [];
|
|
1231
|
+
for (const [guest, host] of Object.entries(options.preopens ?? {})) {
|
|
1232
|
+
cliArgs.push("--dir", `${host}::${guest}`);
|
|
1233
|
+
}
|
|
1234
|
+
for (const [k, v] of Object.entries(options.env ?? {})) {
|
|
1235
|
+
cliArgs.push("--env", `${k}=${v}`);
|
|
1236
|
+
}
|
|
1237
|
+
if (!options.modulePath) {
|
|
1238
|
+
throw new Error('WASM runtime "wasmtime" requires `modulePath` on disk.');
|
|
1239
|
+
}
|
|
1240
|
+
cliArgs.push(options.modulePath, ...options.args ?? []);
|
|
1241
|
+
try {
|
|
1242
|
+
const { stdout, stderr } = await execFileAsync(binary, cliArgs, { encoding: "utf8" });
|
|
1243
|
+
if (stdout.trim()) consoleLogs.push({ type: "log", text: stdout.trim() });
|
|
1244
|
+
if (stderr.trim()) consoleLogs.push({ type: "error", text: stderr.trim() });
|
|
1245
|
+
moduleCount += 1;
|
|
1246
|
+
instantiateMs = Math.round(performance.now() - t0);
|
|
1247
|
+
} catch (err) {
|
|
1248
|
+
if (err?.stdout) consoleLogs.push({ type: "log", text: String(err.stdout).trim() });
|
|
1249
|
+
if (err?.stderr) consoleLogs.push({ type: "error", text: String(err.stderr).trim() });
|
|
1250
|
+
recordError(err);
|
|
1251
|
+
throw err;
|
|
1252
|
+
}
|
|
1253
|
+
return;
|
|
1254
|
+
}
|
|
1255
|
+
if (runtime === "wasi") {
|
|
1256
|
+
const { WASI } = await import("wasi");
|
|
1257
|
+
const wasi = new WASI({
|
|
1258
|
+
version: "preview1",
|
|
1259
|
+
args: [options.modulePath ?? "module.wasm", ...options.args ?? []],
|
|
1260
|
+
env: options.env ?? {},
|
|
1261
|
+
preopens: options.preopens ?? {}
|
|
1262
|
+
});
|
|
1263
|
+
const mod = await WebAssembly.compile(bytes);
|
|
1264
|
+
compiledModule = mod;
|
|
1265
|
+
const imports = {
|
|
1266
|
+
...wasi.getImportObject(),
|
|
1267
|
+
...options.imports
|
|
1268
|
+
};
|
|
1269
|
+
const inst = await WebAssembly.instantiate(mod, imports);
|
|
1270
|
+
instance = inst;
|
|
1271
|
+
moduleCount += 1;
|
|
1272
|
+
readMemoryBytes();
|
|
1273
|
+
instantiateMs = Math.round(performance.now() - t0);
|
|
1274
|
+
try {
|
|
1275
|
+
if (typeof inst.exports._start === "function") {
|
|
1276
|
+
wasi.start(inst);
|
|
1277
|
+
} else if (typeof inst.exports._initialize === "function") {
|
|
1278
|
+
wasi.initialize(inst);
|
|
1279
|
+
}
|
|
1280
|
+
} catch (err) {
|
|
1281
|
+
recordError(err);
|
|
1282
|
+
throw err;
|
|
1283
|
+
}
|
|
1284
|
+
readMemoryBytes();
|
|
1285
|
+
return;
|
|
1286
|
+
}
|
|
1287
|
+
try {
|
|
1288
|
+
const mod = await WebAssembly.compile(bytes);
|
|
1289
|
+
compiledModule = mod;
|
|
1290
|
+
const inst = await WebAssembly.instantiate(mod, options.imports ?? {});
|
|
1291
|
+
instance = inst;
|
|
1292
|
+
moduleCount += 1;
|
|
1293
|
+
readMemoryBytes();
|
|
1294
|
+
instantiateMs = Math.round(performance.now() - t0);
|
|
1295
|
+
if (options.entryExport && typeof inst.exports[options.entryExport] === "function") {
|
|
1296
|
+
inst.exports[options.entryExport]();
|
|
1297
|
+
readMemoryBytes();
|
|
1298
|
+
}
|
|
1299
|
+
} catch (err) {
|
|
1300
|
+
recordError(err);
|
|
1301
|
+
throw err;
|
|
1302
|
+
}
|
|
1303
|
+
};
|
|
1304
|
+
const buildEvalContext = () => {
|
|
1305
|
+
const exports = instance?.exports ?? {};
|
|
1306
|
+
const memory = findPrimaryMemory(exports);
|
|
1307
|
+
const decoder = new TextDecoder();
|
|
1308
|
+
const encoder = new TextEncoder();
|
|
1309
|
+
return {
|
|
1310
|
+
exports,
|
|
1311
|
+
memory,
|
|
1312
|
+
readUtf8(ptr, byteLength) {
|
|
1313
|
+
if (!memory) throw new Error("WASM module does not export linear memory");
|
|
1314
|
+
return decoder.decode(new Uint8Array(memory.buffer, ptr, byteLength));
|
|
1315
|
+
},
|
|
1316
|
+
writeUtf8(ptr, text) {
|
|
1317
|
+
if (!memory) throw new Error("WASM module does not export linear memory");
|
|
1318
|
+
const encoded = encoder.encode(text);
|
|
1319
|
+
new Uint8Array(memory.buffer, ptr, encoded.byteLength).set(encoded);
|
|
1320
|
+
return encoded.byteLength;
|
|
1321
|
+
}
|
|
1322
|
+
};
|
|
1323
|
+
};
|
|
1324
|
+
const getMetrics = () => {
|
|
1325
|
+
const bytes = readMemoryBytes();
|
|
1326
|
+
return {
|
|
1327
|
+
moduleCount,
|
|
1328
|
+
pendingCount: 0,
|
|
1329
|
+
wasmMemoryBytes: bytes,
|
|
1330
|
+
wasmMemoryPages: Math.round(bytes / 65536),
|
|
1331
|
+
peakWasmMemoryBytes: peakMemoryBytes,
|
|
1332
|
+
crossOriginIsolated: true,
|
|
1333
|
+
sharedArrayBufferAvailable: typeof SharedArrayBuffer !== "undefined",
|
|
1334
|
+
traps: [...wasmTraps],
|
|
1335
|
+
modules: moduleCount > 0 ? [
|
|
1336
|
+
{
|
|
1337
|
+
id: 1,
|
|
1338
|
+
name: options.modulePath,
|
|
1339
|
+
sizeBytes: lastBytes?.byteLength,
|
|
1340
|
+
instantiateMs,
|
|
1341
|
+
memoryBytes: bytes,
|
|
1342
|
+
memoryPages: Math.round(bytes / 65536),
|
|
1343
|
+
instantiatedAt: Date.now()
|
|
1344
|
+
}
|
|
1345
|
+
] : []
|
|
1346
|
+
};
|
|
1347
|
+
};
|
|
1348
|
+
const service = {
|
|
1349
|
+
beginFlow: () => Effect.sync(() => {
|
|
1350
|
+
consoleLogs.length = 0;
|
|
1351
|
+
jsErrors.length = 0;
|
|
1352
|
+
wasmTraps.length = 0;
|
|
1353
|
+
}),
|
|
1354
|
+
launchApp: (bundleId) => Effect.tryPromise({
|
|
1355
|
+
try: () => instantiateNow(bundleId),
|
|
1356
|
+
catch: (e) => new DriverError({ message: `WASM launchApp failed: ${e}` })
|
|
1357
|
+
}),
|
|
1358
|
+
stopApp: () => Effect.sync(() => {
|
|
1359
|
+
instance = null;
|
|
1360
|
+
}),
|
|
1361
|
+
killApp: () => Effect.sync(() => {
|
|
1362
|
+
instance = null;
|
|
1363
|
+
compiledModule = null;
|
|
1364
|
+
}),
|
|
1365
|
+
clearAppState: (bundleId) => Effect.tryPromise({
|
|
1366
|
+
try: async () => {
|
|
1367
|
+
instance = null;
|
|
1368
|
+
consoleLogs.length = 0;
|
|
1369
|
+
jsErrors.length = 0;
|
|
1370
|
+
wasmTraps.length = 0;
|
|
1371
|
+
if (lastBytes || options.modulePath || options.wasmBytes) {
|
|
1372
|
+
await instantiateNow(bundleId);
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
catch: (e) => new DriverError({ message: `WASM clearAppState failed: ${e}` })
|
|
1376
|
+
}),
|
|
1377
|
+
dumpHierarchy: () => Effect.tryPromise({
|
|
1378
|
+
try: async () => {
|
|
1379
|
+
if (!instance) return JSON.stringify(emptyRoot());
|
|
1380
|
+
const mem = findPrimaryMemory(instance.exports);
|
|
1381
|
+
if (options.treeProvider) {
|
|
1382
|
+
const tree = await options.treeProvider(instance.exports, mem);
|
|
1383
|
+
return JSON.stringify(tree);
|
|
1384
|
+
}
|
|
1385
|
+
return JSON.stringify({
|
|
1386
|
+
...emptyRoot(),
|
|
1387
|
+
text: options.modulePath ?? "wasm-module",
|
|
1388
|
+
attributes: {
|
|
1389
|
+
exports: Object.keys(instance.exports).join(","),
|
|
1390
|
+
wasmMemoryBytes: String(readMemoryBytes())
|
|
1391
|
+
}
|
|
1392
|
+
});
|
|
1393
|
+
},
|
|
1394
|
+
catch: (e) => new DriverError({ message: `WASM dumpHierarchy failed: ${e}` })
|
|
1395
|
+
}),
|
|
1396
|
+
evaluate: (script, ...args) => Effect.tryPromise({
|
|
1397
|
+
try: async () => {
|
|
1398
|
+
if (!instance && (options.modulePath || options.wasmBytes)) {
|
|
1399
|
+
await instantiateNow();
|
|
1400
|
+
}
|
|
1401
|
+
const ctx = buildEvalContext();
|
|
1402
|
+
try {
|
|
1403
|
+
const res = typeof script === "function" ? await script(ctx, ...args) : await new Function("wasm", "exports", "memory", `return (${script})`)(
|
|
1404
|
+
ctx,
|
|
1405
|
+
ctx.exports,
|
|
1406
|
+
ctx.memory
|
|
1407
|
+
);
|
|
1408
|
+
readMemoryBytes();
|
|
1409
|
+
return res;
|
|
1410
|
+
} catch (err) {
|
|
1411
|
+
recordError(err);
|
|
1412
|
+
throw err;
|
|
1413
|
+
}
|
|
1414
|
+
},
|
|
1415
|
+
catch: (e) => new DriverError({
|
|
1416
|
+
message: `WASM evaluate failed: ${e instanceof Error ? e.message : String(e)}`
|
|
1417
|
+
})
|
|
1418
|
+
}),
|
|
1419
|
+
getWasmMetrics: () => Effect.sync(() => getMetrics()),
|
|
1420
|
+
getWasmTraps: () => Effect.sync(() => [...wasmTraps]),
|
|
1421
|
+
getConsoleLogs: () => Effect.sync(() => [...consoleLogs]),
|
|
1422
|
+
getJSErrors: () => Effect.sync(() => [...jsErrors]),
|
|
1423
|
+
tapAtCoordinate: () => Effect.void,
|
|
1424
|
+
doubleTapAtCoordinate: () => Effect.void,
|
|
1425
|
+
longPressAtCoordinate: () => Effect.void,
|
|
1426
|
+
swipe: () => Effect.void,
|
|
1427
|
+
inputText: () => Effect.void,
|
|
1428
|
+
pressKey: () => Effect.void,
|
|
1429
|
+
hideKeyboard: () => Effect.void,
|
|
1430
|
+
takeScreenshot: () => Effect.sync(() => new Uint8Array()),
|
|
1431
|
+
getDeviceInfo: () => Effect.sync(() => ({
|
|
1432
|
+
deviceId: options.modulePath ?? "wasm-in-process",
|
|
1433
|
+
name: `Spana WASM (${runtime}${compiledModule ? ", loaded" : ""})`,
|
|
1434
|
+
platform: "web",
|
|
1435
|
+
isEmulator: false,
|
|
1436
|
+
screenWidth: 1280,
|
|
1437
|
+
screenHeight: 720,
|
|
1438
|
+
driverType: "wasm"
|
|
1439
|
+
})),
|
|
1440
|
+
openLink: () => Effect.void,
|
|
1441
|
+
back: () => Effect.void
|
|
1442
|
+
};
|
|
1443
|
+
return service;
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1446
|
+
function createWasmDriverAdapter(defaults = {}) {
|
|
1447
|
+
return defineDriverAdapter({
|
|
1448
|
+
name: "wasm",
|
|
1449
|
+
platforms: ["wasm", "web"],
|
|
1450
|
+
engines: ["wasm", "wasi", "wasmtime"],
|
|
1451
|
+
description: "Headless WebAssembly & WASI driver adapter (in-process, node:wasi, or wasmtime)",
|
|
1452
|
+
async create(ctx) {
|
|
1453
|
+
const merged = {
|
|
1454
|
+
...defaults,
|
|
1455
|
+
...ctx.options,
|
|
1456
|
+
modulePath: ctx.options?.modulePath ?? defaults.modulePath ?? (ctx.appId.endsWith(".wasm") ? ctx.resolvePath(ctx.appId) : void 0)
|
|
1457
|
+
};
|
|
1458
|
+
const driver = await Effect.runPromise(createWasmDriver(merged));
|
|
1459
|
+
return {
|
|
1460
|
+
driver,
|
|
1461
|
+
parseHierarchy: (raw) => JSON.parse(raw),
|
|
1462
|
+
cleanup: async () => {
|
|
1463
|
+
await Effect.runPromise(driver.killApp(ctx.appId)).catch(() => {
|
|
1464
|
+
});
|
|
1465
|
+
},
|
|
1466
|
+
metadata: { runtime: merged.runtime ?? "in-process", modulePath: merged.modulePath }
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
// src/index.ts
|
|
1473
|
+
async function runTestCommand(opts) {
|
|
1474
|
+
const { runTestCommand: run } = await import("./test-command-ENL3DRN4.js");
|
|
1475
|
+
return run(opts);
|
|
1476
|
+
}
|
|
1130
1477
|
export {
|
|
1131
1478
|
AndroidWebViewCdpChannel,
|
|
1132
1479
|
AppleWebInspectorClient,
|
|
1133
1480
|
BidiDomChannel,
|
|
1134
1481
|
CdpDomChannel,
|
|
1482
|
+
CdpWebSocketMultiplexer,
|
|
1135
1483
|
DEFAULT_MAX_WORKERS_PER_PROCESS,
|
|
1136
1484
|
DEFAULT_WARM_DAEMON_IDLE_TTL_MS,
|
|
1137
1485
|
NetworkEventBuffer,
|
|
@@ -1141,6 +1489,7 @@ export {
|
|
|
1141
1489
|
ReplaySession,
|
|
1142
1490
|
SPANA_INJECTED_RUNTIME_SCRIPT,
|
|
1143
1491
|
SPANA_MCP_TOOLS,
|
|
1492
|
+
SPANA_WASM_HOOK_SCRIPT,
|
|
1144
1493
|
SpanaBridgeChannel,
|
|
1145
1494
|
SpanaMcpServer,
|
|
1146
1495
|
TARGET_CHANNEL_MATRIX,
|
|
@@ -1199,6 +1548,8 @@ export {
|
|
|
1199
1548
|
createOpenAICompatibleAgentProvider,
|
|
1200
1549
|
createRemoteFlowClaimer,
|
|
1201
1550
|
createSpanaBridgeChannel,
|
|
1551
|
+
createWasmDriver,
|
|
1552
|
+
createWasmDriverAdapter,
|
|
1202
1553
|
createWebKitInspectorChannel,
|
|
1203
1554
|
decisionFilter,
|
|
1204
1555
|
decodeWebInspectorFrames,
|
|
@@ -1224,6 +1575,7 @@ export {
|
|
|
1224
1575
|
first,
|
|
1225
1576
|
flow,
|
|
1226
1577
|
formatActionsAsFlowCode,
|
|
1578
|
+
formatByteSize,
|
|
1227
1579
|
formatCacheInspectTable,
|
|
1228
1580
|
formatCodeFrame,
|
|
1229
1581
|
formatFilterSummary,
|
|
@@ -1245,6 +1597,7 @@ export {
|
|
|
1245
1597
|
isSystemUISelector,
|
|
1246
1598
|
isTcpPortOpen,
|
|
1247
1599
|
isTestIDSelector,
|
|
1600
|
+
isWasmTrapError,
|
|
1248
1601
|
last,
|
|
1249
1602
|
launchDirectCdpBrowser,
|
|
1250
1603
|
launchPlaywrightBrowser,
|
|
@@ -1259,6 +1612,7 @@ export {
|
|
|
1259
1612
|
or,
|
|
1260
1613
|
orderFlowsLongestFirst,
|
|
1261
1614
|
parseAndroidWebViewSockets,
|
|
1615
|
+
parseByteSize,
|
|
1262
1616
|
parseWebInspectorXmlFrame,
|
|
1263
1617
|
partitionFlowsAcrossProcesses,
|
|
1264
1618
|
pathRuleFilter,
|
|
@@ -1270,6 +1624,7 @@ export {
|
|
|
1270
1624
|
renderTraceViewerHtml,
|
|
1271
1625
|
replayRecordedAction,
|
|
1272
1626
|
resolveBrowserExtensions,
|
|
1627
|
+
resolveChromiumGpuArgs,
|
|
1273
1628
|
resolveDomTransport,
|
|
1274
1629
|
resolveDriverAdapter,
|
|
1275
1630
|
resolveElectrobunEngine,
|
|
@@ -1281,6 +1636,7 @@ export {
|
|
|
1281
1636
|
runExploreSession,
|
|
1282
1637
|
runMultiProcessPool,
|
|
1283
1638
|
runOAuthPopupFlow,
|
|
1639
|
+
runTestCommand,
|
|
1284
1640
|
secret,
|
|
1285
1641
|
speculativelyPrelaunchWebBrowser,
|
|
1286
1642
|
startAndroidVideoRecorder,
|