peachsim 0.1.1667 → 0.1.1673
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cli/bridge-flow-runner.ts +4 -1
- package/cli/commands/coverage-swift.ts +291 -0
- package/cli/commands/coverage.ts +168 -24
- package/cli/commands/diagnose.ts +1 -19
- package/cli/commands/react.ts +3 -18
- package/cli/commands/screenshot.ts +1 -1
- package/cli/commands/screenshots-capture.ts +1 -1
- package/cli/drivers/playwright-provisioning.ts +1 -4
- package/cli/drivers/playwright.ts +15 -1
- package/cli/scene-video.ts +1 -1
- package/cli/ui.ts +20 -0
- package/cli/ws-bridge.ts +7 -36
- package/detox/frame-identity.cjs +21 -0
- package/detox/frame-identity.d.cts +6 -0
- package/detox/index.ts +39 -33
- package/detox/jest-environment.cjs +4 -1
- package/detox/jest-setup-after-env.cjs +0 -4
- package/detox/navigation-lifecycle.ts +2 -2
- package/detox/proof-observer.ts +126 -0
- package/dist-lib/agent-daemon-client.cjs +29 -1
- package/dist-lib/agent-events.cjs +1 -1
- package/dist-lib/attached-projects.cjs +10 -1
- package/dist-lib/auth/shared-session.cjs +1 -1
- package/dist-lib/backend-origin.cjs +1 -1
- package/dist-lib/beta.cjs +1 -1
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +1 -1
- package/dist-lib/bridge-contract-input.cjs +1 -1
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +1 -1
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +530 -154
- package/dist-lib/capture-contract.cjs +1 -1
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +1 -1
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +1 -1
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +1 -1
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +1 -1
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +5074 -7353
- package/dist-lib/detox/jest-environment.cjs +4 -1
- package/dist-lib/dev-bundle-resolution.cjs +1 -1
- package/dist-lib/expo-swift-bundle.cjs +578 -151
- package/dist-lib/expo-swift-metadata.cjs +1 -1
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +1 -1
- package/dist-lib/host/bridge-host.cjs +660 -192
- package/dist-lib/host/fetch-proxy-handler.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.cjs +1 -1
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +1 -1
- package/dist-lib/host/websocket-proxy.cjs +1 -1
- package/dist-lib/index.cjs +206 -6
- package/dist-lib/jump-to-source-babel.cjs +1 -1
- package/dist-lib/jump-to-source-native.cjs +1 -1
- package/dist-lib/kotlin-host.cjs +1 -1
- package/dist-lib/menu.cjs +1 -1
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +1 -1
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +10 -1
- package/dist-lib/metro-production-bundle.mjs +12 -1
- package/dist-lib/metro.cjs +155 -5
- package/dist-lib/native-app-identity-project.cjs +43 -5
- package/dist-lib/native-app-identity-project.mjs +43 -5
- package/dist-lib/native-app-identity.cjs +1 -1
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +1 -1
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +1 -1
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +21 -1
- package/dist-lib/public-brand.cjs +1 -1
- package/dist-lib/public-origins-lib-esm.json +73 -27
- package/dist-lib/public-origins-lib-static.json +1 -1
- package/dist-lib/public-origins-lib.json +563 -183
- package/dist-lib/react-native-host-modules.cjs +1 -1
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +964 -0
- package/dist-lib/scripts/dev-server-scanner.cjs +1 -1
- package/dist-lib/sdk.cjs +1 -1
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +963 -521
- package/dist-lib/swift-compile.cjs +276 -86
- package/dist-lib/swift-compile.mjs +276 -86
- package/dist-lib/swift-package.cjs +34 -4
- package/dist-lib/swift-package.mjs +33 -4
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +2 -2
- package/dist-lib/swift-toolchain.cjs +25 -44
- package/dist-lib/swift.cjs +1 -1
- package/dist-lib/vite-swift.cjs +579 -113
- package/dist-lib/vite.cjs +61 -2
- package/dist-lib/worklet-executable.cjs +1 -1
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/clipboardContract.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/glass-material.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
- package/dist-types/packages/peach-engine/src/engine/inspect-outline.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/engine/liquid-glass.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/paint-boundary.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +24 -0
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +4 -2
- package/dist-types/packages/peach-engine/src/settings/devices.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/clipboardBridgeContract.d.ts +18 -0
- package/dist-types/packages/peach-globals/src/index.d.ts +1 -1
- package/dist-types/packages/peach-globals/src/nodeContract.d.ts +1 -0
- package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +2 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +36 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStore.h +439 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreCopySpecific.h +216 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCDynamicStoreKey.h +267 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetwork.h +204 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConfiguration.h +1393 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkConnection.h +568 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCNetworkReachability.h +369 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferences.h +473 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesPath.h +179 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCPreferencesSetSpecific.h +95 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SCSchemaDefinitions.h +2395 -0
- package/sdk/ios/System/Library/Frameworks/SystemConfiguration.framework/Headers/SystemConfiguration.h +184 -0
- package/sdk/ios/usr/include/libkern/OSByteOrder.h +315 -0
- package/sdk/ios/usr/include/libkern/machine/OSByteOrder.h +147 -0
- package/src/bridge-contract.ts +42 -0
- package/src/chromium-admission.ts +196 -0
- package/src/host/bridge-host.ts +6 -43
- package/src/launch-deadline.ts +74 -0
- package/src/nitro-adapter.lock.json +3 -3
- package/src/profiles.ts +21 -0
- package/src/react-native-coverage/capability-reference-resolution.ts +402 -0
- package/src/react-native-coverage/capability-source-references.ts +1296 -0
- package/src/react-native-coverage/native-typescript-parser.ts +74 -0
- package/src/react-native-coverage/project-aliases.ts +207 -0
- package/src/react-native-coverage/verified-reach.ts +47 -0
- package/src/reap-browser.ts +1019 -0
- package/src/skills/builtin/a11y-review.ts +1 -1
- package/src/skills/builtin/perf-profile.ts +1 -1
- package/src/skills/builtin/screenshot-all.ts +1 -1
- package/src/skills/builtin/visual-diff.ts +1 -1
- package/src/swift-compile.ts +107 -56
- package/src/swift-coverage/indexdump.ts +80 -0
- package/src/swift-coverage/indexing.ts +147 -0
- package/src/swift-coverage/package.ts +230 -0
- package/src/swift-coverage/provenance.ts +47 -0
- package/src/swift-coverage/reader.ts +81 -0
- package/src/swift-coverage/source.ts +252 -0
- package/src/swift-coverage/types.ts +58 -0
- package/src/swift-coverage/xcode-assets.ts +175 -0
- package/src/swift-coverage/xcode-bridging.ts +160 -0
- package/src/swift-coverage/xcode-packages.ts +251 -0
- package/src/swift-coverage/xcode-strings.ts +78 -0
- package/src/swift-coverage/xcode.ts +656 -0
- package/src/swift-distribution.lock.json +8 -8
- package/src/swift-host.ts +21 -1
- package/src/swift-objc-import.ts +191 -27
- package/src/swift-objc-standin.ts +4 -2
- package/src/swift-package-manifest.ts +134 -13
- package/src/swift-package.ts +46 -4
- package/src/swift-submit.ts +2 -1
- package/src/swift-toolchain.ts +36 -61
- package/src/worker-system-chunks.ts +3 -10
- package/src/xcode-project.ts +5 -5
- package/detox/attempt-events.cjs +0 -914
- package/detox/attempt-events.d.cts +0 -113
- package/detox/motion-change.cjs +0 -524
- package/detox/motion-change.d.cts +0 -140
- package/detox/motion-leg-starts.cjs +0 -20
- package/detox/motion-leg-starts.d.cts +0 -8
- package/detox/proof-frame.cjs +0 -190
- package/detox/record-block-execution.cjs +0 -78
package/cli/commands/diagnose.ts
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
// "diagnose" pass, add it as one more parallel call here.
|
|
23
23
|
|
|
24
24
|
import { getCliIdentityKey } from '../current-sim'
|
|
25
|
+
import { formatTable } from '../ui'
|
|
25
26
|
import {
|
|
26
27
|
callInBridge,
|
|
27
28
|
createBridgeFromParsed,
|
|
@@ -336,25 +337,6 @@ function formatTimelineRow(ev: SootSimTimelineEvent, anchorMs: number): string {
|
|
|
336
337
|
return ` -${dt.padStart(5)}s [${ev.kind}] ${payload}`
|
|
337
338
|
}
|
|
338
339
|
|
|
339
|
-
function formatTable(headers: string[], rows: string[][], indent: string): string {
|
|
340
|
-
if (rows.length === 0) return `${indent}(no rows)`
|
|
341
|
-
const widths = headers.map((h, i) =>
|
|
342
|
-
Math.max(h.length, ...rows.map((row) => row[i]?.length ?? 0)),
|
|
343
|
-
)
|
|
344
|
-
const line = (cells: string[]) =>
|
|
345
|
-
cells
|
|
346
|
-
.map((cell, i) => cell.padEnd(widths[i]))
|
|
347
|
-
.join(' ')
|
|
348
|
-
.trimEnd()
|
|
349
|
-
return [
|
|
350
|
-
line(headers),
|
|
351
|
-
line(headers.map((h) => '-'.repeat(h.length))),
|
|
352
|
-
...rows.map(line),
|
|
353
|
-
]
|
|
354
|
-
.map((row) => `${indent}${row}`)
|
|
355
|
-
.join('\n')
|
|
356
|
-
}
|
|
357
|
-
|
|
358
340
|
export async function runDiagnose(
|
|
359
341
|
args: string[],
|
|
360
342
|
opts: DiagnoseOptions,
|
package/cli/commands/react.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatTable } from '../ui'
|
|
1
2
|
import {
|
|
2
3
|
callInBridge,
|
|
3
4
|
callInBridgeWrite,
|
|
@@ -77,24 +78,6 @@ function numberFlag(args: string[], flag: string, fallback: number): number {
|
|
|
77
78
|
return Number.isFinite(value) && value > 0 ? Math.round(value) : fallback
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
function formatTable(headers: string[], rows: string[][]): string {
|
|
81
|
-
const widths = headers.map((h, i) =>
|
|
82
|
-
Math.max(h.length, ...rows.map((row) => row[i]?.length ?? 0)),
|
|
83
|
-
)
|
|
84
|
-
const line = (cells: string[]) =>
|
|
85
|
-
cells
|
|
86
|
-
.map((cell, i) => cell.padEnd(widths[i]))
|
|
87
|
-
.join(' ')
|
|
88
|
-
.trimEnd()
|
|
89
|
-
return [
|
|
90
|
-
line(headers),
|
|
91
|
-
line(headers.map((h) => '-'.repeat(h.length))),
|
|
92
|
-
...rows.map(line),
|
|
93
|
-
]
|
|
94
|
-
.map((row) => ` ${row}`)
|
|
95
|
-
.join('\n')
|
|
96
|
-
}
|
|
97
|
-
|
|
98
81
|
function printJson(value: unknown) {
|
|
99
82
|
console.log(JSON.stringify(value, null, 2))
|
|
100
83
|
}
|
|
@@ -122,6 +105,7 @@ function printSlow(result: {
|
|
|
122
105
|
String(row.commitCount),
|
|
123
106
|
`#${row.slowestCommit} ${row.slowestMs.toFixed(2)}ms`,
|
|
124
107
|
]),
|
|
108
|
+
' ',
|
|
125
109
|
),
|
|
126
110
|
)
|
|
127
111
|
}
|
|
@@ -149,6 +133,7 @@ function printRerenders(result: {
|
|
|
149
133
|
.join(', ')
|
|
150
134
|
return [row.displayName, String(row.renders ?? row.count), causes || '-']
|
|
151
135
|
}),
|
|
136
|
+
' ',
|
|
152
137
|
),
|
|
153
138
|
)
|
|
154
139
|
}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
import { mkdirSync } from 'fs'
|
|
10
10
|
import { dirname, resolve } from 'path'
|
|
11
|
-
import { launchReapedChrome } from '../../../../scripts/lib/reap-browser'
|
|
12
11
|
import { DEFAULT_SOOTSIM_BRIDGE_PORT } from '../../src/bridge-constants'
|
|
13
12
|
import { devices, type DeviceModel } from '../../src/device-catalog.ts'
|
|
13
|
+
import { launchReapedChrome } from '../../src/reap-browser'
|
|
14
14
|
import { composeFramedScreenshot } from '../../src/screenshots/frame-compose'
|
|
15
15
|
import { buildResolveRectEval, type SampleRect } from '../browser-evals'
|
|
16
16
|
import { createCloudBridgeForParsed } from '../cloud-client'
|
|
@@ -22,8 +22,8 @@ import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
|
|
|
22
22
|
import { tmpdir } from 'node:os'
|
|
23
23
|
import { dirname, isAbsolute, join, resolve } from 'node:path'
|
|
24
24
|
import { chromium, type Frame, type Page } from 'playwright-core'
|
|
25
|
-
import { launchReapedChromeScoped } from '../../../../scripts/lib/reap-browser'
|
|
26
25
|
import { rnxPublicBrand } from '../../src/public-brand'
|
|
26
|
+
import { launchReapedChromeScoped } from '../../src/reap-browser'
|
|
27
27
|
import { resolveCliAuth, type CliAuth } from '../auth'
|
|
28
28
|
import { peachExit } from '../run-rnx'
|
|
29
29
|
|
|
@@ -3,12 +3,9 @@ import { existsSync, readFileSync } from 'node:fs'
|
|
|
3
3
|
import { createRequire } from 'node:module'
|
|
4
4
|
import { dirname, join } from 'node:path'
|
|
5
5
|
import { installVerifiedTarball } from '@contrast/runtime-delivery'
|
|
6
|
-
import {
|
|
7
|
-
launchReapedChrome,
|
|
8
|
-
softwareChromeAllowed,
|
|
9
|
-
} from '../../../../scripts/lib/reap-browser'
|
|
10
6
|
import { playwrightCoreDir } from '../../src/home-paths'
|
|
11
7
|
import { isRecord } from '../../src/is-record'
|
|
8
|
+
import { launchReapedChrome, softwareChromeAllowed } from '../../src/reap-browser'
|
|
12
9
|
import { RNX_INTERNAL_CHILDREN, RNX_INTERNAL_COMMAND } from '../internal-child'
|
|
13
10
|
import { rnxSelfInvocation } from '../self-invocation'
|
|
14
11
|
import { ensureLinuxBrowserLibraries } from './linux-browser-libs'
|
|
@@ -25,7 +25,11 @@ import {
|
|
|
25
25
|
headlessHostCommand,
|
|
26
26
|
} from '../../src/desktop-host-delivery'
|
|
27
27
|
import { playwrightHostLogName } from '../../src/playwright-host-log'
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
ensureProfile,
|
|
30
|
+
liveBrowserPidForPlaywrightProfile,
|
|
31
|
+
playwrightProfileUserDataDir,
|
|
32
|
+
} from '../../src/profiles'
|
|
29
33
|
import { RNX_INTERNAL_CHILDREN, RNX_INTERNAL_COMMAND } from '../internal-child'
|
|
30
34
|
import { getProcessComm } from '../parent-pid'
|
|
31
35
|
import { rnxSelfInvocation } from '../self-invocation'
|
|
@@ -124,6 +128,16 @@ async function launch(opts: DriverLaunchOptions): Promise<DriverLaunchResult> {
|
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
|
|
131
|
+
if (opts.profileId) {
|
|
132
|
+
const livePid = liveBrowserPidForPlaywrightProfile(opts.profileId)
|
|
133
|
+
if (livePid !== null) {
|
|
134
|
+
return {
|
|
135
|
+
launched: false,
|
|
136
|
+
message: `profile "${opts.profileId}" is already open in browser pid ${livePid}; a profile holds one browser. drive that sim (\`peach use <id>\`, \`--sim <id>\`) or \`peach close\` it first`,
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
127
141
|
let resolved: ResolvedPlaywright
|
|
128
142
|
try {
|
|
129
143
|
resolved = await provisionPlaywright()
|
package/cli/scene-video.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises'
|
|
2
2
|
import { createRequire } from 'node:module'
|
|
3
|
-
import { launchReapedChrome } from '../../../scripts/lib/reap-browser'
|
|
4
3
|
import { getCliRuntime } from '../src/cli-runtime.ts'
|
|
4
|
+
import { launchReapedChrome } from '../src/reap-browser'
|
|
5
5
|
import {
|
|
6
6
|
ensurePlaywrightBrowser,
|
|
7
7
|
provisionPlaywright,
|
package/cli/ui.ts
CHANGED
|
@@ -71,3 +71,23 @@ export async function withSpinner<T>(label: string, run: () => Promise<T>): Prom
|
|
|
71
71
|
throw error
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
// a plain column table: headers, a dashed rule under each, cells padded to the
|
|
76
|
+
// widest in their column, every line prefixed with indent.
|
|
77
|
+
export function formatTable(headers: string[], rows: string[][], indent: string): string {
|
|
78
|
+
const widths = headers.map((h, i) =>
|
|
79
|
+
Math.max(h.length, ...rows.map((row) => row[i]?.length ?? 0)),
|
|
80
|
+
)
|
|
81
|
+
const line = (cells: string[]) =>
|
|
82
|
+
cells
|
|
83
|
+
.map((cell, i) => cell.padEnd(widths[i]))
|
|
84
|
+
.join(' ')
|
|
85
|
+
.trimEnd()
|
|
86
|
+
return [
|
|
87
|
+
line(headers),
|
|
88
|
+
line(headers.map((h) => '-'.repeat(h.length))),
|
|
89
|
+
...rows.map(line),
|
|
90
|
+
]
|
|
91
|
+
.map((row) => `${indent}${row}`)
|
|
92
|
+
.join('\n')
|
|
93
|
+
}
|
package/cli/ws-bridge.ts
CHANGED
|
@@ -14,7 +14,11 @@ import {
|
|
|
14
14
|
DEFAULT_SOOTSIM_BRIDGE_PORT,
|
|
15
15
|
resolveSootsimBridgePort,
|
|
16
16
|
} from '../src/bridge-constants'
|
|
17
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
commandWritesSim,
|
|
19
|
+
type BridgeSimInfo,
|
|
20
|
+
type WsBridgeCommand,
|
|
21
|
+
} from '../src/bridge-contract'
|
|
18
22
|
import { DEFAULT_SOOTSIM_SHELL_URL } from '../src/cli-constants'
|
|
19
23
|
import {
|
|
20
24
|
isDaemonLockfileFresh,
|
|
@@ -37,6 +41,8 @@ import {
|
|
|
37
41
|
import { setPauseAwareTimeout } from './pause-aware-timeout'
|
|
38
42
|
import { peachExit } from './run-rnx'
|
|
39
43
|
|
|
44
|
+
export type { BridgeSimInfo }
|
|
45
|
+
|
|
40
46
|
// --- bridge world resolution ---------------------------------------------
|
|
41
47
|
//
|
|
42
48
|
// two bridge kinds can coexist on one machine: Vite dev-shell bridges
|
|
@@ -396,41 +402,6 @@ function describeSimIdSource(
|
|
|
396
402
|
return 'primary fallback — no sim pinned'
|
|
397
403
|
}
|
|
398
404
|
|
|
399
|
-
export interface BridgeSimInfo {
|
|
400
|
-
id: string
|
|
401
|
-
origin?: string
|
|
402
|
-
url?: string
|
|
403
|
-
title?: string
|
|
404
|
-
userAgent?: string
|
|
405
|
-
connectedAt: number
|
|
406
|
-
lastSeenAt: number
|
|
407
|
-
lastActiveAt?: number
|
|
408
|
-
isPrimary: boolean
|
|
409
|
-
readyState: 'open' | 'closing' | 'closed'
|
|
410
|
-
attachedCliCount?: number
|
|
411
|
-
lockedBy?: string
|
|
412
|
-
lockedByKind?: 'cli' | 'user-active'
|
|
413
|
-
lockExpiresAt?: number
|
|
414
|
-
/** true when this sim's lease belongs to us. computed server-side. */
|
|
415
|
-
lockedByMe?: boolean
|
|
416
|
-
userFocused?: boolean
|
|
417
|
-
userVisible?: boolean
|
|
418
|
-
visibilityState?: string
|
|
419
|
-
documentFocused?: boolean
|
|
420
|
-
/** registration kind — 'sootsim' (default) or 'contrast'. used by the
|
|
421
|
-
* `contrast` CLI to filter, and by tooling that wants to distinguish a
|
|
422
|
-
* Contrast IDE tab from a regular peach runtime. */
|
|
423
|
-
kind?: string
|
|
424
|
-
/** opaque metadata supplied at register time (projectId, route, the
|
|
425
|
-
* attached iOS sim id, etc). free-form by design. */
|
|
426
|
-
meta?: Record<string, unknown>
|
|
427
|
-
/** why a retained disconnected sim left. present only on readyState
|
|
428
|
-
* 'closed' entries served with listSims({ includeRetained: true }). */
|
|
429
|
-
disconnectCause?: string
|
|
430
|
-
/** epoch-ms the sim socket closed. present with disconnectCause. */
|
|
431
|
-
disconnectedAt?: number
|
|
432
|
-
}
|
|
433
|
-
|
|
434
405
|
export class DisconnectedSimError extends Error {}
|
|
435
406
|
|
|
436
407
|
export function disconnectedSavedSimMessage(simId: string, detail = ''): string {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// how many consecutive identical captures prove a screen stopped moving.
|
|
2
|
+
// conformance compares these captures against native ios baselines, so a frame
|
|
3
|
+
// caught mid-animation reads as a real pixel diff.
|
|
4
|
+
const REQUIRED_IDENTICAL_PROOF_FRAMES = 3
|
|
5
|
+
|
|
6
|
+
// a flow's `takeScreenshot` is a developer artifact, not pixel evidence. one
|
|
7
|
+
// settled capture is what it wants: re-capturing flashes the screen on every
|
|
8
|
+
// attempt, and a screen with a blinking caret never produces two identical
|
|
9
|
+
// frames at all, so the step fails on a page that is perfectly fine.
|
|
10
|
+
const REQUIRED_IDENTICAL_FLOW_FRAMES = 1
|
|
11
|
+
|
|
12
|
+
function framesIdentical(a, b) {
|
|
13
|
+
if (!a || !b || a.length !== b.length) return false
|
|
14
|
+
return a.equals(b)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = {
|
|
18
|
+
REQUIRED_IDENTICAL_PROOF_FRAMES,
|
|
19
|
+
REQUIRED_IDENTICAL_FLOW_FRAMES,
|
|
20
|
+
framesIdentical,
|
|
21
|
+
}
|
package/detox/index.ts
CHANGED
|
@@ -8,29 +8,17 @@ import { createRequire } from 'node:module'
|
|
|
8
8
|
import { promisify } from 'node:util'
|
|
9
9
|
import * as path from 'path'
|
|
10
10
|
import { chromium } from 'playwright-core'
|
|
11
|
-
import {
|
|
12
|
-
launchReapedChromeScoped,
|
|
13
|
-
reserveChromiumAdmission,
|
|
14
|
-
type ChromiumLaunchAdmission,
|
|
15
|
-
} from '../../../scripts/lib/reap-browser'
|
|
16
|
-
import {
|
|
17
|
-
MOTION_CHANGE_DEFINITION,
|
|
18
|
-
type DiscreteFrameCadence,
|
|
19
|
-
type MotionChangeDefinition,
|
|
20
|
-
} from '../../peach-conformance/src/cases/checkpoint-evidence.cjs'
|
|
21
|
-
import { getCliRuntime } from '../src/cli-runtime.ts'
|
|
22
|
-
import type {
|
|
23
|
-
LockstepInputReceipt,
|
|
24
|
-
LockstepScheduledInput,
|
|
25
|
-
SootSimLockstepFrameReceipt,
|
|
26
|
-
} from '@peach/globals'
|
|
27
|
-
export { reserveChromiumAdmission } from '../../../scripts/lib/reap-browser'
|
|
28
|
-
|
|
29
11
|
import { waitForSootsimIdle as waitForRuntimeIdle } from '../cli/commands/inspect/settling'
|
|
30
12
|
import { createBridge } from '../cli/ws-bridge'
|
|
31
13
|
import { resolveSootsimBridgePortForHttpPort } from '../src/bridge-constants'
|
|
14
|
+
import { getCliRuntime } from '../src/cli-runtime.ts'
|
|
32
15
|
import { SOOTSIM_SHELL_COMMAND_NAME } from '../src/menu'
|
|
33
16
|
import { pollUntil } from '../src/poll-until'
|
|
17
|
+
import {
|
|
18
|
+
launchReapedChromeScoped,
|
|
19
|
+
reserveChromiumAdmission,
|
|
20
|
+
type ChromiumLaunchAdmission,
|
|
21
|
+
} from '../src/reap-browser'
|
|
34
22
|
import { usesDirectLookup } from '../src/target-matcher'
|
|
35
23
|
import {
|
|
36
24
|
createExpect,
|
|
@@ -40,6 +28,7 @@ import {
|
|
|
40
28
|
isTextInputNodeFocused,
|
|
41
29
|
isNodeVisible,
|
|
42
30
|
} from './expectations'
|
|
31
|
+
import { REQUIRED_IDENTICAL_PROOF_FRAMES, framesIdentical } from './frame-identity.cjs'
|
|
43
32
|
import { frameTimingRoundingBound } from './frame-offset.mjs'
|
|
44
33
|
import {
|
|
45
34
|
dispatchTwoFingerGesture,
|
|
@@ -52,21 +41,27 @@ import {
|
|
|
52
41
|
waitForSootsimGestureHandler,
|
|
53
42
|
} from './gestures'
|
|
54
43
|
import { by, type Matcher } from './matchers'
|
|
44
|
+
import { describeSootsimBridgeFailure, navigateSootsimPage } from './navigation-lifecycle'
|
|
55
45
|
import {
|
|
56
|
-
|
|
57
|
-
|
|
46
|
+
requireProofObserver,
|
|
47
|
+
type ClassifyDiscreteFrame,
|
|
48
|
+
type DiscreteFrameCadence,
|
|
58
49
|
type DiscreteFrameObservation,
|
|
59
50
|
type DiscreteFrameTrace,
|
|
51
|
+
type DiscreteProofBinding,
|
|
52
|
+
type MotionChangeDefinition,
|
|
60
53
|
type MotionChangeMeasurement,
|
|
61
|
-
} from './
|
|
62
|
-
import { describeSootsimBridgeFailure, navigateSootsimPage } from './navigation-lifecycle'
|
|
63
|
-
import { REQUIRED_IDENTICAL_PROOF_FRAMES, framesIdentical } from './proof-frame.cjs'
|
|
54
|
+
} from './proof-observer'
|
|
64
55
|
import type {
|
|
65
56
|
SootSimInteractBridge,
|
|
66
57
|
SootSimNodeInfo,
|
|
67
58
|
} from '../../peach-globals/src/index'
|
|
68
|
-
import type { DiscreteProofContext } from './attempt-events.cjs'
|
|
69
59
|
import type { SootSimElement } from './element-types'
|
|
60
|
+
import type {
|
|
61
|
+
LockstepInputReceipt,
|
|
62
|
+
LockstepScheduledInput,
|
|
63
|
+
SootSimLockstepFrameReceipt,
|
|
64
|
+
} from '@peach/globals'
|
|
70
65
|
import type { Browser, BrowserContext, Page } from 'playwright-core'
|
|
71
66
|
|
|
72
67
|
const WORKLET_FRAME_TRACE_LIMIT = 16384
|
|
@@ -98,12 +93,13 @@ declare global {
|
|
|
98
93
|
var __peachDetoxCleanup: (() => Promise<void>) | undefined
|
|
99
94
|
interface Window {
|
|
100
95
|
__sootsimVisibleChangeCaptures?: Record<string, VisibleChangeCaptureState>
|
|
101
|
-
__peachClassifyDiscreteFrame?:
|
|
96
|
+
__peachClassifyDiscreteFrame?: ClassifyDiscreteFrame
|
|
102
97
|
__peachDiscreteObserver?: DiscreteObserverState
|
|
103
98
|
}
|
|
104
99
|
}
|
|
105
100
|
|
|
106
101
|
export { by }
|
|
102
|
+
export { registerProofObserver, type ProofObserver } from './proof-observer'
|
|
107
103
|
export type { SootSimElement } from './element-types'
|
|
108
104
|
|
|
109
105
|
declare global {
|
|
@@ -2287,7 +2283,7 @@ export const device = {
|
|
|
2287
2283
|
cadence: DiscreteFrameCadence,
|
|
2288
2284
|
probeRect: { x: number; y: number; width: number; height: number },
|
|
2289
2285
|
rootRect: { x: number; y: number; width: number; height: number },
|
|
2290
|
-
binding:
|
|
2286
|
+
binding: DiscreteProofBinding,
|
|
2291
2287
|
stages: readonly { label: string; offsetMs: number }[] = [],
|
|
2292
2288
|
) {
|
|
2293
2289
|
if (!binding || !binding.captureNonce || !binding.attemptNonce)
|
|
@@ -2299,7 +2295,9 @@ export const device = {
|
|
|
2299
2295
|
)
|
|
2300
2296
|
throw new Error('peach discrete observer geometry differs from its issued capture')
|
|
2301
2297
|
const page = getPage()
|
|
2302
|
-
await page.evaluate(classifyDiscreteFrame, {
|
|
2298
|
+
await page.evaluate(requireProofObserver().classifyDiscreteFrame, {
|
|
2299
|
+
installGlobal: true,
|
|
2300
|
+
})
|
|
2303
2301
|
await page.evaluate(
|
|
2304
2302
|
async ({ cadence, probeRect, rootRect, binding, stages }) => {
|
|
2305
2303
|
type Bridges = {
|
|
@@ -2549,7 +2547,7 @@ export const device = {
|
|
|
2549
2547
|
namePrefix: string,
|
|
2550
2548
|
stages: Array<{ label: string; offsetMs: number }>,
|
|
2551
2549
|
options: {
|
|
2552
|
-
binding:
|
|
2550
|
+
binding: DiscreteProofBinding
|
|
2553
2551
|
cadence: DiscreteFrameCadence
|
|
2554
2552
|
probeRect: { x: number; y: number; width: number; height: number }
|
|
2555
2553
|
rootRect: { x: number; y: number; width: number; height: number }
|
|
@@ -2712,8 +2710,9 @@ export const device = {
|
|
|
2712
2710
|
if (!Number.isFinite(settleMs) || settleMs < 0) {
|
|
2713
2711
|
throw new Error('peach motion capture needs a non-negative settleMs')
|
|
2714
2712
|
}
|
|
2715
|
-
|
|
2716
|
-
|
|
2713
|
+
const proofObserver = requireProofObserver()
|
|
2714
|
+
await page.evaluate(proofObserver.measureMotionChange, {
|
|
2715
|
+
definition: proofObserver.motionChangeDefinition,
|
|
2717
2716
|
installGlobal: true,
|
|
2718
2717
|
})
|
|
2719
2718
|
if (options.workletFrameTracePath) {
|
|
@@ -3204,9 +3203,16 @@ export const device = {
|
|
|
3204
3203
|
].sort((a, b) => a - b)
|
|
3205
3204
|
: []
|
|
3206
3205
|
// transition stages take the native touch rule from the touches this
|
|
3207
|
-
// lane delivered, stepping until the last one due has landed.
|
|
3206
|
+
// lane delivered, stepping until the last one due has landed. a
|
|
3207
|
+
// release anchor already sits on the delivered up, so its offsets
|
|
3208
|
+
// are up-relative and the press-relative schedule does not apply.
|
|
3208
3209
|
const stageOffsetMs = async (offsetMs: number, anchorId: string) => {
|
|
3209
|
-
if (
|
|
3210
|
+
if (
|
|
3211
|
+
anchorId !== 'transition' ||
|
|
3212
|
+
input.witnessedDrag ||
|
|
3213
|
+
input.anchorAtTouch === 'up'
|
|
3214
|
+
)
|
|
3215
|
+
return offsetMs
|
|
3210
3216
|
const due = holdScheduleMs.filter((scheduledMs) => scheduledMs <= offsetMs)
|
|
3211
3217
|
while (controller.inputReceipts.length < due.length) {
|
|
3212
3218
|
if (state.cancelled) throw new Error('peach motion capture was cancelled')
|
|
@@ -3330,7 +3336,7 @@ export const device = {
|
|
|
3330
3336
|
anchorAtTouch: options.anchorAtTouch ?? null,
|
|
3331
3337
|
witnessedDrag: options.witnessedDrag === true,
|
|
3332
3338
|
hold: options.hold ?? null,
|
|
3333
|
-
motionChangeDefinition:
|
|
3339
|
+
motionChangeDefinition: proofObserver.motionChangeDefinition,
|
|
3334
3340
|
platform: device.getPlatform(),
|
|
3335
3341
|
rootFrame: options.rootFrame ?? null,
|
|
3336
3342
|
settleMs,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
const { TestEnvironment } = require('jest-environment-node')
|
|
2
|
-
const
|
|
2
|
+
const path = require('path')
|
|
3
|
+
const { reserveChromiumAdmission } = require(
|
|
4
|
+
path.join(path.dirname(require.resolve('peachsim/package.json')), 'dist-lib', 'reap-browser.cjs'),
|
|
5
|
+
)
|
|
3
6
|
|
|
4
7
|
// jest's environment setup precedes all hook and test deadlines. reserve one
|
|
5
8
|
// slot for this file, including sequential terminateApp/launchApp pairs, so a
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
// force-reaps its tree. registering it here means no suite has to remember an
|
|
12
12
|
// afterAll of its own.
|
|
13
13
|
|
|
14
|
-
// records which test bodies actually ran, so a downstream reader can tell a
|
|
15
|
-
// setup failure from a behavior failure. no-op unless the run asks for it.
|
|
16
|
-
require('./record-block-execution.cjs')
|
|
17
|
-
|
|
18
14
|
const { cleanup } = require('peachsim/detox')
|
|
19
15
|
globalThis.__peachDetoxCleanup = cleanup
|
|
20
16
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readPeachConfigFromSearchParams } from '../src/config'
|
|
2
|
-
import {
|
|
2
|
+
import { recordAttemptEvent } from './proof-observer'
|
|
3
3
|
import type { Page, Request, Response } from 'playwright-core'
|
|
4
4
|
|
|
5
5
|
export type SootsimNavigationIdentity = {
|
|
@@ -101,7 +101,7 @@ const persistedDiagnostics = new WeakSet<PageDiagnostic>()
|
|
|
101
101
|
function persistDiagnostic(diagnostic: PageDiagnostic) {
|
|
102
102
|
if (persistedDiagnostics.has(diagnostic)) return
|
|
103
103
|
persistedDiagnostics.add(diagnostic)
|
|
104
|
-
|
|
104
|
+
recordAttemptEvent(diagnostic)
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// a run that dies at the launch marker never reaches the failure message that
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// the one hook a proof harness registers with the driver. the driver knows how
|
|
2
|
+
// to park clocks, step frames and capture them; what counts as a changed frame,
|
|
3
|
+
// how a discrete frame is classified, and where attempt events are recorded
|
|
4
|
+
// belong to whoever grades the capture, so they arrive through this observer.
|
|
5
|
+
|
|
6
|
+
export type MotionChangeDefinition = {
|
|
7
|
+
channelThreshold: number
|
|
8
|
+
minimumChangePercent: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type MotionChangeMeasurement = {
|
|
12
|
+
changePercent: number
|
|
13
|
+
changePixels: number
|
|
14
|
+
passedMinimum: boolean
|
|
15
|
+
totalPixels: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type MotionChangeInput = {
|
|
19
|
+
baseline?: ArrayLike<number>
|
|
20
|
+
candidate?: ArrayLike<number>
|
|
21
|
+
changePixels?: number
|
|
22
|
+
definition: MotionChangeDefinition
|
|
23
|
+
height?: number
|
|
24
|
+
installGlobal?: boolean
|
|
25
|
+
label?: string
|
|
26
|
+
totalPixels?: number
|
|
27
|
+
width?: number
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type DiscreteFrameAsset = {
|
|
31
|
+
frames: readonly {
|
|
32
|
+
durationMs: number
|
|
33
|
+
uniformRgba: readonly [number, number, number, number]
|
|
34
|
+
}[]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type DiscreteFrameCadence = {
|
|
38
|
+
kind: 'discrete-frame'
|
|
39
|
+
asset: DiscreteFrameAsset
|
|
40
|
+
probe: { elementName: string; inset: number }
|
|
41
|
+
} & (
|
|
42
|
+
| { mode: 'playing'; entryFrame: number; minimumTransitions: 2 }
|
|
43
|
+
| { mode: 'frozen'; waitIntervalsMs: readonly number[]; captures: readonly string[] }
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
export type DiscreteFrameObservation = {
|
|
47
|
+
frameIndex: number
|
|
48
|
+
atMs: number
|
|
49
|
+
phase: number | null
|
|
50
|
+
mismatchPixels: number[]
|
|
51
|
+
totalPixels: number
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type DiscreteFrameBinding = {
|
|
55
|
+
attemptNonce: string
|
|
56
|
+
captureNonce: string
|
|
57
|
+
sourceFingerprint: string
|
|
58
|
+
proofSourceFingerprint: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export type DiscreteFrameTrace = {
|
|
62
|
+
cost?: {
|
|
63
|
+
wallMs: number
|
|
64
|
+
observedFrames: number
|
|
65
|
+
totalProbeBytes: number
|
|
66
|
+
maximumProbeBytes: number
|
|
67
|
+
requestedPngs: number
|
|
68
|
+
}
|
|
69
|
+
binding?: DiscreteFrameBinding
|
|
70
|
+
triggerStartedAtMs?: number
|
|
71
|
+
triggerCompletedAtMs?: number
|
|
72
|
+
completedAtMs?: number
|
|
73
|
+
cadence: DiscreteFrameCadence
|
|
74
|
+
observations: DiscreteFrameObservation[]
|
|
75
|
+
clock: 'native-presentation' | 'peach-virtual'
|
|
76
|
+
coverageStartMs: number
|
|
77
|
+
coverageEndMs: number
|
|
78
|
+
triggerMs: number
|
|
79
|
+
windowMs: number
|
|
80
|
+
mediaDurationMs?: number
|
|
81
|
+
waitIntervals?: { startMs: number; endMs: number }[]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type ProofRect = { x: number; y: number; width: number; height: number }
|
|
85
|
+
|
|
86
|
+
// the issued capture a discrete observation answers to
|
|
87
|
+
export type DiscreteProofBinding = DiscreteFrameBinding & {
|
|
88
|
+
clock: 'native-presentation' | 'peach-virtual'
|
|
89
|
+
probeRect: ProofRect
|
|
90
|
+
rootRect: ProofRect
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type ClassifyDiscreteFrame = (input: {
|
|
94
|
+
pixels?: ArrayLike<number>
|
|
95
|
+
frames?: DiscreteFrameAsset['frames']
|
|
96
|
+
installGlobal?: boolean
|
|
97
|
+
}) => Pick<DiscreteFrameObservation, 'phase' | 'mismatchPixels' | 'totalPixels'> | null
|
|
98
|
+
|
|
99
|
+
export type MeasureMotionChange = (
|
|
100
|
+
input: MotionChangeInput,
|
|
101
|
+
) => MotionChangeMeasurement | null
|
|
102
|
+
|
|
103
|
+
export interface ProofObserver {
|
|
104
|
+
motionChangeDefinition: Readonly<MotionChangeDefinition>
|
|
105
|
+
// both run inside the page, so each must be self-contained
|
|
106
|
+
measureMotionChange: MeasureMotionChange
|
|
107
|
+
classifyDiscreteFrame: ClassifyDiscreteFrame
|
|
108
|
+
attemptEvent(event: unknown): void
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let observer: ProofObserver | null = null
|
|
112
|
+
|
|
113
|
+
export function registerProofObserver(next: ProofObserver) {
|
|
114
|
+
observer = next
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export function recordAttemptEvent(event: unknown) {
|
|
118
|
+
observer?.attemptEvent(event)
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function requireProofObserver(): ProofObserver {
|
|
122
|
+
if (!observer) {
|
|
123
|
+
throw new Error('peach proof capture needs a registered proof observer')
|
|
124
|
+
}
|
|
125
|
+
return observer
|
|
126
|
+
}
|