mobile-debug-mcp 0.21.5 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +74 -0
- package/README.md +24 -5
- package/dist/interact/index.js +220 -13
- package/dist/observe/ios.js +10 -3
- package/dist/server-core.js +707 -0
- package/dist/server.js +6 -693
- package/dist/utils/resolve-device.js +15 -3
- package/docs/CHANGELOG.md +6 -1
- package/docs/tools/interact.md +69 -30
- package/package.json +3 -3
- package/skills/README.md +35 -0
- package/skills/test-authoring/SKILL.md +57 -0
- package/skills/test-authoring/references/repo-test-layout.md +47 -0
- package/skills/test-authoring/references/test-authoring-workflow.md +73 -0
- package/skills/test-authoring/references/test-quality-checklist.md +39 -0
- package/src/interact/index.ts +250 -13
- package/src/observe/ios.ts +12 -3
- package/src/server-core.ts +762 -0
- package/src/server.ts +8 -754
- package/src/types.ts +10 -1
- package/src/utils/resolve-device.ts +19 -3
- package/test/device/automated/observe/capture_screenshot.android.smoke.ts +30 -0
- package/test/device/automated/observe/capture_screenshot.ios.smoke.ts +30 -0
- package/test/{observe/device → device/automated/observe}/get_logs.android.smoke.ts +1 -1
- package/test/{observe/device → device/automated/observe}/get_logs.ios.smoke.ts +1 -1
- package/test/device/automated/observe/get_ui_tree.android.smoke.ts +31 -0
- package/test/device/automated/observe/get_ui_tree.ios.smoke.ts +31 -0
- package/test/device/index.ts +52 -0
- package/test/{interact/device/smoke-test.ts → device/manual/interact/app_lifecycle.manual.ts} +5 -5
- package/test/{manage/device/run-build-install-ios.ts → device/manual/manage/build_install_ios.manual.ts} +1 -1
- package/test/{manage/device → device/manual/manage}/install.integration.ts +6 -6
- package/test/{manage/device/run-install-android.ts → device/manual/manage/install_android.manual.ts} +1 -1
- package/test/{manage/device/run-install-ios.ts → device/manual/manage/install_ios.manual.ts} +1 -1
- package/test/device/manual/observe/capture_screenshot.manual.ts +29 -0
- package/test/{helpers/run-get-logs.ts → device/manual/observe/get_logs.manual.ts} +1 -1
- package/test/device/manual/observe/get_ui_tree.manual.ts +29 -0
- package/test/{observe/device/logstream-real.ts → device/manual/observe/logstream.manual.ts} +1 -1
- package/test/{observe/device/run-screen-fingerprint.ts → device/manual/observe/screen_fingerprint.manual.ts} +1 -1
- package/test/{observe/device/run-scroll-test-android.ts → device/manual/observe/scroll_to_element_android.manual.ts} +1 -1
- package/test/{observe/device/test-ui-tree.ts → device/manual/observe/ui_tree.manual.ts} +6 -6
- package/test/unit/index.ts +47 -27
- package/test/unit/interact/handler_shapes.test.ts +55 -0
- package/test/unit/interact/tap_element.test.ts +170 -0
- package/test/unit/interact/wait_for_screen_change.test.ts +34 -0
- package/test/{interact/unit → unit/interact}/wait_for_ui_contract.test.ts +11 -10
- package/test/unit/interact/wait_for_ui_selector_matching.test.ts +76 -0
- package/test/unit/manage/handler_shapes.test.ts +43 -0
- package/test/{observe/unit → unit/observe}/capture_debug_snapshot.test.ts +5 -1
- package/test/{observe/unit → unit/observe}/find_element.test.ts +12 -6
- package/test/unit/observe/get_screen_fingerprint.test.ts +71 -0
- package/test/unit/observe/ios-getlogs.test.ts +53 -0
- package/test/unit/observe/scroll_to_element.test.ts +127 -0
- package/test/unit/server/contract.test.ts +45 -0
- package/test/unit/server/response_shapes.test.ts +93 -0
- package/test/unit/system/adb_version.test.ts +35 -0
- package/test/unit/system/get_system_status.test.ts +20 -0
- package/test/unit/system/system_status.test.ts +141 -0
- package/test/{utils → unit/utils}/detect_java.test.ts +1 -1
- package/test/unit/utils/exec.test.ts +51 -0
- package/test/unit/utils/resolve_device.test.ts +63 -0
- package/tsconfig.json +2 -2
- package/test/interact/device/run-real-test.ts +0 -3
- package/test/interact/unit/wait_for_screen_change.test.ts +0 -32
- package/test/interact/unit/wait_for_ui.test.ts +0 -76
- package/test/interact/unit/wait_for_ui_new.test.ts +0 -57
- package/test/observe/device/wait_for_element_real.ts +0 -3
- package/test/observe/unit/get_screen_fingerprint.test.ts +0 -69
- package/test/observe/unit/ios-getlogs.test.ts +0 -67
- package/test/observe/unit/scroll_to_element.test.ts +0 -129
- package/test/observe/unit/wait_for_element_mock.ts +0 -2
- package/test/observe/unit/wait_for_ui_edge_cases.test.ts +0 -41
- package/test/observe/unit/wait_for_ui_stability.test.ts +0 -30
- package/test/system/adb_version.test.ts +0 -25
- package/test/system/get_system_status.test.ts +0 -52
- package/test/system/system_status.test.ts +0 -109
- /package/test/{manage/unit → unit/manage}/build.test.ts +0 -0
- /package/test/{manage/unit → unit/manage}/build_and_install.test.ts +0 -0
- /package/test/{manage/unit → unit/manage}/detection.test.ts +0 -0
- /package/test/{manage/unit → unit/manage}/diagnostics.test.ts +0 -0
- /package/test/{manage/unit → unit/manage}/install.test.ts +0 -0
- /package/test/{manage/unit → unit/manage}/mcp_disable_autodetect.test.ts +0 -0
- /package/test/{observe/unit → unit/observe}/get_logs.test.ts +0 -0
- /package/test/{observe/unit → unit/observe}/logparse.test.ts +0 -0
- /package/test/{observe/unit → unit/observe}/logstream.test.ts +0 -0
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import assert from 'assert'
|
|
2
|
-
import child_process from 'child_process'
|
|
3
|
-
|
|
4
|
-
import * as androidUtils from '../../src/utils/android/utils.js'
|
|
5
|
-
import * as iosUtils from '../../src/utils/ios/utils.js'
|
|
6
|
-
import * as systemStatus from '../../src/system/index.js'
|
|
7
|
-
|
|
8
|
-
const origExecSync = child_process.execSync
|
|
9
|
-
const origEnsure = (androidUtils as any).ensureAdbAvailable
|
|
10
|
-
const origGetXcrun = (iosUtils as any).getXcrunCmd
|
|
11
|
-
|
|
12
|
-
function mockExec(behaviour: (cmd: string) => string) {
|
|
13
|
-
(child_process as any).execSync = (cmd: string) => {
|
|
14
|
-
const s = typeof cmd === 'string' ? cmd : (Array.isArray(cmd) ? cmd.join(' ') : String(cmd))
|
|
15
|
-
const out = behaviour(s)
|
|
16
|
-
if (out instanceof Error) throw out
|
|
17
|
-
return out
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function restoreExec() {
|
|
22
|
-
(child_process as any).execSync = origExecSync
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function mockEnsure(returnVal: any) {
|
|
26
|
-
(androidUtils as any).ensureAdbAvailable = () => returnVal
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function restoreEnsure() {
|
|
30
|
-
(androidUtils as any).ensureAdbAvailable = origEnsure
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function mockGetXcrun(val: string) {
|
|
34
|
-
(iosUtils as any).getXcrunCmd = () => val
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function restoreGetXcrun() {
|
|
38
|
-
(iosUtils as any).getXcrunCmd = origGetXcrun
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
describe('system_status checks', () => {
|
|
42
|
-
afterEach(() => {
|
|
43
|
-
restoreExec(); restoreEnsure(); restoreGetXcrun()
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('reports healthy system when adb and xcrun present', async () => {
|
|
47
|
-
mockEnsure({ adbCmd: 'adb', ok: true, version: '8.1.0' })
|
|
48
|
-
mockGetXcrun('xcrun')
|
|
49
|
-
|
|
50
|
-
mockExec((cmd) => {
|
|
51
|
-
if (cmd.startsWith('adb devices')) return 'List of devices attached\nemulator-5554\tdevice'
|
|
52
|
-
if (cmd.includes('adb logcat')) return 'I/Tag: ok'
|
|
53
|
-
if (cmd.includes('adb shell pm path')) return 'package:/data/app/com.example-1/base.apk'
|
|
54
|
-
if (cmd.startsWith('xcrun --version')) return 'xcrun version 123'
|
|
55
|
-
if (cmd.includes('simctl list devices booted --json')) return JSON.stringify({ devices: {} })
|
|
56
|
-
return ''
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
const res = await systemStatus.getSystemStatus()
|
|
60
|
-
assert.strictEqual(res.success, true)
|
|
61
|
-
assert.strictEqual(res.adbAvailable, true)
|
|
62
|
-
assert.strictEqual(typeof res.adbVersion, 'string')
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('reports adb missing', async () => {
|
|
66
|
-
mockEnsure({ adbCmd: 'adb', ok: false, error: 'not found' })
|
|
67
|
-
mockGetXcrun('xcrun')
|
|
68
|
-
mockExec((cmd) => {
|
|
69
|
-
if (cmd.startsWith('xcrun --version')) return 'xcrun version'
|
|
70
|
-
return ''
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
const res = await systemStatus.getSystemStatus()
|
|
74
|
-
assert.strictEqual(res.success, false)
|
|
75
|
-
assert(res.issues.some((i: string) => i.includes('ADB')))
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it('detects unauthorized/offline devices', async () => {
|
|
79
|
-
mockEnsure({ adbCmd: 'adb', ok: true, version: '8.1.0' })
|
|
80
|
-
mockGetXcrun('xcrun')
|
|
81
|
-
mockExec((cmd) => {
|
|
82
|
-
if (cmd.startsWith('adb devices')) return 'List of devices attached\nserial1\tunauthorized\nserial2\toffline\n'
|
|
83
|
-
if (cmd.startsWith('xcrun --version')) return 'xcrun version'
|
|
84
|
-
return ''
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
const res = await systemStatus.getSystemStatus()
|
|
88
|
-
assert.strictEqual(res.success, false)
|
|
89
|
-
assert(res.issues.some((i: string) => i.includes('unauthorized')))
|
|
90
|
-
assert(res.issues.some((i: string) => i.includes('offline')))
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('handles missing xcrun gracefully', async () => {
|
|
94
|
-
mockEnsure({ adbCmd: 'adb', ok: true, version: '8.1.0' })
|
|
95
|
-
mockGetXcrun('xcrun')
|
|
96
|
-
mockExec((cmd) => {
|
|
97
|
-
if (cmd.startsWith('adb devices')) return 'List of devices attached\nemulator-5554\tdevice'
|
|
98
|
-
if (cmd.startsWith('xcrun --version')) throw new Error('not found')
|
|
99
|
-
return ''
|
|
100
|
-
})
|
|
101
|
-
|
|
102
|
-
const res = await systemStatus.getSystemStatus()
|
|
103
|
-
// Expect iOS check to be false and Android to be healthy
|
|
104
|
-
assert.strictEqual(res.iosAvailable, false)
|
|
105
|
-
assert.strictEqual(res.adbAvailable, true)
|
|
106
|
-
// overall success may still be true (Android ok) but issues should include an xcrun-related message
|
|
107
|
-
assert(res.issues.some((i: string) => i.toLowerCase().includes('xcrun') || i.toLowerCase().includes('ios')))
|
|
108
|
-
})
|
|
109
|
-
})
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|