also looking at this
fix(ios): schedule a notification with the data the page gave it
#262
8 files
+242
-22
| @@ -3,7 +3,7 @@ import type { LegOutcome, RunnerOptions } from './types' | ||
| 3 | 3 | import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs' |
| 4 | 4 | import { join } from 'node:path' |
| 5 | 5 | import { bootSimulator, init, pickSimulator } from '../../packages/ios/src/index' |
| 6 | import { deepLinkProblems, deepLinkResults, evaluateRun, hasTerminated, notificationBody, notificationPayload, notificationReceiptProblems, notificationReceiptReport, notificationTapProblems, notificationTapReport, ZIG_REFUSED_ACTIONS, ZIG_SERVED_ACTIONS, ZIG_TESTED_ACTIONS, zigDispatchedActions, zigHandBacks, zigRefusals } from './protocol' | |
| 6 | import { deepLinkProblems, deepLinkResults, evaluateRun, hasTerminated, localNotificationProblems, notificationBody, notificationPayload, notificationReceiptProblems, notificationReceiptReport, notificationTapProblems, notificationTapReport, ZIG_REFUSED_ACTIONS, ZIG_SERVED_ACTIONS, ZIG_TESTED_ACTIONS, zigDispatchedActions, zigHandBacks, zigRefusals } from './protocol' | |
| 7 | 7 | import { command, driverPage, waitForFile } from './support' |
| 8 | 8 | |
| 9 | 9 | /** The scheme the probe registers, and the one its cold-start link uses. */ |
| @@ -38,6 +38,9 @@ const CONFIG = { | ||
| 38 | 38 | enableSpeechRecognition: false, |
| 39 | 39 | // For the cold-start link (#198), which the harness opens from an XCUITest. |
| 40 | 40 | enableDeepLinks: true, |
| 41 | // For the notification the page schedules with data (#258), served by | |
| 42 | // Swift on the shim leg and by Zig on the runtime leg. | |
| 43 | enableLocalNotifications: true, | |
| 41 | 44 | urlSchemes: [DEEP_LINK_SCHEME], |
| 42 | 45 | } |
| 43 | 46 | |
| @@ -68,8 +71,8 @@ const UI_TEST_CLASSES = ['DeepLinkColdStartTests', 'NotificationTapColdStartTest | ||
| 68 | 71 | |
| 69 | 72 | /** |
| 70 | 73 | * How long the notification UI test gets in all. It starts a test runner, |
| 71 | * launches the app twice and answers a permission prompt; it usually takes | |
| 72 | * under half a minute. | |
| 74 | * launches the app four times, answers a permission prompt and waits out a | |
| 75 | * scheduled notification; it usually takes about a minute. | |
| 73 | 76 | */ |
| 74 | 77 | const NOTIFICATION_TEST_TIMEOUT_MS = 300_000 |
| 75 | 78 | |
| @@ -340,6 +343,8 @@ schemes: | ||
| 340 | 343 | TEST_RUNNER_PROBE_BUNDLE_ID: BUNDLE_ID, |
| 341 | 344 | TEST_RUNNER_PROBE_NOTIFY_LINK: `${DEEP_LINK_SCHEME}://e2e/notify?run=${encodeURIComponent(nonce)}`, |
| 342 | 345 | TEST_RUNNER_PROBE_PUSH_BODY: notificationBody(nonce, 'cold'), |
| 346 | TEST_RUNNER_PROBE_LOCAL_LINK: `${DEEP_LINK_SCHEME}://e2e/local?run=${encodeURIComponent(nonce)}`, | |
| 347 | TEST_RUNNER_PROBE_LOCAL_BODY: notificationBody(nonce, 'local'), | |
| 343 | 348 | }, |
| 344 | 349 | stdin: 'ignore', |
| 345 | 350 | stdout: Bun.file(notificationLog), |
| @@ -368,10 +373,13 @@ schemes: | ||
| 368 | 373 | } |
| 369 | 374 | else { |
| 370 | 375 | failures.push(...notificationTapProblems(notificationTapReport(notificationOutput), nonce, notificationEvidence)) |
| 371 | if (!pushed.includes('foreground')) | |
| 376 | if (!pushed.includes('foreground')) { | |
| 372 | 377 | failures.push(`the notification UI test never got to the push that arrives while the app is open; see ${notificationEvidence}`) |
| 373 | else | |
| 378 | } | |
| 379 | else { | |
| 374 | 380 | failures.push(...notificationReceiptProblems(notificationReceiptReport(notificationOutput), nonce, notificationEvidence)) |
| 381 | failures.push(...localNotificationProblems(notificationTapReport(notificationOutput, 'CRAFT-E2E-LOCAL-RESULT'), nonce, notificationEvidence)) | |
| 382 | } | |
| 375 | 383 | } |
| 376 | 384 | |
| 377 | 385 | const dispatched = zigDispatchedActions(consoleText) |