|
1 | 1 | import assert from 'node:assert/strict'; |
2 | | -import crypto from 'node:crypto'; |
3 | | -import { promises as fs } from 'node:fs'; |
4 | | -import os from 'node:os'; |
5 | | -import path from 'node:path'; |
6 | 2 | import { beforeEach, test } from 'vitest'; |
7 | 3 | import { ANDROID_EMULATOR } from '../../../__tests__/test-utils/index.ts'; |
8 | 4 | import { buildGesturePlan } from '../../../contracts/gesture-plan.ts'; |
9 | 5 | import { |
10 | | - ensureAndroidMultiTouchHelper, |
11 | 6 | normalizeAndroidMultiTouchHelperGestureRequest, |
12 | 7 | parseAndroidMultiTouchHelperOutput, |
13 | 8 | performGestureAndroid, |
14 | 9 | resetAndroidMultiTouchHelperInstallCache, |
15 | 10 | runAndroidMultiTouchHelperGesture, |
16 | 11 | } from '../multitouch-helper.ts'; |
17 | | -import { |
18 | | - withAndroidAdbProvider, |
19 | | - type AndroidAdbExecutor, |
20 | | - type AndroidAdbProvider, |
21 | | -} from '../adb-executor.ts'; |
| 12 | +import { withAndroidAdbProvider } from '../adb-executor.ts'; |
22 | 13 | import { |
23 | 14 | ANDROID_MULTITOUCH_HELPER_MANIFEST as manifest, |
24 | 15 | androidMultiTouchResultRecord as resultRecord, |
25 | 16 | } from './multitouch-helper.fixtures.ts'; |
26 | | -import type { GesturePlan } from '../../../contracts/gesture-plan.ts'; |
27 | 17 |
|
28 | 18 | const viewport = { x: 0, y: 0, width: 400, height: 800 }; |
29 | 19 |
|
@@ -219,45 +209,3 @@ test('helper failures remain structured and actionable', async () => { |
219 | 209 | { code: 'COMMAND_FAILED', message: 'injectInputEvent returned false' }, |
220 | 210 | ); |
221 | 211 | }); |
222 | | - |
223 | | -test('helper install uses replace and test-package semantics', async () => { |
224 | | - const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'multitouch-helper-install-')); |
225 | | - const apkPath = path.join(tmpDir, 'helper.apk'); |
226 | | - await fs.writeFile(apkPath, 'helper-apk'); |
227 | | - const installCalls: unknown[] = []; |
228 | | - const adb: AndroidAdbExecutor = async (args) => { |
229 | | - if (args.includes('--show-versioncode')) { |
230 | | - return { exitCode: 1, stdout: '', stderr: 'not found' }; |
231 | | - } |
232 | | - throw new Error(`unexpected adb call: ${args.join(' ')}`); |
233 | | - }; |
234 | | - const adbProvider: AndroidAdbProvider = { |
235 | | - exec: adb, |
236 | | - install: async (installedPath, options) => { |
237 | | - installCalls.push({ installedPath, options }); |
238 | | - return { exitCode: 0, stdout: '', stderr: '' }; |
239 | | - }, |
240 | | - }; |
241 | | - const result = await ensureAndroidMultiTouchHelper({ |
242 | | - adb, |
243 | | - adbProvider, |
244 | | - artifact: { apkPath, manifest: { ...manifest, sha256: sha256Text('helper-apk') } }, |
245 | | - deviceKey: 'android:emulator-5554', |
246 | | - }); |
247 | | - assert.equal(result.reason, 'missing'); |
248 | | - assert.deepEqual(installCalls, [ |
249 | | - { |
250 | | - installedPath: apkPath, |
251 | | - options: { |
252 | | - replace: true, |
253 | | - allowTestPackages: true, |
254 | | - allowFailure: true, |
255 | | - timeoutMs: 30_000, |
256 | | - }, |
257 | | - }, |
258 | | - ]); |
259 | | -}); |
260 | | - |
261 | | -function sha256Text(text: string): string { |
262 | | - return crypto.createHash('sha256').update(text).digest('hex'); |
263 | | -} |
0 commit comments