You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SDK-115] Phase B: simulated push for the BCIT push test in CI
Phase A (the iOS-aligned wait pattern) wasn't enough on the CI runner. Two
findings from the first PR #1062 CI run:
1. CI emulators have no real Firebase config — integration-tests/google-services.json
is gitignored and the workflow falls back to the YOUR_FIREBASE_PROJECT_ID
template, so FirebaseApp fails initialization (logcat: "Default FirebaseApp
failed to initialize because no default options were found"). FCM never
issues a token, onNewToken never fires, the Phase A token-registered gate
times out after 20 s.
2. The BCIT backend itself returns `{"placements": []}` from
/api/embedded-messaging/messages for the CI user (bcituser@iterable.com)
even after updateUser({isPremium: true}). That's a campaign / user
configuration gap in the BCIT Iterable project, not a code bug, and not
something the Android SDK can fix from test code.
This commit ports the iOS BCIT push test's `xcrun simctl push` shape:
- BaseIntegrationTest gains an `isRunningInCI` flag (read from the `ci`
instrumentation argument; env vars don't reach the device-side test JVM
via `am instrument`).
- BaseIntegrationTest gains an `injectPushMessage(itblPayload, title, body,
extraData)` helper that builds a RemoteMessage locally and hands it to
IterableFirebaseMessagingService.handleMessageReceived — bypassing FCM
entirely. The Iterable SDK's own unit tests already exercise this exact
entrypoint (see IterableNotificationFlowTest.java), so it's a stable API.
- PushNotificationIntegrationTest's triggerCampaignAndWait branches: in CI,
inject a synthetic BCIT-shaped payload; locally, keep the existing
real-backend path so the BCIT account stays exercised end-to-end.
- The MVP body (open-notification-and-resume) stays in
testPushNotificationMVP. The action-button paths (Test 2 / Test 3) split
into a new @ignore'd testPushNotificationActionButtons because Android's
collapsed notification shade hides the action-button views from
UiAutomator, and a reliable expand-on-find helper is its own piece of
work. Both action-button paths work with the simulated push otherwise.
- run-e2e.sh passes `ci=true` to the instrumentation runner.
EmbeddedMessageIntegrationTest is @ignore'd with a note pointing at the
backend-side gap. The test logic is correct; the BCIT backend just isn't
returning a placement for this CI user. Re-enable once that's configured.
Local verification (CI mode, package filter, clean emulator):
$ ./gradlew :integration-tests:connectedDebugAndroidTest \
-Pandroid.testInstrumentationRunnerArguments.class=com.iterable.integration.tests.PushNotificationIntegrationTest \
-Pandroid.testInstrumentationRunnerArguments.ci=true
Pixel_3(AVD) - 9 Tests 3/2 completed. (1 skipped) (0 failed)
BUILD SUCCESSFUL
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0 commit comments