Skip to content

Commit a214be4

Browse files
Fixing BCIT and in app tests in CI
1 parent d457147 commit a214be4

3 files changed

Lines changed: 570 additions & 0 deletions

File tree

integration-tests/build.gradle

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,36 @@ dependencies {
119119
androidTestImplementation 'com.google.code.gson:gson:2.8.9'
120120
}
121121

122+
// SDK-170 — debug task that surfaces the build-time BuildConfig inputs the test APK was
123+
// built with. We only print *length* and *first 4 chars* of secrets so they never appear
124+
// in CI logs verbatim. Used by scripts/trace-bcit.sh.
125+
tasks.register('printBuildConfig') {
126+
group = 'verification'
127+
description = 'Print the integration-test BuildConfig inputs as seen by the build (length-only for secrets).'
128+
doLast {
129+
def localProperties = new Properties()
130+
def localPropertiesFile = rootProject.file('local.properties')
131+
if (localPropertiesFile.exists()) {
132+
localPropertiesFile.withInputStream { localProperties.load(it) }
133+
}
134+
def showPrefix = System.getenv('TRACE_SHOW_PREFIX') == '1'
135+
def report = { String name ->
136+
def fromLocal = localProperties.getProperty(name)
137+
def fromEnv = System.getenv(name)
138+
def chosen = fromLocal ?: fromEnv ?: ''
139+
def source = fromLocal ? 'local.properties' : (fromEnv ? 'env' : 'default-fallback')
140+
def line = "${name} length=${chosen.length()} source=${source}"
141+
if (showPrefix && chosen.length() >= 4) {
142+
line += " prefix=${chosen.substring(0, 4)}\u2026"
143+
}
144+
println line
145+
}
146+
report('ITERABLE_API_KEY')
147+
report('ITERABLE_SERVER_API_KEY')
148+
report('ITERABLE_TEST_USER_EMAIL')
149+
}
150+
}
151+
122152
// Jacoco coverage for integration tests
123153
tasks.withType(Test) {
124154
jacoco.includeNoLocationClasses = true

integration-tests/src/androidTest/java/com/iterable/integration/tests/InAppMessageIntegrationTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,20 @@ class InAppMessageIntegrationTest : BaseIntegrationTest() {
5555
super.setUp()
5656

5757
Log.d(TAG, "🔧 Base setup complete, SDK initialized with test handlers")
58+
59+
// SDK-170: Pause in-app auto-display and drain the inbox BEFORE launching the
60+
// activity. Otherwise messages already staged for the test user will be fetched
61+
// by setEmail() during super.setUp() and shown over MainActivity, occluding the
62+
// buttons UiAutomator is about to look for. The test calls
63+
// inAppManager.showMessage() explicitly later, which still works while paused.
64+
// Pattern matches PushNotificationIntegrationTest / EmbeddedMessageIntegrationTest /
65+
// DeepLinkIntegrationTest.
66+
IterableApi.getInstance().inAppManager.setAutoDisplayPaused(true)
67+
IterableApi.getInstance().inAppManager.messages.forEach {
68+
Log.d(TAG, "Clearing pre-existing in-app message before navigation: ${it.messageId}")
69+
IterableApi.getInstance().inAppManager.removeMessage(it)
70+
}
71+
5872
Log.d(TAG, "🔧 MainActivity will skip initialization due to test mode flag")
5973

6074
// Now launch the app flow with custom handlers already configured

0 commit comments

Comments
 (0)