@testmuai/playwright-bindings 0.1.44 → 0.1.45-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/dist/configure.d.ts +3 -0
- package/dist/configure.d.ts.map +1 -1
- package/dist/configure.js +8 -0
- package/dist/configure.js.map +1 -1
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +87 -100
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -37
- package/dist/index.js.map +1 -1
- package/dist/router.d.ts +53 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +137 -0
- package/dist/router.js.map +1 -0
- package/dist/v3/actionEngine.d.ts.map +1 -0
- package/dist/v3/actionEngine.js +194 -0
- package/dist/v3/actionEngine.js.map +1 -0
- package/dist/v3/actionSpecs.d.ts.map +1 -0
- package/dist/v3/actionSpecs.js +354 -0
- package/dist/v3/actionSpecs.js.map +1 -0
- package/dist/v3/capability.d.ts.map +1 -0
- package/dist/v3/capability.js +346 -0
- package/dist/v3/capability.js.map +1 -0
- package/dist/v3/downloadsPath.d.ts.map +1 -0
- package/dist/v3/downloadsPath.js.map +1 -0
- package/dist/v3/healCache.d.ts.map +1 -0
- package/dist/v3/healCache.js.map +1 -0
- package/dist/v3/healPatch.d.ts +22 -0
- package/dist/v3/healPatch.d.ts.map +1 -0
- package/dist/v3/healPatch.js +345 -0
- package/dist/v3/healPatch.js.map +1 -0
- package/dist/v3/helpers/a11yFlatten.d.ts.map +1 -0
- package/dist/v3/helpers/a11yFlatten.js +569 -0
- package/dist/v3/helpers/a11yFlatten.js.map +1 -0
- package/dist/v3/helpers/apiCalls.d.ts.map +1 -0
- package/dist/v3/helpers/apiCalls.js +59 -0
- package/dist/v3/helpers/apiCalls.js.map +1 -0
- package/dist/v3/helpers/assertion.d.ts.map +1 -0
- package/dist/v3/helpers/assertion.js +105 -0
- package/dist/v3/helpers/assertion.js.map +1 -0
- package/dist/v3/helpers/assertionV3.d.ts.map +1 -0
- package/dist/v3/helpers/assertionV3.js.map +1 -0
- package/dist/v3/helpers/autohealAx.d.ts.map +1 -0
- package/dist/v3/helpers/autohealAx.js +148 -0
- package/dist/v3/helpers/autohealAx.js.map +1 -0
- package/dist/v3/helpers/axTree/actionable.d.ts.map +1 -0
- package/dist/v3/helpers/axTree/actionable.js +404 -0
- package/dist/v3/helpers/axTree/actionable.js.map +1 -0
- package/dist/v3/helpers/axTree/captureAxTree.d.ts.map +1 -0
- package/dist/v3/helpers/axTree/captureAxTree.js.map +1 -0
- package/dist/v3/helpers/axTree/captureFrameForest.d.ts.map +1 -0
- package/dist/v3/helpers/axTree/captureFrameForest.js +475 -0
- package/dist/v3/helpers/axTree/captureFrameForest.js.map +1 -0
- package/dist/v3/helpers/axTree/index.d.ts.map +1 -0
- package/dist/v3/helpers/axTree/index.js.map +1 -0
- package/dist/v3/helpers/axTree/serializeAxTree.d.ts.map +1 -0
- package/dist/v3/helpers/axTree/serializeAxTree.js.map +1 -0
- package/dist/v3/helpers/clipboard-intercept.d.ts.map +1 -0
- package/dist/v3/helpers/clipboard-intercept.js.map +1 -0
- package/dist/v3/helpers/clipboard.d.ts.map +1 -0
- package/dist/v3/helpers/clipboard.js.map +1 -0
- package/dist/v3/helpers/condition.d.ts +100 -0
- package/dist/v3/helpers/condition.d.ts.map +1 -0
- package/dist/v3/helpers/condition.js +356 -0
- package/dist/v3/helpers/condition.js.map +1 -0
- package/dist/v3/helpers/cookies.d.ts.map +1 -0
- package/dist/v3/helpers/cookies.js +66 -0
- package/dist/v3/helpers/cookies.js.map +1 -0
- package/dist/v3/helpers/coordinateResolver.d.ts.map +1 -0
- package/dist/v3/helpers/coordinateResolver.js +118 -0
- package/dist/v3/helpers/coordinateResolver.js.map +1 -0
- package/dist/v3/helpers/coordinateResolverRead.d.ts.map +1 -0
- package/dist/v3/helpers/coordinateResolverRead.js +107 -0
- package/dist/v3/helpers/coordinateResolverRead.js.map +1 -0
- package/dist/v3/helpers/credits.d.ts.map +1 -0
- package/dist/v3/helpers/credits.js +52 -0
- package/dist/v3/helpers/credits.js.map +1 -0
- package/dist/v3/helpers/derive.d.ts.map +1 -0
- package/dist/v3/helpers/derive.js +87 -0
- package/dist/v3/helpers/derive.js.map +1 -0
- package/dist/v3/helpers/devtools.d.ts.map +1 -0
- package/dist/v3/helpers/devtools.js +1215 -0
- package/dist/v3/helpers/devtools.js.map +1 -0
- package/dist/v3/helpers/dialog.d.ts.map +1 -0
- package/dist/v3/helpers/dialog.js.map +1 -0
- package/dist/v3/helpers/drag.d.ts.map +1 -0
- package/dist/v3/helpers/drag.js +276 -0
- package/dist/v3/helpers/drag.js.map +1 -0
- package/dist/v3/helpers/evaluation/colors.d.ts.map +1 -0
- package/dist/v3/helpers/evaluation/colors.js.map +1 -0
- package/dist/v3/helpers/evaluation/evaluate.d.ts.map +1 -0
- package/dist/v3/helpers/evaluation/evaluate.js.map +1 -0
- package/dist/v3/helpers/executeApi.d.ts.map +1 -0
- package/dist/v3/helpers/executeApi.js +373 -0
- package/dist/v3/helpers/executeApi.js.map +1 -0
- package/dist/v3/helpers/executeDb.d.ts.map +1 -0
- package/dist/v3/helpers/executeDb.js +54 -0
- package/dist/v3/helpers/executeDb.js.map +1 -0
- package/dist/v3/helpers/executeJs.d.ts.map +1 -0
- package/dist/v3/helpers/executeJs.js +93 -0
- package/dist/v3/helpers/executeJs.js.map +1 -0
- package/dist/v3/helpers/gesture.d.ts.map +1 -0
- package/dist/v3/helpers/gesture.js +131 -0
- package/dist/v3/helpers/gesture.js.map +1 -0
- package/dist/v3/helpers/healCascade.d.ts.map +1 -0
- package/dist/v3/helpers/healCascade.js +418 -0
- package/dist/v3/helpers/healCascade.js.map +1 -0
- package/dist/v3/helpers/iframeA11y.d.ts.map +1 -0
- package/dist/v3/helpers/iframeA11y.js +128 -0
- package/dist/v3/helpers/iframeA11y.js.map +1 -0
- package/dist/v3/helpers/kaneCli.d.ts.map +1 -0
- package/dist/v3/helpers/kaneCli.js +319 -0
- package/dist/v3/helpers/kaneCli.js.map +1 -0
- package/dist/v3/helpers/loop.d.ts +4 -0
- package/dist/v3/helpers/loop.d.ts.map +1 -0
- package/dist/v3/helpers/loop.js +4 -0
- package/dist/v3/helpers/loop.js.map +1 -0
- package/dist/v3/helpers/math.d.ts.map +1 -0
- package/dist/v3/helpers/math.js +119 -0
- package/dist/v3/helpers/math.js.map +1 -0
- package/dist/v3/helpers/network.d.ts.map +1 -0
- package/dist/v3/helpers/network.js +185 -0
- package/dist/v3/helpers/network.js.map +1 -0
- package/dist/v3/helpers/pageReady.d.ts.map +1 -0
- package/dist/v3/helpers/pageReady.js +85 -0
- package/dist/v3/helpers/pageReady.js.map +1 -0
- package/dist/v3/helpers/png.d.ts.map +1 -0
- package/dist/v3/helpers/png.js.map +1 -0
- package/dist/v3/helpers/queryResult.d.ts.map +1 -0
- package/dist/v3/helpers/queryResult.js.map +1 -0
- package/dist/v3/helpers/runtimeSnapshot.d.ts.map +1 -0
- package/dist/v3/helpers/runtimeSnapshot.js +204 -0
- package/dist/v3/helpers/runtimeSnapshot.js.map +1 -0
- package/dist/v3/helpers/schemaAssertion.d.ts.map +1 -0
- package/dist/v3/helpers/schemaAssertion.js +117 -0
- package/dist/v3/helpers/schemaAssertion.js.map +1 -0
- package/dist/v3/helpers/screenshot.d.ts +41 -0
- package/dist/v3/helpers/screenshot.d.ts.map +1 -0
- package/dist/v3/helpers/screenshot.js +83 -0
- package/dist/v3/helpers/screenshot.js.map +1 -0
- package/dist/v3/helpers/scrollUntil.d.ts.map +1 -0
- package/dist/v3/helpers/scrollUntil.js +90 -0
- package/dist/v3/helpers/scrollUntil.js.map +1 -0
- package/dist/v3/helpers/smartui.d.ts.map +1 -0
- package/dist/v3/helpers/smartui.js +77 -0
- package/dist/v3/helpers/smartui.js.map +1 -0
- package/dist/v3/helpers/sseParser.d.ts.map +1 -0
- package/dist/v3/helpers/sseParser.js.map +1 -0
- package/dist/v3/helpers/tabs.d.ts +43 -0
- package/dist/v3/helpers/tabs.d.ts.map +1 -0
- package/dist/v3/helpers/tabs.js +258 -0
- package/dist/v3/helpers/tabs.js.map +1 -0
- package/dist/v3/helpers/text.d.ts.map +1 -0
- package/dist/v3/helpers/text.js.map +1 -0
- package/dist/v3/helpers/textNormalize.d.ts.map +1 -0
- package/dist/v3/helpers/textNormalize.js.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/domStructured.d.ts.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/domStructured.js +242 -0
- package/dist/v3/helpers/textualAnalyzer/domStructured.js.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/evaluate.d.ts.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/evaluate.js.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/extractor.d.ts.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/extractor.js.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/heal.d.ts.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/heal.js +120 -0
- package/dist/v3/helpers/textualAnalyzer/heal.js.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/index.d.ts.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/index.js +60 -0
- package/dist/v3/helpers/textualAnalyzer/index.js.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/locatorEnrichment.d.ts.map +1 -0
- package/dist/v3/helpers/textualAnalyzer/locatorEnrichment.js +224 -0
- package/dist/v3/helpers/textualAnalyzer/locatorEnrichment.js.map +1 -0
- package/dist/v3/helpers/textualRead.d.ts.map +1 -0
- package/dist/v3/helpers/textualRead.js.map +1 -0
- package/dist/v3/helpers/vision.d.ts +79 -0
- package/dist/v3/helpers/vision.d.ts.map +1 -0
- package/dist/v3/helpers/vision.js +235 -0
- package/dist/v3/helpers/vision.js.map +1 -0
- package/dist/v3/helpers/visionFence.d.ts.map +1 -0
- package/dist/v3/helpers/visionFence.js.map +1 -0
- package/dist/v3/helpers/visionV3.d.ts +52 -0
- package/dist/v3/helpers/visionV3.d.ts.map +1 -0
- package/dist/v3/helpers/visionV3.js +366 -0
- package/dist/v3/helpers/visionV3.js.map +1 -0
- package/dist/v3/helpers/wait.d.ts.map +1 -0
- package/dist/v3/helpers/wait.js +48 -0
- package/dist/v3/helpers/wait.js.map +1 -0
- package/dist/v3/http.d.ts.map +1 -0
- package/dist/v3/http.js +45 -0
- package/dist/v3/http.js.map +1 -0
- package/dist/v3/httpClient.d.ts.map +1 -0
- package/dist/v3/httpClient.js.map +1 -0
- package/dist/v3/index.d.ts +40 -0
- package/dist/v3/index.d.ts.map +1 -0
- package/dist/v3/index.js +41 -0
- package/dist/v3/index.js.map +1 -0
- package/dist/v3/rankedLocator.d.ts.map +1 -0
- package/dist/v3/rankedLocator.js +85 -0
- package/dist/v3/rankedLocator.js.map +1 -0
- package/dist/v3/relayProxy.d.ts.map +1 -0
- package/dist/v3/relayProxy.js +485 -0
- package/dist/v3/relayProxy.js.map +1 -0
- package/dist/v3/reporters/index.d.ts.map +1 -0
- package/dist/v3/reporters/index.js +7 -0
- package/dist/v3/reporters/index.js.map +1 -0
- package/dist/v3/reporters/local.d.ts.map +1 -0
- package/dist/v3/reporters/local.js +40 -0
- package/dist/v3/reporters/local.js.map +1 -0
- package/dist/v3/reporters/lt.d.ts.map +1 -0
- package/dist/v3/reporters/lt.js +122 -0
- package/dist/v3/reporters/lt.js.map +1 -0
- package/dist/v3/reporters/null.d.ts.map +1 -0
- package/dist/v3/reporters/null.js.map +1 -0
- package/dist/v3/routeFailure.d.ts.map +1 -0
- package/dist/v3/routeFailure.js +34 -0
- package/dist/v3/routeFailure.js.map +1 -0
- package/dist/v3/session.d.ts.map +1 -0
- package/dist/v3/session.js +312 -0
- package/dist/v3/session.js.map +1 -0
- package/dist/v3/step.d.ts.map +1 -0
- package/dist/v3/step.js +112 -0
- package/dist/v3/step.js.map +1 -0
- package/dist/v3/stepVariables.d.ts.map +1 -0
- package/dist/v3/stepVariables.js +61 -0
- package/dist/v3/stepVariables.js.map +1 -0
- package/dist/v3/test.d.ts.map +1 -0
- package/dist/v3/test.js.map +1 -0
- package/dist/v3/testConfig.d.ts.map +1 -0
- package/dist/v3/testConfig.js.map +1 -0
- package/dist/v3/testState.d.ts.map +1 -0
- package/dist/v3/testState.js.map +1 -0
- package/dist/v3/vars.d.ts +84 -0
- package/dist/v3/vars.d.ts.map +1 -0
- package/dist/v3/vars.js +913 -0
- package/dist/v3/vars.js.map +1 -0
- package/dist/v3/visionLocator.d.ts.map +1 -0
- package/dist/v3/visionLocator.js +117 -0
- package/dist/v3/visionLocator.js.map +1 -0
- package/dist/v4/actionEngine.d.ts +37 -0
- package/dist/v4/actionEngine.d.ts.map +1 -0
- package/dist/v4/actionEngine.js +194 -0
- package/dist/v4/actionEngine.js.map +1 -0
- package/dist/v4/actionSpecs.d.ts +35 -0
- package/dist/v4/actionSpecs.d.ts.map +1 -0
- package/dist/v4/actionSpecs.js +354 -0
- package/dist/v4/actionSpecs.js.map +1 -0
- package/dist/v4/capability.d.ts +81 -0
- package/dist/v4/capability.d.ts.map +1 -0
- package/dist/v4/capability.js +346 -0
- package/dist/v4/capability.js.map +1 -0
- package/dist/v4/downloadsPath.d.ts +17 -0
- package/dist/v4/downloadsPath.d.ts.map +1 -0
- package/dist/v4/downloadsPath.js +26 -0
- package/dist/v4/downloadsPath.js.map +1 -0
- package/dist/v4/healCache.d.ts +28 -0
- package/dist/v4/healCache.d.ts.map +1 -0
- package/dist/v4/healCache.js +17 -0
- package/dist/v4/healCache.js.map +1 -0
- package/dist/v4/healPatch.d.ts +22 -0
- package/dist/v4/healPatch.d.ts.map +1 -0
- package/dist/v4/healPatch.js +415 -0
- package/dist/v4/healPatch.js.map +1 -0
- package/dist/v4/helpers/a11yFlatten.d.ts +37 -0
- package/dist/v4/helpers/a11yFlatten.d.ts.map +1 -0
- package/dist/v4/helpers/a11yFlatten.js +569 -0
- package/dist/v4/helpers/a11yFlatten.js.map +1 -0
- package/dist/v4/helpers/apiCalls.d.ts +26 -0
- package/dist/v4/helpers/apiCalls.d.ts.map +1 -0
- package/dist/v4/helpers/apiCalls.js +59 -0
- package/dist/v4/helpers/apiCalls.js.map +1 -0
- package/dist/v4/helpers/assertion.d.ts +26 -0
- package/dist/v4/helpers/assertion.d.ts.map +1 -0
- package/dist/v4/helpers/assertion.js +134 -0
- package/dist/v4/helpers/assertion.js.map +1 -0
- package/dist/v4/helpers/assertionV3.d.ts +70 -0
- package/dist/v4/helpers/assertionV3.d.ts.map +1 -0
- package/dist/v4/helpers/assertionV3.js +400 -0
- package/dist/v4/helpers/assertionV3.js.map +1 -0
- package/dist/v4/helpers/autohealAx.d.ts +41 -0
- package/dist/v4/helpers/autohealAx.d.ts.map +1 -0
- package/dist/v4/helpers/autohealAx.js +148 -0
- package/dist/v4/helpers/autohealAx.js.map +1 -0
- package/dist/v4/helpers/axTree/actionable.d.ts +143 -0
- package/dist/v4/helpers/axTree/actionable.d.ts.map +1 -0
- package/dist/v4/helpers/axTree/actionable.js +404 -0
- package/dist/v4/helpers/axTree/actionable.js.map +1 -0
- package/dist/v4/helpers/axTree/captureAxTree.d.ts +21 -0
- package/dist/v4/helpers/axTree/captureAxTree.d.ts.map +1 -0
- package/dist/v4/helpers/axTree/captureAxTree.js +15 -0
- package/dist/v4/helpers/axTree/captureAxTree.js.map +1 -0
- package/dist/v4/helpers/axTree/captureFrameForest.d.ts +52 -0
- package/dist/v4/helpers/axTree/captureFrameForest.d.ts.map +1 -0
- package/dist/v4/helpers/axTree/captureFrameForest.js +475 -0
- package/dist/v4/helpers/axTree/captureFrameForest.js.map +1 -0
- package/dist/v4/helpers/axTree/index.d.ts +10 -0
- package/dist/v4/helpers/axTree/index.d.ts.map +1 -0
- package/dist/v4/helpers/axTree/index.js +8 -0
- package/dist/v4/helpers/axTree/index.js.map +1 -0
- package/dist/v4/helpers/axTree/serializeAxTree.d.ts +106 -0
- package/dist/v4/helpers/axTree/serializeAxTree.d.ts.map +1 -0
- package/dist/v4/helpers/axTree/serializeAxTree.js +238 -0
- package/dist/v4/helpers/axTree/serializeAxTree.js.map +1 -0
- package/dist/v4/helpers/clipboard-intercept.d.ts +5 -0
- package/dist/v4/helpers/clipboard-intercept.d.ts.map +1 -0
- package/dist/v4/helpers/clipboard-intercept.js +149 -0
- package/dist/v4/helpers/clipboard-intercept.js.map +1 -0
- package/dist/v4/helpers/clipboard.d.ts +27 -0
- package/dist/v4/helpers/clipboard.d.ts.map +1 -0
- package/dist/v4/helpers/clipboard.js +70 -0
- package/dist/v4/helpers/clipboard.js.map +1 -0
- package/dist/v4/helpers/condition.d.ts +100 -0
- package/dist/v4/helpers/condition.d.ts.map +1 -0
- package/dist/v4/helpers/condition.js +356 -0
- package/dist/v4/helpers/condition.js.map +1 -0
- package/dist/v4/helpers/cookies.d.ts +12 -0
- package/dist/v4/helpers/cookies.d.ts.map +1 -0
- package/dist/v4/helpers/cookies.js +66 -0
- package/dist/v4/helpers/cookies.js.map +1 -0
- package/dist/v4/helpers/coordinateResolver.d.ts +29 -0
- package/dist/v4/helpers/coordinateResolver.d.ts.map +1 -0
- package/dist/v4/helpers/coordinateResolver.js +118 -0
- package/dist/v4/helpers/coordinateResolver.js.map +1 -0
- package/dist/v4/helpers/credits.d.ts +19 -0
- package/dist/v4/helpers/credits.d.ts.map +1 -0
- package/dist/v4/helpers/credits.js +52 -0
- package/dist/v4/helpers/credits.js.map +1 -0
- package/dist/v4/helpers/derive.d.ts +27 -0
- package/dist/v4/helpers/derive.d.ts.map +1 -0
- package/dist/v4/helpers/derive.js +87 -0
- package/dist/v4/helpers/derive.js.map +1 -0
- package/dist/v4/helpers/devtools.d.ts +39 -0
- package/dist/v4/helpers/devtools.d.ts.map +1 -0
- package/dist/v4/helpers/devtools.js +1215 -0
- package/dist/v4/helpers/devtools.js.map +1 -0
- package/dist/v4/helpers/dialog.d.ts +29 -0
- package/dist/v4/helpers/dialog.d.ts.map +1 -0
- package/dist/v4/helpers/dialog.js +35 -0
- package/dist/v4/helpers/dialog.js.map +1 -0
- package/dist/v4/helpers/drag.d.ts +38 -0
- package/dist/v4/helpers/drag.d.ts.map +1 -0
- package/dist/v4/helpers/drag.js +245 -0
- package/dist/v4/helpers/drag.js.map +1 -0
- package/dist/v4/helpers/evaluation/colors.d.ts +2 -0
- package/dist/v4/helpers/evaluation/colors.d.ts.map +1 -0
- package/dist/v4/helpers/evaluation/colors.js +151 -0
- package/dist/v4/helpers/evaluation/colors.js.map +1 -0
- package/dist/v4/helpers/evaluation/evaluate.d.ts +10 -0
- package/dist/v4/helpers/evaluation/evaluate.d.ts.map +1 -0
- package/dist/v4/helpers/evaluation/evaluate.js +423 -0
- package/dist/v4/helpers/evaluation/evaluate.js.map +1 -0
- package/dist/v4/helpers/executeApi.d.ts +63 -0
- package/dist/v4/helpers/executeApi.d.ts.map +1 -0
- package/dist/v4/helpers/executeApi.js +363 -0
- package/dist/v4/helpers/executeApi.js.map +1 -0
- package/dist/v4/helpers/executeDb.d.ts +11 -0
- package/dist/v4/helpers/executeDb.d.ts.map +1 -0
- package/dist/v4/helpers/executeDb.js +54 -0
- package/dist/v4/helpers/executeDb.js.map +1 -0
- package/dist/v4/helpers/executeJs.d.ts +16 -0
- package/dist/v4/helpers/executeJs.d.ts.map +1 -0
- package/dist/v4/helpers/executeJs.js +86 -0
- package/dist/v4/helpers/executeJs.js.map +1 -0
- package/dist/v4/helpers/gesture.d.ts +45 -0
- package/dist/v4/helpers/gesture.d.ts.map +1 -0
- package/dist/v4/helpers/gesture.js +131 -0
- package/dist/v4/helpers/gesture.js.map +1 -0
- package/dist/v4/helpers/healCascade.d.ts +39 -0
- package/dist/v4/helpers/healCascade.d.ts.map +1 -0
- package/dist/v4/helpers/healCascade.js +418 -0
- package/dist/v4/helpers/healCascade.js.map +1 -0
- package/dist/v4/helpers/kaneCli.d.ts +18 -0
- package/dist/v4/helpers/kaneCli.d.ts.map +1 -0
- package/dist/v4/helpers/kaneCli.js +319 -0
- package/dist/v4/helpers/kaneCli.js.map +1 -0
- package/dist/v4/helpers/loop.d.ts +4 -0
- package/dist/v4/helpers/loop.d.ts.map +1 -0
- package/dist/v4/helpers/loop.js +4 -0
- package/dist/v4/helpers/loop.js.map +1 -0
- package/dist/v4/helpers/math.d.ts +19 -0
- package/dist/v4/helpers/math.d.ts.map +1 -0
- package/dist/v4/helpers/math.js +117 -0
- package/dist/v4/helpers/math.js.map +1 -0
- package/dist/v4/helpers/network.d.ts +27 -0
- package/dist/v4/helpers/network.d.ts.map +1 -0
- package/dist/v4/helpers/network.js +185 -0
- package/dist/v4/helpers/network.js.map +1 -0
- package/dist/v4/helpers/pageReady.d.ts +27 -0
- package/dist/v4/helpers/pageReady.d.ts.map +1 -0
- package/dist/v4/helpers/pageReady.js +69 -0
- package/dist/v4/helpers/pageReady.js.map +1 -0
- package/dist/v4/helpers/png.d.ts +3 -0
- package/dist/v4/helpers/png.d.ts.map +1 -0
- package/dist/v4/helpers/png.js +18 -0
- package/dist/v4/helpers/png.js.map +1 -0
- package/dist/v4/helpers/queryResult.d.ts +13 -0
- package/dist/v4/helpers/queryResult.d.ts.map +1 -0
- package/dist/v4/helpers/queryResult.js +27 -0
- package/dist/v4/helpers/queryResult.js.map +1 -0
- package/dist/v4/helpers/runtimeSnapshot.d.ts +37 -0
- package/dist/v4/helpers/runtimeSnapshot.d.ts.map +1 -0
- package/dist/v4/helpers/runtimeSnapshot.js +101 -0
- package/dist/v4/helpers/runtimeSnapshot.js.map +1 -0
- package/dist/v4/helpers/schemaAssertion.d.ts +12 -0
- package/dist/v4/helpers/schemaAssertion.d.ts.map +1 -0
- package/dist/v4/helpers/schemaAssertion.js +117 -0
- package/dist/v4/helpers/schemaAssertion.js.map +1 -0
- package/dist/v4/helpers/screenshot.d.ts +40 -0
- package/dist/v4/helpers/screenshot.d.ts.map +1 -0
- package/dist/v4/helpers/screenshot.js +82 -0
- package/dist/v4/helpers/screenshot.js.map +1 -0
- package/dist/v4/helpers/scrollUntil.d.ts +13 -0
- package/dist/v4/helpers/scrollUntil.d.ts.map +1 -0
- package/dist/v4/helpers/scrollUntil.js +90 -0
- package/dist/v4/helpers/scrollUntil.js.map +1 -0
- package/dist/v4/helpers/smartui.d.ts +9 -0
- package/dist/v4/helpers/smartui.d.ts.map +1 -0
- package/dist/v4/helpers/smartui.js +77 -0
- package/dist/v4/helpers/smartui.js.map +1 -0
- package/dist/v4/helpers/sseParser.d.ts +34 -0
- package/dist/v4/helpers/sseParser.d.ts.map +1 -0
- package/dist/v4/helpers/sseParser.js +128 -0
- package/dist/v4/helpers/sseParser.js.map +1 -0
- package/dist/v4/helpers/tabs.d.ts +32 -0
- package/dist/v4/helpers/tabs.d.ts.map +1 -0
- package/dist/v4/helpers/tabs.js +89 -0
- package/dist/v4/helpers/tabs.js.map +1 -0
- package/dist/v4/helpers/text.d.ts +15 -0
- package/dist/v4/helpers/text.d.ts.map +1 -0
- package/dist/v4/helpers/text.js +24 -0
- package/dist/v4/helpers/text.js.map +1 -0
- package/dist/v4/helpers/textNormalize.d.ts +18 -0
- package/dist/v4/helpers/textNormalize.d.ts.map +1 -0
- package/dist/v4/helpers/textNormalize.js +39 -0
- package/dist/v4/helpers/textNormalize.js.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/domStructured.d.ts +44 -0
- package/dist/v4/helpers/textualAnalyzer/domStructured.d.ts.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/domStructured.js +242 -0
- package/dist/v4/helpers/textualAnalyzer/domStructured.js.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/evaluate.d.ts +14 -0
- package/dist/v4/helpers/textualAnalyzer/evaluate.d.ts.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/evaluate.js +5 -0
- package/dist/v4/helpers/textualAnalyzer/evaluate.js.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/extractor.d.ts +21 -0
- package/dist/v4/helpers/textualAnalyzer/extractor.d.ts.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/extractor.js +38 -0
- package/dist/v4/helpers/textualAnalyzer/extractor.js.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/heal.d.ts +25 -0
- package/dist/v4/helpers/textualAnalyzer/heal.d.ts.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/heal.js +120 -0
- package/dist/v4/helpers/textualAnalyzer/heal.js.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/index.d.ts +29 -0
- package/dist/v4/helpers/textualAnalyzer/index.d.ts.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/index.js +60 -0
- package/dist/v4/helpers/textualAnalyzer/index.js.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/locatorEnrichment.d.ts +47 -0
- package/dist/v4/helpers/textualAnalyzer/locatorEnrichment.d.ts.map +1 -0
- package/dist/v4/helpers/textualAnalyzer/locatorEnrichment.js +224 -0
- package/dist/v4/helpers/textualAnalyzer/locatorEnrichment.js.map +1 -0
- package/dist/v4/helpers/vision.d.ts.map +1 -0
- package/dist/v4/helpers/vision.js +487 -0
- package/dist/v4/helpers/vision.js.map +1 -0
- package/dist/v4/helpers/wait.d.ts +16 -0
- package/dist/v4/helpers/wait.d.ts.map +1 -0
- package/dist/v4/helpers/wait.js +48 -0
- package/dist/v4/helpers/wait.js.map +1 -0
- package/dist/v4/http.d.ts +14 -0
- package/dist/v4/http.d.ts.map +1 -0
- package/dist/v4/http.js +45 -0
- package/dist/v4/http.js.map +1 -0
- package/dist/v4/httpClient.d.ts +18 -0
- package/dist/v4/httpClient.d.ts.map +1 -0
- package/dist/v4/httpClient.js +140 -0
- package/dist/v4/httpClient.js.map +1 -0
- package/dist/v4/index.d.ts +40 -0
- package/dist/v4/index.d.ts.map +1 -0
- package/dist/v4/index.js +41 -0
- package/dist/v4/index.js.map +1 -0
- package/dist/v4/rankedLocator.d.ts +27 -0
- package/dist/v4/rankedLocator.d.ts.map +1 -0
- package/dist/v4/rankedLocator.js +85 -0
- package/dist/v4/rankedLocator.js.map +1 -0
- package/dist/v4/relayProxy.d.ts +46 -0
- package/dist/v4/relayProxy.d.ts.map +1 -0
- package/dist/v4/relayProxy.js +485 -0
- package/dist/v4/relayProxy.js.map +1 -0
- package/dist/v4/reporters/index.d.ts +33 -0
- package/dist/v4/reporters/index.d.ts.map +1 -0
- package/dist/v4/reporters/index.js +7 -0
- package/dist/v4/reporters/index.js.map +1 -0
- package/dist/v4/reporters/local.d.ts +13 -0
- package/dist/v4/reporters/local.d.ts.map +1 -0
- package/dist/v4/reporters/local.js +40 -0
- package/dist/v4/reporters/local.js.map +1 -0
- package/dist/v4/reporters/lt.d.ts +28 -0
- package/dist/v4/reporters/lt.d.ts.map +1 -0
- package/dist/v4/reporters/lt.js +110 -0
- package/dist/v4/reporters/lt.js.map +1 -0
- package/dist/v4/reporters/null.d.ts +11 -0
- package/dist/v4/reporters/null.d.ts.map +1 -0
- package/dist/v4/reporters/null.js +10 -0
- package/dist/v4/reporters/null.js.map +1 -0
- package/dist/v4/routeFailure.d.ts +9 -0
- package/dist/v4/routeFailure.d.ts.map +1 -0
- package/dist/v4/routeFailure.js +34 -0
- package/dist/v4/routeFailure.js.map +1 -0
- package/dist/v4/session.d.ts +22 -0
- package/dist/v4/session.d.ts.map +1 -0
- package/dist/v4/session.js +312 -0
- package/dist/v4/session.js.map +1 -0
- package/dist/v4/step.d.ts +53 -0
- package/dist/v4/step.d.ts.map +1 -0
- package/dist/v4/step.js +95 -0
- package/dist/v4/step.js.map +1 -0
- package/dist/v4/stepVariables.d.ts +15 -0
- package/dist/v4/stepVariables.d.ts.map +1 -0
- package/dist/v4/stepVariables.js +61 -0
- package/dist/v4/stepVariables.js.map +1 -0
- package/dist/v4/test.d.ts +10 -0
- package/dist/v4/test.d.ts.map +1 -0
- package/dist/v4/test.js +5 -0
- package/dist/v4/test.js.map +1 -0
- package/dist/v4/testConfig.d.ts +12 -0
- package/dist/v4/testConfig.d.ts.map +1 -0
- package/dist/v4/testConfig.js +89 -0
- package/dist/v4/testConfig.js.map +1 -0
- package/dist/v4/testState.d.ts +10 -0
- package/dist/v4/testState.d.ts.map +1 -0
- package/dist/v4/testState.js +16 -0
- package/dist/v4/testState.js.map +1 -0
- package/dist/v4/vars.d.ts +84 -0
- package/dist/v4/vars.d.ts.map +1 -0
- package/dist/v4/vars.js +912 -0
- package/dist/v4/vars.js.map +1 -0
- package/dist/v4/visionLocator.d.ts +53 -0
- package/dist/v4/visionLocator.d.ts.map +1 -0
- package/dist/v4/visionLocator.js +117 -0
- package/dist/v4/visionLocator.js.map +1 -0
- package/package.json +1 -1
- package/dist/actionEngine.d.ts.map +0 -1
- package/dist/actionEngine.js +0 -194
- package/dist/actionEngine.js.map +0 -1
- package/dist/actionSpecs.d.ts.map +0 -1
- package/dist/actionSpecs.js +0 -354
- package/dist/actionSpecs.js.map +0 -1
- package/dist/capability.d.ts.map +0 -1
- package/dist/capability.js +0 -346
- package/dist/capability.js.map +0 -1
- package/dist/downloadsPath.d.ts.map +0 -1
- package/dist/downloadsPath.js.map +0 -1
- package/dist/healCache.d.ts.map +0 -1
- package/dist/healCache.js.map +0 -1
- package/dist/healPatch.d.ts +0 -20
- package/dist/healPatch.d.ts.map +0 -1
- package/dist/healPatch.js +0 -429
- package/dist/healPatch.js.map +0 -1
- package/dist/helpers/a11yFlatten.d.ts.map +0 -1
- package/dist/helpers/a11yFlatten.js +0 -569
- package/dist/helpers/a11yFlatten.js.map +0 -1
- package/dist/helpers/apiCalls.d.ts.map +0 -1
- package/dist/helpers/apiCalls.js +0 -59
- package/dist/helpers/apiCalls.js.map +0 -1
- package/dist/helpers/assertion.d.ts.map +0 -1
- package/dist/helpers/assertion.js +0 -152
- package/dist/helpers/assertion.js.map +0 -1
- package/dist/helpers/assertionV3.d.ts.map +0 -1
- package/dist/helpers/assertionV3.js.map +0 -1
- package/dist/helpers/autohealAx.d.ts.map +0 -1
- package/dist/helpers/autohealAx.js +0 -148
- package/dist/helpers/autohealAx.js.map +0 -1
- package/dist/helpers/axTree/actionable.d.ts.map +0 -1
- package/dist/helpers/axTree/actionable.js +0 -404
- package/dist/helpers/axTree/actionable.js.map +0 -1
- package/dist/helpers/axTree/captureAxTree.d.ts.map +0 -1
- package/dist/helpers/axTree/captureAxTree.js.map +0 -1
- package/dist/helpers/axTree/captureFrameForest.d.ts.map +0 -1
- package/dist/helpers/axTree/captureFrameForest.js +0 -475
- package/dist/helpers/axTree/captureFrameForest.js.map +0 -1
- package/dist/helpers/axTree/index.d.ts.map +0 -1
- package/dist/helpers/axTree/index.js.map +0 -1
- package/dist/helpers/axTree/serializeAxTree.d.ts.map +0 -1
- package/dist/helpers/axTree/serializeAxTree.js.map +0 -1
- package/dist/helpers/clipboard-intercept.d.ts.map +0 -1
- package/dist/helpers/clipboard-intercept.js.map +0 -1
- package/dist/helpers/clipboard.d.ts.map +0 -1
- package/dist/helpers/clipboard.js.map +0 -1
- package/dist/helpers/condition.d.ts +0 -100
- package/dist/helpers/condition.d.ts.map +0 -1
- package/dist/helpers/condition.js +0 -357
- package/dist/helpers/condition.js.map +0 -1
- package/dist/helpers/cookies.d.ts.map +0 -1
- package/dist/helpers/cookies.js +0 -66
- package/dist/helpers/cookies.js.map +0 -1
- package/dist/helpers/coordinateResolver.d.ts.map +0 -1
- package/dist/helpers/coordinateResolver.js +0 -118
- package/dist/helpers/coordinateResolver.js.map +0 -1
- package/dist/helpers/coordinateResolverRead.d.ts.map +0 -1
- package/dist/helpers/coordinateResolverRead.js +0 -107
- package/dist/helpers/coordinateResolverRead.js.map +0 -1
- package/dist/helpers/credits.d.ts.map +0 -1
- package/dist/helpers/credits.js +0 -52
- package/dist/helpers/credits.js.map +0 -1
- package/dist/helpers/derive.d.ts.map +0 -1
- package/dist/helpers/derive.js +0 -87
- package/dist/helpers/derive.js.map +0 -1
- package/dist/helpers/devtools.d.ts.map +0 -1
- package/dist/helpers/devtools.js +0 -1215
- package/dist/helpers/devtools.js.map +0 -1
- package/dist/helpers/dialog.d.ts.map +0 -1
- package/dist/helpers/dialog.js.map +0 -1
- package/dist/helpers/drag.d.ts.map +0 -1
- package/dist/helpers/drag.js +0 -276
- package/dist/helpers/drag.js.map +0 -1
- package/dist/helpers/evaluation/colors.d.ts.map +0 -1
- package/dist/helpers/evaluation/colors.js.map +0 -1
- package/dist/helpers/evaluation/evaluate.d.ts.map +0 -1
- package/dist/helpers/evaluation/evaluate.js.map +0 -1
- package/dist/helpers/executeApi.d.ts.map +0 -1
- package/dist/helpers/executeApi.js +0 -377
- package/dist/helpers/executeApi.js.map +0 -1
- package/dist/helpers/executeDb.d.ts.map +0 -1
- package/dist/helpers/executeDb.js +0 -54
- package/dist/helpers/executeDb.js.map +0 -1
- package/dist/helpers/executeJs.d.ts.map +0 -1
- package/dist/helpers/executeJs.js +0 -117
- package/dist/helpers/executeJs.js.map +0 -1
- package/dist/helpers/gesture.d.ts.map +0 -1
- package/dist/helpers/gesture.js +0 -131
- package/dist/helpers/gesture.js.map +0 -1
- package/dist/helpers/healCascade.d.ts.map +0 -1
- package/dist/helpers/healCascade.js +0 -418
- package/dist/helpers/healCascade.js.map +0 -1
- package/dist/helpers/iframeA11y.d.ts.map +0 -1
- package/dist/helpers/iframeA11y.js +0 -128
- package/dist/helpers/iframeA11y.js.map +0 -1
- package/dist/helpers/kaneCli.d.ts.map +0 -1
- package/dist/helpers/kaneCli.js +0 -319
- package/dist/helpers/kaneCli.js.map +0 -1
- package/dist/helpers/loop.d.ts +0 -6
- package/dist/helpers/loop.d.ts.map +0 -1
- package/dist/helpers/loop.js +0 -9
- package/dist/helpers/loop.js.map +0 -1
- package/dist/helpers/math.d.ts.map +0 -1
- package/dist/helpers/math.js +0 -152
- package/dist/helpers/math.js.map +0 -1
- package/dist/helpers/network.d.ts.map +0 -1
- package/dist/helpers/network.js +0 -185
- package/dist/helpers/network.js.map +0 -1
- package/dist/helpers/pageReady.d.ts.map +0 -1
- package/dist/helpers/pageReady.js +0 -85
- package/dist/helpers/pageReady.js.map +0 -1
- package/dist/helpers/png.d.ts.map +0 -1
- package/dist/helpers/png.js.map +0 -1
- package/dist/helpers/queryResult.d.ts.map +0 -1
- package/dist/helpers/queryResult.js.map +0 -1
- package/dist/helpers/runtimeSnapshot.d.ts.map +0 -1
- package/dist/helpers/runtimeSnapshot.js +0 -204
- package/dist/helpers/runtimeSnapshot.js.map +0 -1
- package/dist/helpers/schemaAssertion.d.ts.map +0 -1
- package/dist/helpers/schemaAssertion.js +0 -117
- package/dist/helpers/schemaAssertion.js.map +0 -1
- package/dist/helpers/screenshot.d.ts +0 -45
- package/dist/helpers/screenshot.d.ts.map +0 -1
- package/dist/helpers/screenshot.js +0 -90
- package/dist/helpers/screenshot.js.map +0 -1
- package/dist/helpers/scrollUntil.d.ts.map +0 -1
- package/dist/helpers/scrollUntil.js +0 -90
- package/dist/helpers/scrollUntil.js.map +0 -1
- package/dist/helpers/smartui.d.ts.map +0 -1
- package/dist/helpers/smartui.js +0 -77
- package/dist/helpers/smartui.js.map +0 -1
- package/dist/helpers/sseParser.d.ts.map +0 -1
- package/dist/helpers/sseParser.js.map +0 -1
- package/dist/helpers/tabs.d.ts +0 -44
- package/dist/helpers/tabs.d.ts.map +0 -1
- package/dist/helpers/tabs.js +0 -270
- package/dist/helpers/tabs.js.map +0 -1
- package/dist/helpers/text.d.ts.map +0 -1
- package/dist/helpers/text.js.map +0 -1
- package/dist/helpers/textNormalize.d.ts.map +0 -1
- package/dist/helpers/textNormalize.js.map +0 -1
- package/dist/helpers/textualAnalyzer/domStructured.d.ts.map +0 -1
- package/dist/helpers/textualAnalyzer/domStructured.js +0 -242
- package/dist/helpers/textualAnalyzer/domStructured.js.map +0 -1
- package/dist/helpers/textualAnalyzer/evaluate.d.ts.map +0 -1
- package/dist/helpers/textualAnalyzer/evaluate.js.map +0 -1
- package/dist/helpers/textualAnalyzer/extractor.d.ts.map +0 -1
- package/dist/helpers/textualAnalyzer/extractor.js.map +0 -1
- package/dist/helpers/textualAnalyzer/heal.d.ts.map +0 -1
- package/dist/helpers/textualAnalyzer/heal.js +0 -120
- package/dist/helpers/textualAnalyzer/heal.js.map +0 -1
- package/dist/helpers/textualAnalyzer/index.d.ts.map +0 -1
- package/dist/helpers/textualAnalyzer/index.js +0 -60
- package/dist/helpers/textualAnalyzer/index.js.map +0 -1
- package/dist/helpers/textualAnalyzer/locatorEnrichment.d.ts.map +0 -1
- package/dist/helpers/textualAnalyzer/locatorEnrichment.js +0 -224
- package/dist/helpers/textualAnalyzer/locatorEnrichment.js.map +0 -1
- package/dist/helpers/textualRead.d.ts.map +0 -1
- package/dist/helpers/textualRead.js.map +0 -1
- package/dist/helpers/vision.d.ts.map +0 -1
- package/dist/helpers/vision.js +0 -498
- package/dist/helpers/vision.js.map +0 -1
- package/dist/helpers/visionFence.d.ts.map +0 -1
- package/dist/helpers/visionFence.js.map +0 -1
- package/dist/helpers/visionV3.d.ts +0 -52
- package/dist/helpers/visionV3.d.ts.map +0 -1
- package/dist/helpers/visionV3.js +0 -366
- package/dist/helpers/visionV3.js.map +0 -1
- package/dist/helpers/wait.d.ts.map +0 -1
- package/dist/helpers/wait.js +0 -48
- package/dist/helpers/wait.js.map +0 -1
- package/dist/http.d.ts.map +0 -1
- package/dist/http.js +0 -45
- package/dist/http.js.map +0 -1
- package/dist/httpClient.d.ts.map +0 -1
- package/dist/httpClient.js.map +0 -1
- package/dist/rankedLocator.d.ts.map +0 -1
- package/dist/rankedLocator.js +0 -85
- package/dist/rankedLocator.js.map +0 -1
- package/dist/relayProxy.d.ts.map +0 -1
- package/dist/relayProxy.js +0 -485
- package/dist/relayProxy.js.map +0 -1
- package/dist/reporters/index.d.ts.map +0 -1
- package/dist/reporters/index.js +0 -7
- package/dist/reporters/index.js.map +0 -1
- package/dist/reporters/local.d.ts.map +0 -1
- package/dist/reporters/local.js +0 -40
- package/dist/reporters/local.js.map +0 -1
- package/dist/reporters/lt.d.ts.map +0 -1
- package/dist/reporters/lt.js +0 -127
- package/dist/reporters/lt.js.map +0 -1
- package/dist/reporters/null.d.ts.map +0 -1
- package/dist/reporters/null.js.map +0 -1
- package/dist/routeFailure.d.ts.map +0 -1
- package/dist/routeFailure.js +0 -34
- package/dist/routeFailure.js.map +0 -1
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -312
- package/dist/session.js.map +0 -1
- package/dist/step.d.ts.map +0 -1
- package/dist/step.js +0 -112
- package/dist/step.js.map +0 -1
- package/dist/stepVariables.d.ts.map +0 -1
- package/dist/stepVariables.js +0 -61
- package/dist/stepVariables.js.map +0 -1
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js.map +0 -1
- package/dist/testConfig.d.ts.map +0 -1
- package/dist/testConfig.js.map +0 -1
- package/dist/testState.d.ts.map +0 -1
- package/dist/testState.js.map +0 -1
- package/dist/vars.d.ts +0 -78
- package/dist/vars.d.ts.map +0 -1
- package/dist/vars.js +0 -912
- package/dist/vars.js.map +0 -1
- package/dist/visionLocator.d.ts.map +0 -1
- package/dist/visionLocator.js +0 -117
- package/dist/visionLocator.js.map +0 -1
- /package/dist/{actionEngine.d.ts → v3/actionEngine.d.ts} +0 -0
- /package/dist/{actionSpecs.d.ts → v3/actionSpecs.d.ts} +0 -0
- /package/dist/{capability.d.ts → v3/capability.d.ts} +0 -0
- /package/dist/{downloadsPath.d.ts → v3/downloadsPath.d.ts} +0 -0
- /package/dist/{downloadsPath.js → v3/downloadsPath.js} +0 -0
- /package/dist/{healCache.d.ts → v3/healCache.d.ts} +0 -0
- /package/dist/{healCache.js → v3/healCache.js} +0 -0
- /package/dist/{helpers → v3/helpers}/a11yFlatten.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/apiCalls.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/assertion.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/assertionV3.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/assertionV3.js +0 -0
- /package/dist/{helpers → v3/helpers}/autohealAx.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/actionable.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/captureAxTree.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/captureAxTree.js +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/captureFrameForest.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/index.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/index.js +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/serializeAxTree.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/axTree/serializeAxTree.js +0 -0
- /package/dist/{helpers → v3/helpers}/clipboard-intercept.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/clipboard-intercept.js +0 -0
- /package/dist/{helpers → v3/helpers}/clipboard.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/clipboard.js +0 -0
- /package/dist/{helpers → v3/helpers}/cookies.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/coordinateResolver.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/coordinateResolverRead.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/credits.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/derive.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/devtools.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/dialog.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/dialog.js +0 -0
- /package/dist/{helpers → v3/helpers}/drag.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/evaluation/colors.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/evaluation/colors.js +0 -0
- /package/dist/{helpers → v3/helpers}/evaluation/evaluate.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/evaluation/evaluate.js +0 -0
- /package/dist/{helpers → v3/helpers}/executeApi.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/executeDb.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/executeJs.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/gesture.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/healCascade.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/iframeA11y.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/kaneCli.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/math.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/network.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/pageReady.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/png.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/png.js +0 -0
- /package/dist/{helpers → v3/helpers}/queryResult.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/queryResult.js +0 -0
- /package/dist/{helpers → v3/helpers}/runtimeSnapshot.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/schemaAssertion.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/scrollUntil.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/smartui.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/sseParser.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/sseParser.js +0 -0
- /package/dist/{helpers → v3/helpers}/text.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/text.js +0 -0
- /package/dist/{helpers → v3/helpers}/textNormalize.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textNormalize.js +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/domStructured.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/evaluate.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/evaluate.js +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/extractor.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/extractor.js +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/heal.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/index.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textualAnalyzer/locatorEnrichment.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textualRead.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/textualRead.js +0 -0
- /package/dist/{helpers → v3/helpers}/visionFence.d.ts +0 -0
- /package/dist/{helpers → v3/helpers}/visionFence.js +0 -0
- /package/dist/{helpers → v3/helpers}/wait.d.ts +0 -0
- /package/dist/{http.d.ts → v3/http.d.ts} +0 -0
- /package/dist/{httpClient.d.ts → v3/httpClient.d.ts} +0 -0
- /package/dist/{httpClient.js → v3/httpClient.js} +0 -0
- /package/dist/{rankedLocator.d.ts → v3/rankedLocator.d.ts} +0 -0
- /package/dist/{relayProxy.d.ts → v3/relayProxy.d.ts} +0 -0
- /package/dist/{reporters → v3/reporters}/index.d.ts +0 -0
- /package/dist/{reporters → v3/reporters}/local.d.ts +0 -0
- /package/dist/{reporters → v3/reporters}/lt.d.ts +0 -0
- /package/dist/{reporters → v3/reporters}/null.d.ts +0 -0
- /package/dist/{reporters → v3/reporters}/null.js +0 -0
- /package/dist/{routeFailure.d.ts → v3/routeFailure.d.ts} +0 -0
- /package/dist/{session.d.ts → v3/session.d.ts} +0 -0
- /package/dist/{step.d.ts → v3/step.d.ts} +0 -0
- /package/dist/{stepVariables.d.ts → v3/stepVariables.d.ts} +0 -0
- /package/dist/{test.d.ts → v3/test.d.ts} +0 -0
- /package/dist/{test.js → v3/test.js} +0 -0
- /package/dist/{testConfig.d.ts → v3/testConfig.d.ts} +0 -0
- /package/dist/{testConfig.js → v3/testConfig.js} +0 -0
- /package/dist/{testState.d.ts → v3/testState.d.ts} +0 -0
- /package/dist/{testState.js → v3/testState.js} +0 -0
- /package/dist/{visionLocator.d.ts → v3/visionLocator.d.ts} +0 -0
- /package/dist/{helpers → v4/helpers}/vision.d.ts +0 -0
|
@@ -0,0 +1,1215 @@
|
|
|
1
|
+
import { stringifyQueryResult } from './queryResult.js';
|
|
2
|
+
import { ClipboardStore, installClipboard, pasteViaPage, runClipboardQuery } from './clipboard.js';
|
|
3
|
+
import * as configure from '../../configure.js';
|
|
4
|
+
import { log } from '../../log.js';
|
|
5
|
+
import { SSEWireParser } from './sseParser.js';
|
|
6
|
+
// ── State ──
|
|
7
|
+
let networkEntries = [];
|
|
8
|
+
let networkSequence = 0;
|
|
9
|
+
let networkActive = false;
|
|
10
|
+
let consoleEntries = [];
|
|
11
|
+
let consoleSequence = 0;
|
|
12
|
+
let consoleActive = false;
|
|
13
|
+
// WebSocket capture
|
|
14
|
+
let wsConnections = [];
|
|
15
|
+
let wsActive = false;
|
|
16
|
+
let wsConfigured = false; // true once WS capture was started this run
|
|
17
|
+
let wsSeq = 0; // global monotonic across all connections
|
|
18
|
+
let wsConnCounter = 0; // connection-id allocator
|
|
19
|
+
// SSE capture (CDP-based, Chromium-only). CDP sessions are NOT auto-managed
|
|
20
|
+
// like page.on — keep a page->CDPSession registry and detach each on stop.
|
|
21
|
+
let sseConnections = [];
|
|
22
|
+
let sseActive = false;
|
|
23
|
+
let sseConfigured = false; // true once SSE capture was started this run
|
|
24
|
+
let sseSeq = 0; // global monotonic across all connections
|
|
25
|
+
let sseConnCounter = 0; // connection-id allocator
|
|
26
|
+
const sseMsgCounter = new Map(); // connectionId -> per-conn messageIndex
|
|
27
|
+
const sseSessions = new Map(); // the page->session registry
|
|
28
|
+
const sseTasks = new Set(); // pending scheduled tasks (response/popup)
|
|
29
|
+
let pageRef = null;
|
|
30
|
+
let contextRef = null;
|
|
31
|
+
let pageListenerActive = false; // true once context.on('page') is wired this run
|
|
32
|
+
let extraPages = []; // tabs opened mid-run that got capture listeners
|
|
33
|
+
const MAX_NETWORK = 5000;
|
|
34
|
+
const MAX_BODY = 65536;
|
|
35
|
+
const MAX_CONSOLE = 50000;
|
|
36
|
+
const MAX_WS_CONN = 256;
|
|
37
|
+
const MAX_WS_FRAMES = 2000;
|
|
38
|
+
const WS_PRESERVE_FIRST_N = 20;
|
|
39
|
+
const MAX_SSE_CONN = 256;
|
|
40
|
+
const MAX_SSE_MSGS = 2000;
|
|
41
|
+
const SSE_PRESERVE_FIRST_N = 20;
|
|
42
|
+
// Raw-byte budget for a binary frame so its base64 stays <= MAX_BODY and decodes cleanly
|
|
43
|
+
// (multiple of 3 → no mid-stream base64 padding). Math.floor(65536/4)*3 = 49152. Matches Python.
|
|
44
|
+
const MAX_WS_RAW_BUDGET = Math.floor(MAX_BODY / 4) * 3;
|
|
45
|
+
const TEXT_TYPES = ['json', 'text', 'xml', 'html', 'javascript', 'css', 'svg'];
|
|
46
|
+
const pendingRequests = new Map();
|
|
47
|
+
const wsById = new Map(); // ws -> index into wsConnections
|
|
48
|
+
const wsFrameCounter = new Map(); // connectionId -> per-conn frameIndex
|
|
49
|
+
// ── Public API ──
|
|
50
|
+
export async function startCapture(page, context) {
|
|
51
|
+
pageRef = page;
|
|
52
|
+
contextRef = context;
|
|
53
|
+
if (configure.get('clipboard')) {
|
|
54
|
+
clipboardStore = new ClipboardStore();
|
|
55
|
+
await installClipboard(context, clipboardStore);
|
|
56
|
+
log.helper('Virtual clipboard installed');
|
|
57
|
+
}
|
|
58
|
+
const devtools = configure.get('devtools');
|
|
59
|
+
if (!devtools || Object.keys(devtools).length === 0)
|
|
60
|
+
return;
|
|
61
|
+
if (devtools.network)
|
|
62
|
+
startNetworkCapture(page);
|
|
63
|
+
if (devtools.console)
|
|
64
|
+
startConsoleCapture(page);
|
|
65
|
+
if (devtools.websocket)
|
|
66
|
+
startWebSocketCapture(page);
|
|
67
|
+
if (devtools.sse) {
|
|
68
|
+
// SSE rides a CDP session (Chromium-only); attach is async. The
|
|
69
|
+
// non-Chromium hard-fail lives in session.ts run() BEFORE this runs.
|
|
70
|
+
await startSSECaptureInitial(page);
|
|
71
|
+
}
|
|
72
|
+
// Page-based captures (network/console/websocket/sse) only listen on the page
|
|
73
|
+
// they were attached to. Re-arm them on tabs opened later (window.open,
|
|
74
|
+
// target=_blank) via the context's 'page' event — otherwise those tabs are
|
|
75
|
+
// silently uncaptured. (performance/clipboard ride context init scripts and
|
|
76
|
+
// already cover every page.)
|
|
77
|
+
if (devtools.network || devtools.console || devtools.websocket || devtools.sse) {
|
|
78
|
+
attachContextPageListener(context);
|
|
79
|
+
}
|
|
80
|
+
if (devtools.performance)
|
|
81
|
+
await installPerformance(context);
|
|
82
|
+
const enabled = Object.entries(devtools).filter(([, v]) => v).map(([k]) => k);
|
|
83
|
+
if (enabled.length)
|
|
84
|
+
log.test(`DevTools capture started: ${enabled.join(', ')}`);
|
|
85
|
+
}
|
|
86
|
+
export function stopCapture(page) {
|
|
87
|
+
detachContextPageListener();
|
|
88
|
+
if (networkActive)
|
|
89
|
+
stopNetworkCapture(page);
|
|
90
|
+
if (consoleActive)
|
|
91
|
+
stopConsoleCapture(page);
|
|
92
|
+
if (wsActive)
|
|
93
|
+
stopWebSocketCapture(page);
|
|
94
|
+
// SSE CDP sessions are detached asynchronously by stopSSECapture(); this sync
|
|
95
|
+
// stop only flips sseActive off (so handlers short-circuit). The context
|
|
96
|
+
// 'page' listener is removed above, so no new popup-attach task is scheduled
|
|
97
|
+
// before stopSSECapture() drains and detaches.
|
|
98
|
+
sseActive = false;
|
|
99
|
+
// The per-type stops above only detach the initial page; also detach the
|
|
100
|
+
// tabs opened mid-run so no listener outlives the capture session.
|
|
101
|
+
detachExtraPages();
|
|
102
|
+
}
|
|
103
|
+
// ── New-page propagation — capture tabs opened after startCapture ──
|
|
104
|
+
function attachContextPageListener(context) {
|
|
105
|
+
if (pageListenerActive || !context)
|
|
106
|
+
return;
|
|
107
|
+
try {
|
|
108
|
+
context.on('page', onNewPage);
|
|
109
|
+
pageListenerActive = true;
|
|
110
|
+
}
|
|
111
|
+
catch { /* ignore */ }
|
|
112
|
+
}
|
|
113
|
+
function detachContextPageListener() {
|
|
114
|
+
if (pageListenerActive && contextRef) {
|
|
115
|
+
try {
|
|
116
|
+
contextRef.removeListener('page', onNewPage);
|
|
117
|
+
}
|
|
118
|
+
catch { /* ignore */ }
|
|
119
|
+
}
|
|
120
|
+
pageListenerActive = false;
|
|
121
|
+
}
|
|
122
|
+
function detachExtraPages() {
|
|
123
|
+
// Removing a listener that was never attached (only network enabled, say) is
|
|
124
|
+
// a safe no-op.
|
|
125
|
+
for (const p of extraPages) {
|
|
126
|
+
detachNetworkListeners(p);
|
|
127
|
+
detachConsoleListeners(p);
|
|
128
|
+
detachWebSocketListeners(p);
|
|
129
|
+
}
|
|
130
|
+
extraPages = [];
|
|
131
|
+
}
|
|
132
|
+
function onNewPage(page) {
|
|
133
|
+
// Attach the currently-active capture listeners to a newly opened page.
|
|
134
|
+
// Attach-only — never resets accumulated state (which the start* helpers do).
|
|
135
|
+
// Each capture type is guarded independently so one failure can't skip the rest.
|
|
136
|
+
let attached = false;
|
|
137
|
+
for (const [active, attach] of [
|
|
138
|
+
[networkActive, attachNetworkListeners],
|
|
139
|
+
[consoleActive, attachConsoleListeners],
|
|
140
|
+
[wsActive, attachWebSocketListeners],
|
|
141
|
+
]) {
|
|
142
|
+
if (!active)
|
|
143
|
+
continue;
|
|
144
|
+
try {
|
|
145
|
+
attach(page);
|
|
146
|
+
attached = true;
|
|
147
|
+
}
|
|
148
|
+
catch { /* ignore */ }
|
|
149
|
+
}
|
|
150
|
+
// SSE attach is async (own CDP session) — schedule it as a tracked task.
|
|
151
|
+
// The session is registered in sseSessions and detached by stopSSECapture.
|
|
152
|
+
if (sseActive) {
|
|
153
|
+
try {
|
|
154
|
+
schedule(attachSseToPage(page));
|
|
155
|
+
}
|
|
156
|
+
catch { /* ignore */ }
|
|
157
|
+
}
|
|
158
|
+
if (attached && !extraPages.includes(page))
|
|
159
|
+
extraPages.push(page);
|
|
160
|
+
}
|
|
161
|
+
export function resetCapture() {
|
|
162
|
+
// Remove any live listeners on the (possibly reused) context/tabs before
|
|
163
|
+
// dropping our refs, so a later startCapture can't double-register them.
|
|
164
|
+
// detachContextPageListener() also clears pageListenerActive.
|
|
165
|
+
detachContextPageListener();
|
|
166
|
+
detachExtraPages();
|
|
167
|
+
networkEntries = [];
|
|
168
|
+
networkSequence = 0;
|
|
169
|
+
networkActive = false;
|
|
170
|
+
consoleEntries = [];
|
|
171
|
+
consoleSequence = 0;
|
|
172
|
+
consoleActive = false;
|
|
173
|
+
wsConnections = [];
|
|
174
|
+
wsActive = false;
|
|
175
|
+
wsConfigured = false;
|
|
176
|
+
wsSeq = 0;
|
|
177
|
+
wsConnCounter = 0;
|
|
178
|
+
wsById.clear();
|
|
179
|
+
wsFrameCounter.clear();
|
|
180
|
+
// SSE: best-effort sync reset for test isolation. Live CDP sessions should be
|
|
181
|
+
// detached via stopSSECapture() in the async teardown; here we drop refs so a
|
|
182
|
+
// fresh run starts clean.
|
|
183
|
+
sseConnections = [];
|
|
184
|
+
sseActive = false;
|
|
185
|
+
sseConfigured = false;
|
|
186
|
+
sseSeq = 0;
|
|
187
|
+
sseConnCounter = 0;
|
|
188
|
+
sseMsgCounter.clear();
|
|
189
|
+
sseSessions.clear();
|
|
190
|
+
sseTasks.clear();
|
|
191
|
+
pendingRequests.clear();
|
|
192
|
+
pageRef = null;
|
|
193
|
+
contextRef = null;
|
|
194
|
+
}
|
|
195
|
+
// ── Network capture ──
|
|
196
|
+
function startNetworkCapture(page) {
|
|
197
|
+
networkEntries = [];
|
|
198
|
+
networkSequence = 0;
|
|
199
|
+
networkActive = true;
|
|
200
|
+
attachNetworkListeners(page);
|
|
201
|
+
}
|
|
202
|
+
function attachNetworkListeners(page) {
|
|
203
|
+
page.on('request', onRequest);
|
|
204
|
+
page.on('response', onResponse);
|
|
205
|
+
page.on('requestfinished', onRequestFinished);
|
|
206
|
+
page.on('requestfailed', onRequestFailed);
|
|
207
|
+
}
|
|
208
|
+
function detachNetworkListeners(page) {
|
|
209
|
+
try {
|
|
210
|
+
page.removeListener('request', onRequest);
|
|
211
|
+
page.removeListener('response', onResponse);
|
|
212
|
+
page.removeListener('requestfinished', onRequestFinished);
|
|
213
|
+
page.removeListener('requestfailed', onRequestFailed);
|
|
214
|
+
}
|
|
215
|
+
catch { /* ignore */ }
|
|
216
|
+
}
|
|
217
|
+
function stopNetworkCapture(page) {
|
|
218
|
+
networkActive = false;
|
|
219
|
+
detachNetworkListeners(page);
|
|
220
|
+
}
|
|
221
|
+
function onRequest(request) {
|
|
222
|
+
if (!networkActive)
|
|
223
|
+
return;
|
|
224
|
+
const u = new URL(request.url());
|
|
225
|
+
const qp = {};
|
|
226
|
+
u.searchParams.forEach((v, k) => { qp[k] = v; });
|
|
227
|
+
// request.postData() decodes the body via Buffer.toString('utf-8'), which
|
|
228
|
+
// substitutes invalid bytes (it won't throw the way Python's post_data does),
|
|
229
|
+
// but guard anyway so a future Playwright change can't let an error escape
|
|
230
|
+
// this event listener — parity with the Python binding.
|
|
231
|
+
let requestBody;
|
|
232
|
+
try {
|
|
233
|
+
requestBody = request.postData() ?? null;
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
requestBody = null;
|
|
237
|
+
}
|
|
238
|
+
if (requestBody && requestBody.length > MAX_BODY) {
|
|
239
|
+
requestBody = requestBody.slice(0, MAX_BODY);
|
|
240
|
+
}
|
|
241
|
+
const entry = {
|
|
242
|
+
id: `req_${networkSequence}`,
|
|
243
|
+
sequence: networkSequence,
|
|
244
|
+
method: request.method(),
|
|
245
|
+
url: request.url(),
|
|
246
|
+
domain: u.hostname,
|
|
247
|
+
path: u.pathname || '/',
|
|
248
|
+
queryParams: qp,
|
|
249
|
+
resourceType: request.resourceType(),
|
|
250
|
+
requestHeaders: request.headers(),
|
|
251
|
+
requestBody,
|
|
252
|
+
responseStatus: null,
|
|
253
|
+
responseHeaders: null,
|
|
254
|
+
responseBody: null,
|
|
255
|
+
failed: false,
|
|
256
|
+
failureReason: null,
|
|
257
|
+
startMs: Date.now(),
|
|
258
|
+
durationMs: null,
|
|
259
|
+
};
|
|
260
|
+
networkSequence++;
|
|
261
|
+
if (networkEntries.length >= MAX_NETWORK) {
|
|
262
|
+
networkEntries.splice(0, MAX_NETWORK / 10);
|
|
263
|
+
}
|
|
264
|
+
const idx = networkEntries.length;
|
|
265
|
+
networkEntries.push(entry);
|
|
266
|
+
pendingRequests.set(request, idx);
|
|
267
|
+
}
|
|
268
|
+
async function onResponse(response) {
|
|
269
|
+
if (!networkActive)
|
|
270
|
+
return;
|
|
271
|
+
const request = response.request();
|
|
272
|
+
const idx = pendingRequests.get(request);
|
|
273
|
+
if (idx === undefined || idx >= networkEntries.length)
|
|
274
|
+
return;
|
|
275
|
+
const entry = networkEntries[idx];
|
|
276
|
+
entry.responseStatus = response.status();
|
|
277
|
+
entry.responseHeaders = await response.allHeaders();
|
|
278
|
+
const ct = entry.responseHeaders['content-type'] ?? '';
|
|
279
|
+
// SSE responses (text/event-stream) are long-lived streams whose body
|
|
280
|
+
// never resolves until the stream closes — reading it here would hang the
|
|
281
|
+
// capture. SSE is captured separately via CDP, so skip the body read.
|
|
282
|
+
// Match before the generic 'text' substring (which catches event-stream).
|
|
283
|
+
if (ct.includes('text/event-stream')) {
|
|
284
|
+
entry.responseBody = null;
|
|
285
|
+
}
|
|
286
|
+
else if (TEXT_TYPES.some(t => ct.includes(t))) {
|
|
287
|
+
try {
|
|
288
|
+
let body = await response.text();
|
|
289
|
+
if (body.length > MAX_BODY)
|
|
290
|
+
body = body.slice(0, MAX_BODY);
|
|
291
|
+
entry.responseBody = body;
|
|
292
|
+
}
|
|
293
|
+
catch { /* ignore */ }
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function onRequestFinished(request) {
|
|
297
|
+
if (!networkActive)
|
|
298
|
+
return;
|
|
299
|
+
const idx = pendingRequests.get(request);
|
|
300
|
+
pendingRequests.delete(request);
|
|
301
|
+
if (idx !== undefined && idx < networkEntries.length) {
|
|
302
|
+
const entry = networkEntries[idx];
|
|
303
|
+
entry.durationMs = Date.now() - entry.startMs;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
function onRequestFailed(request) {
|
|
307
|
+
if (!networkActive)
|
|
308
|
+
return;
|
|
309
|
+
const idx = pendingRequests.get(request);
|
|
310
|
+
pendingRequests.delete(request);
|
|
311
|
+
if (idx !== undefined && idx < networkEntries.length) {
|
|
312
|
+
const entry = networkEntries[idx];
|
|
313
|
+
entry.failed = true;
|
|
314
|
+
entry.failureReason = request.failure()?.errorText ?? '';
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
// ── Console capture ──
|
|
318
|
+
const LEVEL_MAP = { log: 'log', warning: 'warning', error: 'error', info: 'info', debug: 'debug' };
|
|
319
|
+
function startConsoleCapture(page) {
|
|
320
|
+
consoleEntries = [];
|
|
321
|
+
consoleSequence = 0;
|
|
322
|
+
consoleActive = true;
|
|
323
|
+
attachConsoleListeners(page);
|
|
324
|
+
}
|
|
325
|
+
function attachConsoleListeners(page) {
|
|
326
|
+
page.on('console', onConsoleMessage);
|
|
327
|
+
page.on('pageerror', onPageError);
|
|
328
|
+
}
|
|
329
|
+
function detachConsoleListeners(page) {
|
|
330
|
+
try {
|
|
331
|
+
page.removeListener('console', onConsoleMessage);
|
|
332
|
+
page.removeListener('pageerror', onPageError);
|
|
333
|
+
}
|
|
334
|
+
catch { /* ignore */ }
|
|
335
|
+
}
|
|
336
|
+
function stopConsoleCapture(page) {
|
|
337
|
+
consoleActive = false;
|
|
338
|
+
detachConsoleListeners(page);
|
|
339
|
+
}
|
|
340
|
+
async function onConsoleMessage(msg) {
|
|
341
|
+
if (!consoleActive)
|
|
342
|
+
return;
|
|
343
|
+
const level = LEVEL_MAP[msg.type()] ?? 'log';
|
|
344
|
+
const location = msg.location();
|
|
345
|
+
let text;
|
|
346
|
+
try {
|
|
347
|
+
const parts = [];
|
|
348
|
+
for (const arg of msg.args()) {
|
|
349
|
+
try {
|
|
350
|
+
const val = await arg.jsonValue();
|
|
351
|
+
parts.push(typeof val === 'string' ? val : String(val));
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
parts.push('<unresolved>');
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
text = parts.length ? parts.join(' ') : msg.text();
|
|
358
|
+
}
|
|
359
|
+
catch {
|
|
360
|
+
text = msg.text();
|
|
361
|
+
}
|
|
362
|
+
const entry = {
|
|
363
|
+
sequence: consoleSequence,
|
|
364
|
+
level,
|
|
365
|
+
text,
|
|
366
|
+
url: location.url,
|
|
367
|
+
lineNumber: location.lineNumber,
|
|
368
|
+
timestampMs: Date.now(),
|
|
369
|
+
isException: false,
|
|
370
|
+
};
|
|
371
|
+
consoleSequence++;
|
|
372
|
+
if (consoleEntries.length >= MAX_CONSOLE)
|
|
373
|
+
consoleEntries.splice(0, MAX_CONSOLE / 10);
|
|
374
|
+
consoleEntries.push(entry);
|
|
375
|
+
}
|
|
376
|
+
function onPageError(error) {
|
|
377
|
+
if (!consoleActive)
|
|
378
|
+
return;
|
|
379
|
+
const entry = {
|
|
380
|
+
sequence: consoleSequence,
|
|
381
|
+
level: 'error',
|
|
382
|
+
text: error.message,
|
|
383
|
+
url: '',
|
|
384
|
+
lineNumber: 0,
|
|
385
|
+
timestampMs: Date.now(),
|
|
386
|
+
isException: true,
|
|
387
|
+
};
|
|
388
|
+
consoleSequence++;
|
|
389
|
+
if (consoleEntries.length >= MAX_CONSOLE)
|
|
390
|
+
consoleEntries.splice(0, MAX_CONSOLE / 10);
|
|
391
|
+
consoleEntries.push(entry);
|
|
392
|
+
}
|
|
393
|
+
// ── WebSocket capture ──
|
|
394
|
+
// NB: Playwright TS frame events pass `{ payload }` (object), unlike Python which
|
|
395
|
+
// passes the payload directly — hence `data.payload` below.
|
|
396
|
+
function startWebSocketCapture(page) {
|
|
397
|
+
wsConnections = [];
|
|
398
|
+
wsActive = true;
|
|
399
|
+
wsConfigured = true;
|
|
400
|
+
wsSeq = 0;
|
|
401
|
+
wsConnCounter = 0;
|
|
402
|
+
wsById.clear();
|
|
403
|
+
wsFrameCounter.clear();
|
|
404
|
+
attachWebSocketListeners(page);
|
|
405
|
+
}
|
|
406
|
+
function attachWebSocketListeners(page) {
|
|
407
|
+
page.on('websocket', onWebSocket);
|
|
408
|
+
}
|
|
409
|
+
function detachWebSocketListeners(page) {
|
|
410
|
+
try {
|
|
411
|
+
page.removeListener('websocket', onWebSocket);
|
|
412
|
+
}
|
|
413
|
+
catch { /* ignore */ }
|
|
414
|
+
}
|
|
415
|
+
function stopWebSocketCapture(page) {
|
|
416
|
+
wsActive = false;
|
|
417
|
+
detachWebSocketListeners(page);
|
|
418
|
+
}
|
|
419
|
+
function onWebSocket(ws) {
|
|
420
|
+
if (!wsActive)
|
|
421
|
+
return;
|
|
422
|
+
try {
|
|
423
|
+
if (wsConnections.length >= MAX_WS_CONN)
|
|
424
|
+
evictOldestClosedWs();
|
|
425
|
+
const url = ws.url();
|
|
426
|
+
let domain = '';
|
|
427
|
+
let path = '/';
|
|
428
|
+
try {
|
|
429
|
+
const u = new URL(url);
|
|
430
|
+
domain = u.hostname;
|
|
431
|
+
path = u.pathname || '/';
|
|
432
|
+
}
|
|
433
|
+
catch { /* malformed */ }
|
|
434
|
+
const conn = {
|
|
435
|
+
connectionId: `ws_${wsConnCounter}`,
|
|
436
|
+
url, domain, path,
|
|
437
|
+
openedTsMs: Date.now(),
|
|
438
|
+
closedTsMs: null,
|
|
439
|
+
closeReason: null,
|
|
440
|
+
error: null,
|
|
441
|
+
frames: [],
|
|
442
|
+
droppedFrames: 0,
|
|
443
|
+
};
|
|
444
|
+
wsConnCounter++;
|
|
445
|
+
wsById.set(ws, wsConnections.length);
|
|
446
|
+
wsConnections.push(conn);
|
|
447
|
+
}
|
|
448
|
+
catch {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
// each handler wraps its own body (onWsFrame/onWsClose/onWsError) so a throw can't propagate.
|
|
452
|
+
ws.on('framesent', data => onWsFrame(ws, 'sent', data.payload));
|
|
453
|
+
ws.on('framereceived', data => onWsFrame(ws, 'received', data.payload));
|
|
454
|
+
ws.on('close', () => onWsClose(ws));
|
|
455
|
+
ws.on('socketerror', err => onWsError(ws, err));
|
|
456
|
+
}
|
|
457
|
+
function onWsFrame(ws, direction, payload) {
|
|
458
|
+
if (!wsActive)
|
|
459
|
+
return;
|
|
460
|
+
try {
|
|
461
|
+
const idx = wsById.get(ws);
|
|
462
|
+
if (idx === undefined || idx >= wsConnections.length)
|
|
463
|
+
return;
|
|
464
|
+
const conn = wsConnections[idx];
|
|
465
|
+
const isBinary = typeof payload !== 'string';
|
|
466
|
+
let text;
|
|
467
|
+
let truncated;
|
|
468
|
+
if (isBinary) {
|
|
469
|
+
// Truncate the raw Buffer before base64 so the stored payload stays within the cap
|
|
470
|
+
// and decodes cleanly; truncated reflects raw length (parity with Python).
|
|
471
|
+
const buf = Buffer.from(payload);
|
|
472
|
+
truncated = buf.length > MAX_WS_RAW_BUDGET;
|
|
473
|
+
text = buf.subarray(0, MAX_WS_RAW_BUDGET).toString('base64');
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
text = payload;
|
|
477
|
+
truncated = text.length > MAX_BODY;
|
|
478
|
+
if (truncated)
|
|
479
|
+
text = text.slice(0, MAX_BODY);
|
|
480
|
+
}
|
|
481
|
+
const cid = conn.connectionId;
|
|
482
|
+
const fidx = wsFrameCounter.get(cid) ?? 0;
|
|
483
|
+
wsFrameCounter.set(cid, fidx + 1);
|
|
484
|
+
appendWsFrame(conn, {
|
|
485
|
+
connectionId: cid, direction, payload: text, isBinary, truncated,
|
|
486
|
+
tsMs: Date.now(), seq: wsSeq, frameIndex: fidx,
|
|
487
|
+
});
|
|
488
|
+
wsSeq++;
|
|
489
|
+
}
|
|
490
|
+
catch { /* ignore */ }
|
|
491
|
+
}
|
|
492
|
+
function onWsClose(ws) {
|
|
493
|
+
try {
|
|
494
|
+
const idx = wsById.get(ws);
|
|
495
|
+
if (idx !== undefined && idx < wsConnections.length)
|
|
496
|
+
wsConnections[idx].closedTsMs = Date.now();
|
|
497
|
+
}
|
|
498
|
+
catch { /* ignore */ }
|
|
499
|
+
}
|
|
500
|
+
function onWsError(ws, err) {
|
|
501
|
+
try {
|
|
502
|
+
const idx = wsById.get(ws);
|
|
503
|
+
if (idx !== undefined && idx < wsConnections.length)
|
|
504
|
+
wsConnections[idx].error = String(err);
|
|
505
|
+
}
|
|
506
|
+
catch { /* ignore */ }
|
|
507
|
+
}
|
|
508
|
+
function appendWsFrame(conn, frame) {
|
|
509
|
+
// per-connection ring with first-N preserved; frameIndex stays monotonic via
|
|
510
|
+
// wsFrameCounter (NOT frames.length, which repeats after eviction).
|
|
511
|
+
if (conn.frames.length >= MAX_WS_FRAMES) {
|
|
512
|
+
if (WS_PRESERVE_FIRST_N < conn.frames.length) {
|
|
513
|
+
conn.frames.splice(WS_PRESERVE_FIRST_N, 1);
|
|
514
|
+
conn.droppedFrames++;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
conn.frames.push(frame);
|
|
518
|
+
}
|
|
519
|
+
function evictOldestClosedWs() {
|
|
520
|
+
// Drop the evicted connection's frame counter too so it doesn't leak.
|
|
521
|
+
for (let i = 0; i < wsConnections.length; i++) {
|
|
522
|
+
if (wsConnections[i].closedTsMs !== null) {
|
|
523
|
+
wsFrameCounter.delete(wsConnections[i].connectionId);
|
|
524
|
+
wsConnections.splice(i, 1);
|
|
525
|
+
reindexWsById(i);
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
if (wsConnections.length) {
|
|
530
|
+
wsFrameCounter.delete(wsConnections[0].connectionId);
|
|
531
|
+
wsConnections.splice(0, 1);
|
|
532
|
+
reindexWsById(0);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
function reindexWsById(removed) {
|
|
536
|
+
for (const [k, v] of [...wsById.entries()]) {
|
|
537
|
+
if (v === removed)
|
|
538
|
+
wsById.delete(k);
|
|
539
|
+
else if (v > removed)
|
|
540
|
+
wsById.set(k, v - 1);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
// ── SSE capture (CDP, Chromium-only) ──
|
|
544
|
+
function schedule(p) {
|
|
545
|
+
// Track a scheduled task so teardown can drain it; remove on completion.
|
|
546
|
+
sseTasks.add(p);
|
|
547
|
+
void p.finally(() => sseTasks.delete(p));
|
|
548
|
+
}
|
|
549
|
+
function normSseEvent(name) {
|
|
550
|
+
// CDP eventName "" or "message" -> null (default event type).
|
|
551
|
+
return !name || name === 'message' ? null : name;
|
|
552
|
+
}
|
|
553
|
+
function isEventStream(resp) {
|
|
554
|
+
const mime = (resp.mimeType ?? '').split(';')[0].trim().toLowerCase();
|
|
555
|
+
if (mime === 'text/event-stream')
|
|
556
|
+
return true;
|
|
557
|
+
const headers = resp.headers ?? {};
|
|
558
|
+
const ct = headers['content-type'] ?? headers['Content-Type'] ?? '';
|
|
559
|
+
return ct.toLowerCase().includes('text/event-stream');
|
|
560
|
+
}
|
|
561
|
+
function allocSseConn(url, transport) {
|
|
562
|
+
if (sseConnections.length >= MAX_SSE_CONN)
|
|
563
|
+
evictOldestClosedSse();
|
|
564
|
+
let domain = '';
|
|
565
|
+
let path = '/';
|
|
566
|
+
try {
|
|
567
|
+
const u = new URL(url || '');
|
|
568
|
+
domain = u.hostname;
|
|
569
|
+
path = u.pathname || '/';
|
|
570
|
+
}
|
|
571
|
+
catch { /* malformed */ }
|
|
572
|
+
const conn = {
|
|
573
|
+
connectionId: `sse_${sseConnCounter}`,
|
|
574
|
+
url: url || '', domain, path,
|
|
575
|
+
openedTsMs: Date.now(),
|
|
576
|
+
closedTsMs: null,
|
|
577
|
+
error: null,
|
|
578
|
+
transport,
|
|
579
|
+
messages: [],
|
|
580
|
+
droppedMessages: 0,
|
|
581
|
+
};
|
|
582
|
+
sseConnCounter++;
|
|
583
|
+
sseConnections.push(conn);
|
|
584
|
+
return conn;
|
|
585
|
+
}
|
|
586
|
+
function appendSseMessage(conn, msg) {
|
|
587
|
+
// per-connection ring with first-N preserved; messageIndex stays monotonic via
|
|
588
|
+
// sseMsgCounter (NOT messages.length, which repeats after eviction).
|
|
589
|
+
if (conn.messages.length >= MAX_SSE_MSGS) {
|
|
590
|
+
if (SSE_PRESERVE_FIRST_N < conn.messages.length) {
|
|
591
|
+
conn.messages.splice(SSE_PRESERVE_FIRST_N, 1);
|
|
592
|
+
conn.droppedMessages++;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
conn.messages.push(msg);
|
|
596
|
+
}
|
|
597
|
+
function evictOldestClosedSse() {
|
|
598
|
+
// Session request-maps hold object refs (not indices), so no re-index needed;
|
|
599
|
+
// just drop the evicted conn's message counter.
|
|
600
|
+
for (let i = 0; i < sseConnections.length; i++) {
|
|
601
|
+
if (sseConnections[i].closedTsMs !== null) {
|
|
602
|
+
sseMsgCounter.delete(sseConnections[i].connectionId);
|
|
603
|
+
sseConnections.splice(i, 1);
|
|
604
|
+
return;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
if (sseConnections.length) {
|
|
608
|
+
sseMsgCounter.delete(sseConnections[0].connectionId);
|
|
609
|
+
sseConnections.splice(0, 1);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function emitSse(conn, ev, transport) {
|
|
613
|
+
if (!sseActive)
|
|
614
|
+
return;
|
|
615
|
+
try {
|
|
616
|
+
let data = ev.data ?? '';
|
|
617
|
+
const truncated = Boolean(ev.truncated) || data.length > MAX_BODY;
|
|
618
|
+
data = data.slice(0, MAX_BODY);
|
|
619
|
+
const cid = conn.connectionId;
|
|
620
|
+
const midx = sseMsgCounter.get(cid) ?? 0;
|
|
621
|
+
sseMsgCounter.set(cid, midx + 1);
|
|
622
|
+
appendSseMessage(conn, {
|
|
623
|
+
connectionId: cid,
|
|
624
|
+
data,
|
|
625
|
+
event: ev.event,
|
|
626
|
+
id: ev.id,
|
|
627
|
+
retry: ev.retry,
|
|
628
|
+
transport,
|
|
629
|
+
truncated,
|
|
630
|
+
tsMs: Date.now(),
|
|
631
|
+
seq: sseSeq,
|
|
632
|
+
messageIndex: midx,
|
|
633
|
+
});
|
|
634
|
+
sseSeq++;
|
|
635
|
+
}
|
|
636
|
+
catch { /* ignore */ }
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Create a CDP session on `page`, wire SSE handlers, register it in the
|
|
640
|
+
* page->session registry, and return it. Handlers close over per-session request
|
|
641
|
+
* maps (requestId collides across CDP targets).
|
|
642
|
+
*/
|
|
643
|
+
export async function startSSECapture(page) {
|
|
644
|
+
const cdp = await page.context().newCDPSession(page);
|
|
645
|
+
await cdp.send('Network.enable');
|
|
646
|
+
const streams = new Map();
|
|
647
|
+
const native = new Map();
|
|
648
|
+
const getNativeConn = (rid, url = '') => {
|
|
649
|
+
let conn = native.get(rid);
|
|
650
|
+
if (!conn) {
|
|
651
|
+
conn = allocSseConn(url, 'eventsource');
|
|
652
|
+
native.set(rid, conn);
|
|
653
|
+
}
|
|
654
|
+
else if (url && !conn.url) {
|
|
655
|
+
conn.url = url;
|
|
656
|
+
try {
|
|
657
|
+
const u = new URL(url);
|
|
658
|
+
conn.domain = u.hostname;
|
|
659
|
+
conn.path = u.pathname || '/';
|
|
660
|
+
}
|
|
661
|
+
catch { /* malformed */ }
|
|
662
|
+
}
|
|
663
|
+
return conn;
|
|
664
|
+
};
|
|
665
|
+
const decodeB64 = (b64) => Buffer.from(b64, 'base64');
|
|
666
|
+
cdp.on('Network.eventSourceMessageReceived', (p) => {
|
|
667
|
+
if (!sseActive)
|
|
668
|
+
return;
|
|
669
|
+
try {
|
|
670
|
+
const conn = getNativeConn(p.requestId);
|
|
671
|
+
emitSse(conn, {
|
|
672
|
+
event: normSseEvent(p.eventName),
|
|
673
|
+
data: p.data ?? '',
|
|
674
|
+
id: p.eventId || null,
|
|
675
|
+
retry: null,
|
|
676
|
+
}, 'eventsource');
|
|
677
|
+
}
|
|
678
|
+
catch { /* ignore */ }
|
|
679
|
+
});
|
|
680
|
+
const onResponse = async (p) => {
|
|
681
|
+
if (!sseActive)
|
|
682
|
+
return;
|
|
683
|
+
try {
|
|
684
|
+
const resp = p.response ?? {};
|
|
685
|
+
if (!isEventStream(resp))
|
|
686
|
+
return;
|
|
687
|
+
const rid = p.requestId;
|
|
688
|
+
const rtype = p.type ?? 'Other';
|
|
689
|
+
if (rtype === 'EventSource') {
|
|
690
|
+
// Native EventSource is pre-parsed; never stream it (double-count).
|
|
691
|
+
getNativeConn(rid, resp.url ?? '');
|
|
692
|
+
return;
|
|
693
|
+
}
|
|
694
|
+
const transport = rtype.toLowerCase();
|
|
695
|
+
const conn = allocSseConn(resp.url ?? '', transport);
|
|
696
|
+
// NOT-yet-primed: dataReceived arriving during the streamResourceContent await
|
|
697
|
+
// is queued (not fed) so bufferedData (earlier bytes) parses first — ordering
|
|
698
|
+
// must not rely on event-loop scheduling (a buffered burst on connect would
|
|
699
|
+
// otherwise corrupt the parse).
|
|
700
|
+
const entry = { conn, parser: new SSEWireParser(), dec: new TextDecoder('utf-8'), transport, primed: false, pending: [] };
|
|
701
|
+
streams.set(rid, entry);
|
|
702
|
+
let buffered;
|
|
703
|
+
try {
|
|
704
|
+
const res = await cdp.send('Network.streamResourceContent', { requestId: rid });
|
|
705
|
+
buffered = res?.bufferedData;
|
|
706
|
+
}
|
|
707
|
+
catch {
|
|
708
|
+
buffered = undefined;
|
|
709
|
+
}
|
|
710
|
+
if (buffered) {
|
|
711
|
+
for (const ev of entry.parser.feed(entry.dec.decode(decodeB64(buffered), { stream: true })))
|
|
712
|
+
emitSse(conn, ev, transport);
|
|
713
|
+
}
|
|
714
|
+
for (const chunk of entry.pending) {
|
|
715
|
+
for (const ev of entry.parser.feed(entry.dec.decode(decodeB64(chunk), { stream: true })))
|
|
716
|
+
emitSse(conn, ev, transport);
|
|
717
|
+
}
|
|
718
|
+
entry.pending = [];
|
|
719
|
+
entry.primed = true;
|
|
720
|
+
}
|
|
721
|
+
catch { /* ignore */ }
|
|
722
|
+
};
|
|
723
|
+
cdp.on('Network.responseReceived', (p) => schedule(onResponse(p)));
|
|
724
|
+
cdp.on('Network.dataReceived', (p) => {
|
|
725
|
+
if (!sseActive)
|
|
726
|
+
return;
|
|
727
|
+
try {
|
|
728
|
+
const st = streams.get(p.requestId);
|
|
729
|
+
if (!st || !p.data)
|
|
730
|
+
return;
|
|
731
|
+
if (!st.primed) {
|
|
732
|
+
st.pending.push(p.data);
|
|
733
|
+
return;
|
|
734
|
+
}
|
|
735
|
+
for (const ev of st.parser.feed(st.dec.decode(decodeB64(p.data), { stream: true })))
|
|
736
|
+
emitSse(st.conn, ev, st.transport);
|
|
737
|
+
}
|
|
738
|
+
catch { /* ignore */ }
|
|
739
|
+
});
|
|
740
|
+
const markClosed = (rid, error) => {
|
|
741
|
+
try {
|
|
742
|
+
const conn = streams.get(rid)?.conn ?? native.get(rid);
|
|
743
|
+
if (!conn)
|
|
744
|
+
return;
|
|
745
|
+
conn.closedTsMs = Date.now();
|
|
746
|
+
if (error)
|
|
747
|
+
conn.error = String(error);
|
|
748
|
+
}
|
|
749
|
+
catch { /* ignore */ }
|
|
750
|
+
};
|
|
751
|
+
cdp.on('Network.loadingFinished', (p) => markClosed(p.requestId));
|
|
752
|
+
cdp.on('Network.loadingFailed', (p) => markClosed(p.requestId, p.errorText));
|
|
753
|
+
sseSessions.set(page, cdp);
|
|
754
|
+
return cdp;
|
|
755
|
+
}
|
|
756
|
+
async function startSSECaptureInitial(page) {
|
|
757
|
+
sseConnections = [];
|
|
758
|
+
sseActive = true;
|
|
759
|
+
sseConfigured = true;
|
|
760
|
+
sseSeq = 0;
|
|
761
|
+
sseConnCounter = 0;
|
|
762
|
+
sseMsgCounter.clear();
|
|
763
|
+
sseSessions.clear();
|
|
764
|
+
await startSSECapture(page);
|
|
765
|
+
}
|
|
766
|
+
async function attachSseToPage(page) {
|
|
767
|
+
// Popup attach: a tab opened after startCapture gets its own CDP session.
|
|
768
|
+
try {
|
|
769
|
+
await startSSECapture(page);
|
|
770
|
+
}
|
|
771
|
+
catch { /* ignore */ }
|
|
772
|
+
}
|
|
773
|
+
/**
|
|
774
|
+
* Async SSE teardown: stop handlers, drain pending tasks, detach every CDP
|
|
775
|
+
* session. The context 'page' listener is removed by the sync stopCapture
|
|
776
|
+
* BEFORE this runs, so no new popup-attach task can be scheduled mid-teardown.
|
|
777
|
+
*/
|
|
778
|
+
export async function stopSSECapture() {
|
|
779
|
+
sseActive = false;
|
|
780
|
+
const pending = [...sseTasks];
|
|
781
|
+
if (pending.length)
|
|
782
|
+
await Promise.allSettled(pending);
|
|
783
|
+
for (const cdp of [...sseSessions.values()]) {
|
|
784
|
+
try {
|
|
785
|
+
await cdp.detach();
|
|
786
|
+
}
|
|
787
|
+
catch { /* ignore */ }
|
|
788
|
+
}
|
|
789
|
+
sseSessions.clear();
|
|
790
|
+
}
|
|
791
|
+
// ── Performance ──
|
|
792
|
+
const WEB_VITALS_INIT_SCRIPT =
|
|
793
|
+
// Vendored web-vitals v4 IIFE
|
|
794
|
+
`var webVitals=function(e){"use strict";var n,t,r,i,o,a=-1,c=function(e){addEventListener("pageshow",(function(n){n.persisted&&(a=n.timeStamp,e(n))}),!0)},u=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},s=function(){var e=u();return e&&e.activationStart||0},f=function(e,n){var t=u(),r="navigate";a>=0?r="back-forward-cache":t&&(document.prerendering||s()>0?r="prerender":document.wasDiscarded?r="restore":t.type&&(r=t.type.replace(/_/g,"-")));return{name:e,value:void 0===n?-1:n,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},d=function(e,n,t){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver((function(e){Promise.resolve().then((function(){n(e.getEntries())}))}));return r.observe(Object.assign({type:e,buffered:!0},t||{})),r}}catch(e){}},l=function(e,n,t,r){var i,o;return function(a){n.value>=0&&(a||r)&&((o=n.value-(i||0))||void 0===i)&&(i=n.value,n.delta=o,n.rating=function(e,n){return e>n[1]?"poor":e>n[0]?"needs-improvement":"good"}(n.value,t),e(n))}},p=function(e){requestAnimationFrame((function(){return requestAnimationFrame((function(){return e()}))}))},v=function(e){document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e()}))},m=function(e){var n=!1;return function(){n||(e(),n=!0)}},h=-1,g=function(){return"hidden"!==document.visibilityState||document.prerendering?1/0:0},T=function(e){"hidden"===document.visibilityState&&h>-1&&(h="visibilitychange"===e.type?e.timeStamp:0,E())},y=function(){addEventListener("visibilitychange",T,!0),addEventListener("prerenderingchange",T,!0)},E=function(){removeEventListener("visibilitychange",T,!0),removeEventListener("prerenderingchange",T,!0)},C=function(){return h<0&&(h=g(),y(),c((function(){setTimeout((function(){h=g(),y()}),0)}))),{get firstHiddenTime(){return h}}},L=function(e){document.prerendering?addEventListener("prerenderingchange",(function(){return e()}),!0):e()},S=[1800,3e3],b=function(e,n){n=n||{},L((function(){var t,r=C(),i=f("FCP"),o=d("paint",(function(e){e.forEach((function(e){"first-contentful-paint"===e.name&&(o.disconnect(),e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-s(),0),i.entries.push(e),t(!0)))}))}));o&&(t=l(e,i,S,n.reportAllChanges),c((function(r){i=f("FCP"),t=l(e,i,S,n.reportAllChanges),p((function(){i.value=performance.now()-r.timeStamp,t(!0)}))})))}))},w=[.1,.25],I=0,P=1/0,A=0,F=function(e){e.forEach((function(e){e.interactionId&&(P=Math.min(P,e.interactionId),A=Math.max(A,e.interactionId),I=A?(A-P)/7+1:0)}))},M=function(){return n?I:performance.interactionCount||0},k=function(){"interactionCount"in performance||n||(n=d("event",F,{type:"event",buffered:!0,durationThreshold:0}))},D=[],B=new Map,R=0,x=function(){var e=Math.min(D.length-1,Math.floor((M()-R)/50));return D[e]},H=[],N=function(e){if(H.forEach((function(n){return n(e)})),e.interactionId||"first-input"===e.entryType){var n=D[D.length-1],t=B.get(e.interactionId);if(t||D.length<10||e.duration>n.latency){if(t)e.duration>t.latency?(t.entries=[e],t.latency=e.duration):e.duration===t.latency&&e.startTime===t.entries[0].startTime&&t.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};B.set(r.id,r),D.push(r)}D.sort((function(e,n){return n.latency-e.latency})),D.length>10&&D.splice(10).forEach((function(e){return B.delete(e.id)}))}}},q=function(e){var n=self.requestIdleCallback||self.setTimeout,t=-1;return e=m(e),"hidden"===document.visibilityState?e():(t=n(e),v(e)),t},O=[200,500],j=[2500,4e3],V={},_=[800,1800],z=function e(n){document.prerendering?L((function(){return e(n)})):"complete"!==document.readyState?addEventListener("load",(function(){return e(n)}),!0):setTimeout(n,0)},G={passive:!0,capture:!0},J=new Date,K=function(e,n){t||(t=n,r=e,i=new Date,W(removeEventListener),Q())},Q=function(){if(r>=0&&r<i-J){var e={entryType:"first-input",name:t.type,target:t.target,cancelable:t.cancelable,startTime:t.timeStamp,processingStart:t.timeStamp+r};o.forEach((function(n){n(e)})),o=[]}},U=function(e){if(e.cancelable){var n=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;"pointerdown"==e.type?function(e,n){var t=function(){K(e,n),i()},r=function(){i()},i=function(){removeEventListener("pointerup",t,G),removeEventListener("pointercancel",r,G)};addEventListener("pointerup",t,G),addEventListener("pointercancel",r,G)}(n,e):K(n,e)}},W=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach((function(n){return e(n,U,G)}))},X=[100,300];return e.CLSThresholds=w,e.FCPThresholds=S,e.FIDThresholds=X,e.INPThresholds=O,e.LCPThresholds=j,e.TTFBThresholds=_,e.onCLS=function(e,n){n=n||{},b(m((function(){var t,r=f("CLS",0),i=0,o=[],a=function(e){e.forEach((function(e){if(!e.hadRecentInput){var n=o[0],t=o[o.length-1];i&&e.startTime-t.startTime<1e3&&e.startTime-n.startTime<5e3?(i+=e.value,o.push(e)):(i=e.value,o=[e])}})),i>r.value&&(r.value=i,r.entries=o,t())},u=d("layout-shift",a);u&&(t=l(e,r,w,n.reportAllChanges),v((function(){a(u.takeRecords()),t(!0)})),c((function(){i=0,r=f("CLS",0),t=l(e,r,w,n.reportAllChanges),p((function(){return t()}))})),setTimeout(t,0))})))},e.onFCP=b,e.onFID=function(e,n){n=n||{},L((function(){var i,a=C(),u=f("FID"),s=function(e){e.startTime<a.firstHiddenTime&&(u.value=e.processingStart-e.startTime,u.entries.push(e),i(!0))},p=function(e){e.forEach(s)},h=d("first-input",p);i=l(e,u,X,n.reportAllChanges),h&&(v(m((function(){p(h.takeRecords()),h.disconnect()}))),c((function(){var a;u=f("FID"),i=l(e,u,X,n.reportAllChanges),o=[],r=-1,t=null,W(addEventListener),a=s,o.push(a),Q()})))}))},e.onINP=function(e,n){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(n=n||{},L((function(){var t;k();var r,i=f("INP"),o=function(e){q((function(){e.forEach(N);var n=x();n&&n.latency!==i.value&&(i.value=n.latency,i.entries=n.entries,r())}))},a=d("event",o,{durationThreshold:null!==(t=n.durationThreshold)&&void 0!==t?t:40});r=l(e,i,O,n.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),v((function(){o(a.takeRecords()),r(!0)})),c((function(){R=M(),D.length=0,B.clear(),i=f("INP"),r=l(e,i,O,n.reportAllChanges)})))})))},e.onLCP=function(e,n){n=n||{},L((function(){var t,r=C(),i=f("LCP"),o=function(e){n.reportAllChanges||(e=e.slice(-1)),e.forEach((function(e){e.startTime<r.firstHiddenTime&&(i.value=Math.max(e.startTime-s(),0),i.entries=[e],t())}))},a=d("largest-contentful-paint",o);if(a){t=l(e,i,j,n.reportAllChanges);var u=m((function(){V[i.id]||(o(a.takeRecords()),a.disconnect(),V[i.id]=!0,t(!0))}));["keydown","click"].forEach((function(e){addEventListener(e,(function(){return q(u)}),{once:!0,capture:!0})})),v(u),c((function(r){i=f("LCP"),t=l(e,i,j,n.reportAllChanges),p((function(){i.value=performance.now()-r.timeStamp,V[i.id]=!0,t(!0)}))}))}}))},e.onTTFB=function(e,n){n=n||{};var t=f("TTFB"),r=l(e,t,_,n.reportAllChanges);z((function(){var i=u();i&&(t.value=Math.max(i.responseStart-s(),0),t.entries=[i],r(!0),c((function(){t=f("TTFB",0),(r=l(e,t,_,n.reportAllChanges))(!0)})))}))},e}({});` +
|
|
795
|
+
'\n' +
|
|
796
|
+
// Glue: wire web-vitals callbacks into window.__v16_perf
|
|
797
|
+
`window.__v16_perf = {lcp: null, cls: null, fcp: null, inp: null, ttfb: null};
|
|
798
|
+
webVitals.onLCP(m => { window.__v16_perf.lcp = m.value; }, {reportAllChanges: true});
|
|
799
|
+
webVitals.onCLS(m => { window.__v16_perf.cls = m.value; }, {reportAllChanges: true});
|
|
800
|
+
webVitals.onINP(m => { window.__v16_perf.inp = m.value; }, {reportAllChanges: true});
|
|
801
|
+
webVitals.onFCP(m => { window.__v16_perf.fcp = m.value; }, {reportAllChanges: true});
|
|
802
|
+
webVitals.onTTFB(m => { window.__v16_perf.ttfb = m.value; }, {reportAllChanges: true});`;
|
|
803
|
+
async function installPerformance(context) {
|
|
804
|
+
await context.addInitScript(WEB_VITALS_INIT_SCRIPT);
|
|
805
|
+
}
|
|
806
|
+
// ── Query wrappers (called by generated test code) ──
|
|
807
|
+
/**
|
|
808
|
+
* Build a query API object for network — injected as `network` into the user's code.
|
|
809
|
+
*/
|
|
810
|
+
function buildNetworkAPI() {
|
|
811
|
+
return {
|
|
812
|
+
requests(filter) {
|
|
813
|
+
let results = [...networkEntries];
|
|
814
|
+
if (!filter)
|
|
815
|
+
return results;
|
|
816
|
+
if (filter.method)
|
|
817
|
+
results = results.filter(e => e.method === filter.method);
|
|
818
|
+
if (filter.domain)
|
|
819
|
+
results = results.filter(e => e.domain === filter.domain);
|
|
820
|
+
if (filter.path)
|
|
821
|
+
results = results.filter(e => e.path === filter.path);
|
|
822
|
+
if (filter.pathGlob) {
|
|
823
|
+
const re = new RegExp('^' + filter.pathGlob.replace(/\*/g, '.*').replace(/\?/g, '.') + '$');
|
|
824
|
+
results = results.filter(e => re.test(e.path));
|
|
825
|
+
}
|
|
826
|
+
if (filter.resourceType)
|
|
827
|
+
results = results.filter(e => e.resourceType === filter.resourceType);
|
|
828
|
+
if (filter.status) {
|
|
829
|
+
if (typeof filter.status === 'number') {
|
|
830
|
+
results = results.filter(e => e.responseStatus === filter.status);
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
const { min, max } = filter.status;
|
|
834
|
+
results = results.filter(e => e.responseStatus !== null && e.responseStatus >= min && e.responseStatus <= max);
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
return results;
|
|
838
|
+
},
|
|
839
|
+
get entries() { return [...networkEntries]; },
|
|
840
|
+
get domains() { return [...new Set(networkEntries.map(e => e.domain))]; },
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
// glob -> RegExp matching Python's fnmatch (treats `.` and other regex specials as
|
|
844
|
+
// literals): escape specials first, then `*` -> `.*`, `?` -> `.`. Brackets become literal
|
|
845
|
+
// (fine for URL globs that only use `*`/`?`, and it avoids throwing on an unbalanced `[`).
|
|
846
|
+
function globToRegExp(glob) {
|
|
847
|
+
const escaped = glob.replace(/[.+^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*').replace(/\?/g, '.');
|
|
848
|
+
return new RegExp('^' + escaped + '$');
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Build a query API object for WebSocket — injected as `websocket` into the user's
|
|
852
|
+
* code, alongside `network`. Light filters; the query code does the rest.
|
|
853
|
+
*/
|
|
854
|
+
function buildWebSocketAPI() {
|
|
855
|
+
const matchUrl = (c, url, urlGlob) => {
|
|
856
|
+
if (url && c.url !== url)
|
|
857
|
+
return false;
|
|
858
|
+
if (urlGlob && !globToRegExp(urlGlob).test(c.url))
|
|
859
|
+
return false;
|
|
860
|
+
return true;
|
|
861
|
+
};
|
|
862
|
+
return {
|
|
863
|
+
connections(filter) {
|
|
864
|
+
let results = [...wsConnections];
|
|
865
|
+
if (filter)
|
|
866
|
+
results = results.filter(c => matchUrl(c, filter.url, filter.urlGlob));
|
|
867
|
+
return results;
|
|
868
|
+
},
|
|
869
|
+
frames(filter) {
|
|
870
|
+
const out = [];
|
|
871
|
+
for (const c of wsConnections) {
|
|
872
|
+
if (filter && !matchUrl(c, filter.url, filter.urlGlob))
|
|
873
|
+
continue;
|
|
874
|
+
for (const f of c.frames) {
|
|
875
|
+
if (filter?.direction && f.direction !== filter.direction)
|
|
876
|
+
continue;
|
|
877
|
+
if (f.isBinary && !filter?.includeBinary)
|
|
878
|
+
continue;
|
|
879
|
+
out.push(f);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
out.sort((a, b) => a.seq - b.seq); // global merge order across connections
|
|
883
|
+
return out;
|
|
884
|
+
},
|
|
885
|
+
get all() { return [...wsConnections]; },
|
|
886
|
+
};
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Build a query API object for SSE — injected as `sse` into the user's code,
|
|
890
|
+
* alongside `network`. Light filters; the query code does the rest. Mirror of
|
|
891
|
+
* the Python _ReadOnlySSELog.
|
|
892
|
+
*/
|
|
893
|
+
function buildSSEAPI() {
|
|
894
|
+
const matchUrl = (c, url, urlGlob) => {
|
|
895
|
+
if (url && c.url !== url)
|
|
896
|
+
return false;
|
|
897
|
+
if (urlGlob && !globToRegExp(urlGlob).test(c.url))
|
|
898
|
+
return false;
|
|
899
|
+
return true;
|
|
900
|
+
};
|
|
901
|
+
return {
|
|
902
|
+
connections(filter) {
|
|
903
|
+
let results = [...sseConnections];
|
|
904
|
+
if (filter)
|
|
905
|
+
results = results.filter(c => matchUrl(c, filter.url, filter.urlGlob));
|
|
906
|
+
return results;
|
|
907
|
+
},
|
|
908
|
+
messages(filter) {
|
|
909
|
+
const out = [];
|
|
910
|
+
for (const c of sseConnections) {
|
|
911
|
+
if (filter && !matchUrl(c, filter.url, filter.urlGlob))
|
|
912
|
+
continue;
|
|
913
|
+
for (const m of c.messages) {
|
|
914
|
+
if (filter?.event !== undefined && m.event !== filter.event)
|
|
915
|
+
continue;
|
|
916
|
+
out.push(m);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
out.sort((a, b) => a.seq - b.seq); // global merge order across connections
|
|
920
|
+
return out;
|
|
921
|
+
},
|
|
922
|
+
get all() { return [...sseConnections]; },
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Build a query API object for console — injected as `consoleLog` into the user's code.
|
|
927
|
+
*/
|
|
928
|
+
function buildConsoleAPI() {
|
|
929
|
+
return {
|
|
930
|
+
messages(filter) {
|
|
931
|
+
let results = [...consoleEntries];
|
|
932
|
+
if (!filter)
|
|
933
|
+
return results;
|
|
934
|
+
if (filter.level)
|
|
935
|
+
results = results.filter(e => e.level === filter.level);
|
|
936
|
+
if (filter.textContains)
|
|
937
|
+
results = results.filter(e => e.text.includes(filter.textContains));
|
|
938
|
+
if (filter.isException !== undefined)
|
|
939
|
+
results = results.filter(e => e.isException === filter.isException);
|
|
940
|
+
return results;
|
|
941
|
+
},
|
|
942
|
+
errors() { return consoleEntries.filter(e => e.level === 'error'); },
|
|
943
|
+
warnings() { return consoleEntries.filter(e => e.level === 'warning'); },
|
|
944
|
+
get entries() { return [...consoleEntries]; },
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Build a query API for cookies — injected as `cookies` into user's code.
|
|
949
|
+
*/
|
|
950
|
+
function buildCookiesAPI(entries) {
|
|
951
|
+
return {
|
|
952
|
+
get(name) { return entries.find(c => c.name === name) ?? null; },
|
|
953
|
+
all() { return [...entries]; },
|
|
954
|
+
names() { return entries.map(c => c.name); },
|
|
955
|
+
byDomain(domain) { return entries.filter(c => c.domain === domain || c.domain.endsWith(`.${domain}`)); },
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
/**
|
|
959
|
+
* Build a query API for localStorage — injected as `storage` into user's code.
|
|
960
|
+
*/
|
|
961
|
+
function buildStorageAPI(data) {
|
|
962
|
+
return {
|
|
963
|
+
get(key) { return data[key] ?? null; },
|
|
964
|
+
all() { return { ...data }; },
|
|
965
|
+
keys() { return Object.keys(data); },
|
|
966
|
+
has(key) { return key in data; },
|
|
967
|
+
};
|
|
968
|
+
}
|
|
969
|
+
// ── Read settle ──
|
|
970
|
+
//
|
|
971
|
+
// Every devtools read is a one-shot snapshot of state the PAGE writes
|
|
972
|
+
// asynchronously: a cookie set from a React effect that runs after `load`, a
|
|
973
|
+
// console line emitted during hydration, the response to a click-triggered XHR.
|
|
974
|
+
// Generated tests run their steps back-to-back, so the snapshot regularly fires
|
|
975
|
+
// before the write lands and the read returns '' — which the consuming assertion
|
|
976
|
+
// then compares as a value. Authoring never saw this: its retry costs an LLM
|
|
977
|
+
// round-trip, so the page has always settled by the time it re-reads.
|
|
978
|
+
//
|
|
979
|
+
// So poll the query until it yields something, bounded by
|
|
980
|
+
// configure({ devtoolsReadTimeoutMs }). A query that is legitimately empty ('no
|
|
981
|
+
// console errors') still returns '' at the deadline, and a timeout of 0 restores
|
|
982
|
+
// the single-snapshot behaviour exactly.
|
|
983
|
+
//
|
|
984
|
+
// 'Something' excludes a stringified null. Authored queries routinely read a
|
|
985
|
+
// field straight through String() — `return String(perf.lcpMs)` — so a vital that
|
|
986
|
+
// has not been reported yet comes back as the four characters 'null', which is a
|
|
987
|
+
// non-empty value and would short-circuit the poll on its first attempt (TE-26878:
|
|
988
|
+
// LCP read ~1 s after goto, a null sentinel stored, assertion failed; the same
|
|
989
|
+
// export passed three minutes later when LCP happened to land in time). Those
|
|
990
|
+
// sentinels are treated as 'not yet' and re-polled; if the budget expires on one
|
|
991
|
+
// it is returned as-is, so a query that really does evaluate to null still
|
|
992
|
+
// yields what it always did, just later.
|
|
993
|
+
const DEVTOOLS_READ_POLL_MS = 250;
|
|
994
|
+
const NOT_YET_SENTINELS = new Set(['None', 'null', 'undefined', 'nan', 'NaN']);
|
|
995
|
+
/** Settle budget in ms. Env wins so a run can be tuned without a re-export. */
|
|
996
|
+
function readTimeoutMs(key = 'devtoolsReadTimeoutMs', envName = 'TESTMU_DEVTOOLS_READ_TIMEOUT_MS') {
|
|
997
|
+
const env = (process.env[envName] ?? '').trim();
|
|
998
|
+
if (env) {
|
|
999
|
+
const parsed = Number.parseInt(env, 10);
|
|
1000
|
+
if (Number.isFinite(parsed) && parsed >= 0)
|
|
1001
|
+
return parsed;
|
|
1002
|
+
log.helper(`${envName}='${env}' is not an integer — ignoring`);
|
|
1003
|
+
}
|
|
1004
|
+
return Math.max(0, Number(configure.get(key)) || 0);
|
|
1005
|
+
}
|
|
1006
|
+
function perfReadTimeoutMs() {
|
|
1007
|
+
return readTimeoutMs('devtoolsPerfReadTimeoutMs', 'TESTMU_DEVTOOLS_PERF_READ_TIMEOUT_MS');
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Re-run `runOnce` until it returns a value, or the settle budget runs out.
|
|
1011
|
+
*
|
|
1012
|
+
* The error is carried only so an exhausted read can say WHY it stayed empty: a
|
|
1013
|
+
* query whose code throws because the entry it dereferences does not exist yet
|
|
1014
|
+
* is the same "too early" case as an empty result, and clears itself the same way.
|
|
1015
|
+
*/
|
|
1016
|
+
async function settle(label, runOnce, timeoutMs = readTimeoutMs()) {
|
|
1017
|
+
const deadline = Date.now() + timeoutMs;
|
|
1018
|
+
let attempts = 0;
|
|
1019
|
+
for (;;) {
|
|
1020
|
+
attempts++;
|
|
1021
|
+
const { value, error } = await runOnce();
|
|
1022
|
+
if (value && NOT_YET_SENTINELS.has(value.trim())) {
|
|
1023
|
+
if (Date.now() >= deadline) {
|
|
1024
|
+
log.helper(`${label}: still '${value}' after ${attempts} attempt(s) over ${timeoutMs}ms — returning it`);
|
|
1025
|
+
return value;
|
|
1026
|
+
}
|
|
1027
|
+
await new Promise(resolve => setTimeout(resolve, DEVTOOLS_READ_POLL_MS));
|
|
1028
|
+
continue;
|
|
1029
|
+
}
|
|
1030
|
+
if (value) {
|
|
1031
|
+
if (attempts > 1)
|
|
1032
|
+
log.helper(`${label}: settled after ${attempts} attempt(s)`);
|
|
1033
|
+
return value;
|
|
1034
|
+
}
|
|
1035
|
+
if (Date.now() >= deadline) {
|
|
1036
|
+
if (error !== undefined) {
|
|
1037
|
+
log.helper(`${label}: empty after ${attempts} attempt(s) over ${timeoutMs}ms — last error: ${error}`);
|
|
1038
|
+
}
|
|
1039
|
+
else if (attempts > 1) {
|
|
1040
|
+
log.helper(`${label}: empty after ${attempts} attempt(s) over ${timeoutMs}ms`);
|
|
1041
|
+
}
|
|
1042
|
+
return '';
|
|
1043
|
+
}
|
|
1044
|
+
await new Promise(resolve => setTimeout(resolve, DEVTOOLS_READ_POLL_MS));
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
export async function devtoolsNetworkQuery(codeJs) {
|
|
1048
|
+
return settle('devtoolsNetworkQuery', async () => {
|
|
1049
|
+
try {
|
|
1050
|
+
// Build args dynamically, gated on the PERSISTENT configured flags (never
|
|
1051
|
+
// .length — eviction can splice connections to 0 mid-session, which would
|
|
1052
|
+
// drop the object and silently pass + regress WS). websocket and sse are
|
|
1053
|
+
// independent: a query can use network only, +ws, +sse, or all three. When
|
|
1054
|
+
// neither was configured this is the exact single-arg form (byte-identical).
|
|
1055
|
+
const names = ['network'];
|
|
1056
|
+
const values = [buildNetworkAPI()];
|
|
1057
|
+
if (wsConfigured) {
|
|
1058
|
+
names.push('websocket');
|
|
1059
|
+
values.push(buildWebSocketAPI());
|
|
1060
|
+
}
|
|
1061
|
+
if (sseConfigured) {
|
|
1062
|
+
names.push('sse');
|
|
1063
|
+
values.push(buildSSEAPI());
|
|
1064
|
+
}
|
|
1065
|
+
const fn = new Function(...names, `"use strict";\n${codeJs}`);
|
|
1066
|
+
const result = fn(...values);
|
|
1067
|
+
return { value: stringifyQueryResult(result) };
|
|
1068
|
+
}
|
|
1069
|
+
catch (e) {
|
|
1070
|
+
return { value: '', error: e };
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
export async function devtoolsConsoleQuery(codeJs) {
|
|
1075
|
+
return settle('devtoolsConsoleQuery', async () => {
|
|
1076
|
+
// Rebuild the API on every attempt — the console log is what grows while we settle.
|
|
1077
|
+
const consoleLog = buildConsoleAPI();
|
|
1078
|
+
try {
|
|
1079
|
+
const fn = new Function('consoleLog', `"use strict";\n${codeJs}`);
|
|
1080
|
+
const result = fn(consoleLog);
|
|
1081
|
+
return { value: stringifyQueryResult(result) };
|
|
1082
|
+
}
|
|
1083
|
+
catch (e) {
|
|
1084
|
+
return { value: '', error: e };
|
|
1085
|
+
}
|
|
1086
|
+
});
|
|
1087
|
+
}
|
|
1088
|
+
export async function devtoolsCookiesQuery(codeJs) {
|
|
1089
|
+
return settle('devtoolsCookiesQuery', async () => {
|
|
1090
|
+
// Re-snapshot the jar on every attempt — it is what changes while we settle.
|
|
1091
|
+
let rawCookies = [];
|
|
1092
|
+
if (contextRef) {
|
|
1093
|
+
rawCookies = await contextRef.cookies();
|
|
1094
|
+
}
|
|
1095
|
+
const entries = rawCookies.map(c => ({
|
|
1096
|
+
name: String(c.name ?? ''),
|
|
1097
|
+
value: String(c.value ?? ''),
|
|
1098
|
+
domain: String(c.domain ?? ''),
|
|
1099
|
+
path: String(c.path ?? '/'),
|
|
1100
|
+
expires: Number(c.expires ?? -1),
|
|
1101
|
+
httpOnly: Boolean(c.httpOnly),
|
|
1102
|
+
secure: Boolean(c.secure),
|
|
1103
|
+
sameSite: String(c.sameSite ?? 'None'),
|
|
1104
|
+
}));
|
|
1105
|
+
const cookies = buildCookiesAPI(entries);
|
|
1106
|
+
try {
|
|
1107
|
+
const fn = new Function('cookies', `"use strict";\n${codeJs}`);
|
|
1108
|
+
const result = fn(cookies);
|
|
1109
|
+
return { value: stringifyQueryResult(result) };
|
|
1110
|
+
}
|
|
1111
|
+
catch (e) {
|
|
1112
|
+
return { value: '', error: e };
|
|
1113
|
+
}
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
export async function devtoolsStorageQuery(codeJs) {
|
|
1117
|
+
return settle('devtoolsStorageQuery', async () => {
|
|
1118
|
+
// Re-snapshot localStorage on every attempt — it is what changes while we settle.
|
|
1119
|
+
let data = {};
|
|
1120
|
+
if (pageRef) {
|
|
1121
|
+
try {
|
|
1122
|
+
data = await pageRef.evaluate(() => {
|
|
1123
|
+
const s = {};
|
|
1124
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
1125
|
+
const k = localStorage.key(i);
|
|
1126
|
+
if (k)
|
|
1127
|
+
s[k] = localStorage.getItem(k) ?? '';
|
|
1128
|
+
}
|
|
1129
|
+
return s;
|
|
1130
|
+
});
|
|
1131
|
+
}
|
|
1132
|
+
catch { /* ignore */ }
|
|
1133
|
+
}
|
|
1134
|
+
const storage = buildStorageAPI(data);
|
|
1135
|
+
try {
|
|
1136
|
+
const fn = new Function('storage', `"use strict";\n${codeJs}`);
|
|
1137
|
+
const result = fn(storage);
|
|
1138
|
+
return { value: stringifyQueryResult(result) };
|
|
1139
|
+
}
|
|
1140
|
+
catch (e) {
|
|
1141
|
+
return { value: '', error: e };
|
|
1142
|
+
}
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
export async function devtoolsPerformanceQuery(codeJs) {
|
|
1146
|
+
if (!pageRef)
|
|
1147
|
+
return '';
|
|
1148
|
+
// Vitals land progressively (TTFB/FCP first, LCP after paint settles), so
|
|
1149
|
+
// re-read them on every attempt — and, since they can trail the load event by
|
|
1150
|
+
// seconds, under the longer performance budget. A not-yet vital read through
|
|
1151
|
+
// String() is a 'null' sentinel, handled by settle().
|
|
1152
|
+
return settle('devtoolsPerformanceQuery', async () => {
|
|
1153
|
+
let raw = {};
|
|
1154
|
+
try {
|
|
1155
|
+
raw = await pageRef.evaluate('(() => window.__v16_perf)()') ?? {};
|
|
1156
|
+
}
|
|
1157
|
+
catch { /* ignore */ }
|
|
1158
|
+
// snake_case aliases alongside the camelCase names: the recorded code_js for
|
|
1159
|
+
// a performance query is authored next to the Python one and routinely reads
|
|
1160
|
+
// `perf.lcp_ms`, which in JS is `undefined` — String()'d to the literal
|
|
1161
|
+
// "undefined" and asserted against, with no error and nothing for the settle
|
|
1162
|
+
// to wait for (TE-26878). Both spellings read the same snapshot.
|
|
1163
|
+
const perf = {
|
|
1164
|
+
get lcpMs() { return raw?.lcp ?? null; },
|
|
1165
|
+
get cls() { return raw?.cls ?? null; },
|
|
1166
|
+
get inpMs() { return raw?.inp ?? null; },
|
|
1167
|
+
get fcpMs() { return raw?.fcp ?? null; },
|
|
1168
|
+
get ttfbMs() { return raw?.ttfb ?? null; },
|
|
1169
|
+
get lcp_ms() { return this.lcpMs; },
|
|
1170
|
+
get inp_ms() { return this.inpMs; },
|
|
1171
|
+
get fcp_ms() { return this.fcpMs; },
|
|
1172
|
+
get ttfb_ms() { return this.ttfbMs; },
|
|
1173
|
+
all() {
|
|
1174
|
+
return {
|
|
1175
|
+
lcpMs: this.lcpMs, cls: this.cls, inpMs: this.inpMs, fcpMs: this.fcpMs, ttfbMs: this.ttfbMs,
|
|
1176
|
+
lcp_ms: this.lcpMs, inp_ms: this.inpMs, fcp_ms: this.fcpMs, ttfb_ms: this.ttfbMs,
|
|
1177
|
+
};
|
|
1178
|
+
},
|
|
1179
|
+
};
|
|
1180
|
+
try {
|
|
1181
|
+
const fn = new Function('perf', `"use strict";\n${codeJs}`);
|
|
1182
|
+
const result = fn(perf);
|
|
1183
|
+
return { value: stringifyQueryResult(result) };
|
|
1184
|
+
}
|
|
1185
|
+
catch (e) {
|
|
1186
|
+
return { value: '', error: e };
|
|
1187
|
+
}
|
|
1188
|
+
}, perfReadTimeoutMs());
|
|
1189
|
+
}
|
|
1190
|
+
// ── Virtual clipboard (configure({clipboard: true})) ──
|
|
1191
|
+
let clipboardStore = null;
|
|
1192
|
+
function requireClipboard() {
|
|
1193
|
+
if (!clipboardStore)
|
|
1194
|
+
throw new Error("Virtual clipboard not installed — call testmu.configure({clipboard: true})");
|
|
1195
|
+
return clipboardStore;
|
|
1196
|
+
}
|
|
1197
|
+
export async function clipboardWrite(text, opts) {
|
|
1198
|
+
requireClipboard().write(text, opts?.html);
|
|
1199
|
+
}
|
|
1200
|
+
export async function clipboardPaste() {
|
|
1201
|
+
if (!pageRef)
|
|
1202
|
+
throw new Error('No active page for clipboardPaste()');
|
|
1203
|
+
await pasteViaPage(pageRef, requireClipboard());
|
|
1204
|
+
}
|
|
1205
|
+
export async function clipboardClear() {
|
|
1206
|
+
requireClipboard().clear();
|
|
1207
|
+
}
|
|
1208
|
+
export async function devtoolsClipboardQuery(codeJs) {
|
|
1209
|
+
// Settled like the other reads: the clipboard is filled by a page-side copy the
|
|
1210
|
+
// previous step may not have flushed yet. Re-read the store on every attempt.
|
|
1211
|
+
return settle('devtoolsClipboardQuery', async () => ({
|
|
1212
|
+
value: runClipboardQuery(codeJs, requireClipboard()),
|
|
1213
|
+
}));
|
|
1214
|
+
}
|
|
1215
|
+
//# sourceMappingURL=devtools.js.map
|