also looking at this
test(mobile-e2e): prove iOS location settles, and that Zig served it
#213
6 files
+157
-28
| @@ -78,7 +78,8 @@ export const REQUIRED_CASES: Record<MobilePlatform, string[]> = { | ||
| 78 | 78 | 'bridge.ready', |
| 79 | 79 | 'deviceInfo.isSimulator', |
| 80 | 80 | 'clipboard.roundTrip', |
| 81 | 'geolocation.disabled.rejects', | |
| 81 | 'permissions.location.granted', | |
| 82 | 'geolocation.currentPosition', | |
| 82 | 83 | 'share.disabled.rejects', |
| 83 | 84 | ], |
| 84 | 85 | android: [ |
| @@ -400,19 +401,45 @@ export function zigRefusals(text: string): string[] { | ||
| 400 | 401 | * reducing what the assertion covers. |
| 401 | 402 | */ |
| 402 | 403 | export const ZIG_TESTED_ACTIONS = [ |
| 404 | 'checkPermission', | |
| 403 | 405 | 'clipboardRead', |
| 404 | 406 | 'clipboardWrite', |
| 405 | 407 | 'getCurrentPosition', |
| 406 | 408 | 'getDeviceInfo', |
| 409 | 'requestPermission', | |
| 407 | 410 | 'share', |
| 408 | 411 | ] |
| 409 | 412 | |
| 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 | */ | |
| 421 | export const ZIG_SERVED_ACTIONS = ZIG_TESTED_ACTIONS.filter(action => action !== 'requestPermission') | |
| 422 | ||
| 410 | 423 | /** The actions the suite configures off, so Zig must refuse each by name. */ |
| 411 | 424 | export const ZIG_REFUSED_ACTIONS = [ |
| 412 | 'getCurrentPosition', | |
| 413 | 425 | 'share', |
| 414 | 426 | ] |
| 415 | 427 | |
| 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 | */ | |
| 435 | export 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 | ||
| 416 | 443 | /** |
| 417 | 444 | * The three ways an Android native says it gave up, as `android_dispatch.zig` |
| 418 | 445 | * writes them. |