Skip to content

[SDK-115] Re-enable BCIT embedded message test#1064

Open
franco-zalamena-iterable wants to merge 1 commit into
SDK-115-bcit-cifrom
SDK-115-followup-embedded-test
Open

[SDK-115] Re-enable BCIT embedded message test#1064
franco-zalamena-iterable wants to merge 1 commit into
SDK-115-bcit-cifrom
SDK-115-followup-embedded-test

Conversation

@franco-zalamena-iterable

@franco-zalamena-iterable franco-zalamena-iterable commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes the @Ignore on EmbeddedMessageIntegrationTest#testEmbeddedMessageMVP after fixing two real bugs against the BCIT backend. Builds on the dated-user infrastructure already merged into the base branch (SDK-115-bcit-ci).

Two bugs, both surfaced by comparing against iOS

  1. Wrong eligibility field. The BCIT campaign's audience predicate is on membershipLevel == "premium", not isPremium == true. Android was sending isPremium, so the audience never matched and /api/embedded-messaging/messages returned placements: []. iOS sends membershipLevel: "premium" / "standard" (EmbeddedMessageTestViewModel.swift:90); we now do the same in both the test and the on-screen toggle.
  2. (Already on base via #1061: IterableConfig.allowedProtocols = ["tester", "https", "http"] so the SDK doesn't drop the tester://testview URL fired by the embedded deeplink button.)

Scope of this PR

Three files, +28 / -36:

  • EmbeddedMessageIntegrationTest.kt@Ignore removed; the eligibility-transition step now sends membershipLevel (standardpremium) instead of isPremium (falsetrue).
  • EmbeddedMessageTestActivity.kt — on-screen toggle and dialog rebranded "Membership Level" so the manual flow matches the test.
  • activity_embedded_message_test.xml — button + label text updated.

The isPremiumSwitch field name is unchanged on purpose, to keep the diff minimal.

Local verification

CI mode, dated user, full non-push suite:

./gradlew :integration-tests:connectedDebugAndroidTest \
  -Pandroid.testInstrumentationRunnerArguments.package=com.iterable.integration.tests \
  -Pandroid.testInstrumentationRunnerArguments.notClass=com.iterable.integration.tests.PushNotificationIntegrationTest \
  -Pandroid.testInstrumentationRunnerArguments.ci=true

Tests 7/7 completed. (0 skipped) (0 failed) — BUILD SUCCESSFUL.

Test plan

  • CI's Integration Tests (BCIT) job is green.
  • Manual sanity (optional): launch the app, paste today's dated email into the override card on MainActivity, open Embedded Message Test, toggle Premium Member on, tap Sync — placement 2157 appears and renders.

franco-zalamena-iterable added a commit that referenced this pull request Jun 2, 2026
CI run on PR #1064 surfaced four failures that all share the same root
cause: the Pixel Launcher ANRs on Ubuntu+KVM during heavy parallel work
and steals focus from the activity-under-test, so findObject().exists()
returns false even though the view is in the tree (logcat shows
`current package: android` instead of `com.iterable.integration.tests`).

Three fixes:

1. BaseIntegrationTest.setUp now pressBack/pressHome to dismiss any
   lingering system dialog before the test runs. Universal CI-emulator
   hardening; benefits every test class that extends BaseIntegrationTest.
2. EmbeddedMessageIntegrationTest + DeepLinkIntegrationTest now use
   findObject().waitForExists(5000) instead of bare .exists().
   ActivityScenario reports RESUMED before the view tree is fully
   rendered; waitForExists handles the race. Same pattern as
   PushNotificationIntegrationTest already uses.
3. activity_main.xml is now wrapped in a ScrollView so the Test Scenario
   buttons stay reachable even when the override card grows.

Local verification: `Tests 7/7 completed. (0 skipped) (0 failed)` for
the full non-push suite with `ci=true`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
franco-zalamena-iterable added a commit that referenced this pull request Jun 2, 2026
CI run on PR #1064 surfaced four failures that all share the same root
cause: the Pixel Launcher ANRs on Ubuntu+KVM during heavy parallel work
and steals focus from the activity-under-test, so findObject().exists()
returns false even though the view is in the tree (logcat shows
`current package: android` instead of `com.iterable.integration.tests`).

Three fixes:

1. BaseIntegrationTest.setUp now pressBack/pressHome to dismiss any
   lingering system dialog before the test runs. Universal CI-emulator
   hardening; benefits every test class that extends BaseIntegrationTest.
2. EmbeddedMessageIntegrationTest + DeepLinkIntegrationTest now use
   findObject().waitForExists(5000) instead of bare .exists().
   ActivityScenario reports RESUMED before the view tree is fully
   rendered; waitForExists handles the race. Same pattern as
   PushNotificationIntegrationTest already uses.
3. activity_main.xml is now wrapped in a ScrollView so the Test Scenario
   buttons stay reachable even when the override card grows.

Local verification: `Tests 7/7 completed. (0 skipped) (0 failed)` for
the full non-push suite with `ci=true`.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…:// URLs

Two missing pieces vs the iOS BCIT embedded test:

1. The BCIT campaign's audience predicate is on `membershipLevel == "premium"`,
   not on `isPremium == true`. Android was sending the wrong field, so the
   audience never matched and /api/embedded-messaging/messages returned
   `placements: []`. iOS sends `membershipLevel: "premium" / "standard"`
   (see EmbeddedMessageTestViewModel.swift:90); this commit does the same
   from both the test and the on-screen toggle.
2. The deeplink button on placement 2157 fires `openUrl` with
   `tester://testview`. The Iterable SDK drops URLs whose scheme isn't in
   IterableConfig.allowedProtocols. iOS configures
   `["tester", "https", "http"]`; Android did not, so the SDK silently
   dropped the URL and the URL handler never fired. Add the same allowed
   protocols in BaseIntegrationTest.

Removed the @ignore on testEmbeddedMessageMVP. Renamed the
isPremium-themed toggle / labels in EmbeddedMessageTestActivity to
membership-level wording for parity.

Local verification (CI mode, dated user, full non-push suite):
  Tests 7/7 completed. (0 skipped) (0 failed)
  BUILD SUCCESSFUL

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@franco-zalamena-iterable franco-zalamena-iterable force-pushed the SDK-115-followup-embedded-test branch from 34a515e to e46e63a Compare June 2, 2026 17:24

@sumeruchat sumeruchat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving.

Non-blocking (P2): the negative step (setMembershipLevel("standard") then assert placement absent) only has the 3s + 2s sleeps as a propagation guard, while the positive step polls up to 30s. A same-UTC-day rerun where the dated user was left premium could race and see a stale placement. Poll-until-absent on the standard step (mirroring syncAndWaitForPlacement) would make it idempotent across same-day retries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants