ReviewOS

also looking at this

craft-native/craft

test(mobile-e2e): prove iOS location settles, and that Zig served it

#213
Merged glennmichael123 wants to merge fix/ios-location-settles into main
6 files +157 -28
scripts/mobile-e2e/protocol.tsmodified+29-2
Changes to scripts/mobile-e2e/protocol.ts
@@ -78,7 +78,8 @@ export const REQUIRED_CASES: Record<MobilePlatform, string[]> = {
7878 'bridge.ready',
7979 'deviceInfo.isSimulator',
8080 'clipboard.roundTrip',
81 'geolocation.disabled.rejects',
81 'permissions.location.granted',
82 'geolocation.currentPosition',
8283 'share.disabled.rejects',
8384 ],
8485 android: [
@@ -400,19 +401,45 @@ export function zigRefusals(text: string): string[] {
400401 * reducing what the assertion covers.
401402 */
402403export const ZIG_TESTED_ACTIONS = [
404 'checkPermission',
403405 'clipboardRead',
404406 'clipboardWrite',
405407 'getCurrentPosition',
406408 'getDeviceInfo',
409 'requestPermission',
407410 'share',
408411]
409412
413/**
414 * The tested actions Zig must answer itself rather than hand back to Swift.
415 *
416 * Everything in ZIG_TESTED_ACTIONS except `requestPermission`, which Zig
417 * deliberately leaves to Swift for location (`bridge_mobile_permissions.zig`
418 * explains why: the answer arrives through the app's own
419 * `CLLocationManagerDelegate`).
420 */
421export const ZIG_SERVED_ACTIONS = ZIG_TESTED_ACTIONS.filter(action => action !== 'requestPermission')
422
410423/** The actions the suite configures off, so Zig must refuse each by name. */
411424export const ZIG_REFUSED_ACTIONS = [
412 'getCurrentPosition',
413425 'share',
414426]
415427
428/**
429 * The actions Zig was offered and handed back to the Swift host.
430 *
431 * Swift answers those with the same shapes, so the page cannot tell, and a
432 * dispatch line is logged whether or not Zig then serves the call. This is
433 * the line that says it did not.
434 */
435export function zigHandBacks(text: string): string[] {
436 const plain = text.replace(ANSI, '')
437 const seen = new Set<string>()
438 for (const match of plain.matchAll(/ios: (\w+) (?:is not served here; handing it back|is declared unavailable; leaving it) to the host/g))
439 seen.add(match[1]!)
440 return [...seen].sort()
441}
442
416443/**
417444 * The three ways an Android native says it gave up, as `android_dispatch.zig`
418445 * writes them.