diff --git a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/OnboardingTest.kt b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/OnboardingTest.kt index 6587988bc..f6cd29151 100644 --- a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/OnboardingTest.kt +++ b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/OnboardingTest.kt @@ -26,6 +26,7 @@ import org.ooni.probe.data.models.SettingsKey import org.ooni.probe.uitesting.helpers.clickOnTag import org.ooni.probe.uitesting.helpers.clickOnText import org.ooni.probe.uitesting.helpers.dependencies +import org.ooni.probe.uitesting.helpers.isCrashReportingEnabled import org.ooni.probe.uitesting.helpers.onNodeWithContentDescription import org.ooni.probe.uitesting.helpers.onNodeWithText import org.ooni.probe.uitesting.helpers.preferences @@ -66,8 +67,10 @@ class OnboardingTest { wait { onNodeWithText(Res.string.Onboarding_AutomatedTesting_Title).isDisplayed() } clickOnTag("No-AutoTest") - wait { onNodeWithText(Res.string.Onboarding_Crash_Title).isDisplayed() } - clickOnTag("Yes-CrashReporting") + if (isCrashReportingEnabled) { + wait { onNodeWithText(Res.string.Onboarding_Crash_Title).isDisplayed() } + clickOnTag("Yes-CrashReporting") + } if (dependencies.platformInfo.needsToRequestNotificationsPermission) { wait { @@ -86,6 +89,11 @@ class OnboardingTest { false, preferences.getValueByKey(SettingsKey.AUTOMATED_TESTING_ENABLED).first(), ) - assertEquals(true, preferences.getValueByKey(SettingsKey.SEND_CRASH).first()) + if (isCrashReportingEnabled) { + assertEquals( + true, + preferences.getValueByKey(SettingsKey.SEND_CRASH).first(), + ) + } } } diff --git a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/SettingsTest.kt b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/SettingsTest.kt index 8664f18bc..6a53f87c4 100644 --- a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/SettingsTest.kt +++ b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/SettingsTest.kt @@ -37,6 +37,7 @@ import org.ooni.probe.data.models.ProxyProtocol import org.ooni.probe.data.models.SettingsKey import org.ooni.probe.uitesting.helpers.clickOnContentDescription import org.ooni.probe.uitesting.helpers.clickOnText +import org.ooni.probe.uitesting.helpers.isCrashReportingEnabled import org.ooni.probe.uitesting.helpers.isOoni import org.ooni.probe.uitesting.helpers.preferences import org.ooni.probe.uitesting.helpers.skipOnboarding @@ -141,6 +142,8 @@ class SettingsTest { @Test fun privacy() = runTest { + if (!isCrashReportingEnabled) return@runTest + preferences.setValuesByKey( listOf( SettingsKey.SEND_CRASH to false, diff --git a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/helpers/ApplicationTestHelper.kt b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/helpers/ApplicationTestHelper.kt index 374c6aa04..1eabbbf80 100644 --- a/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/helpers/ApplicationTestHelper.kt +++ b/composeApp/src/androidInstrumentedTest/kotlin/org/ooni/probe/uitesting/helpers/ApplicationTestHelper.kt @@ -32,3 +32,9 @@ val isOoni val isNewsMediaScan get() = OrganizationConfig.baseSoftwareName.contains("news") + +val isCrashReportingEnabled + get() = dependencies.flavorConfig.isCrashReportingEnabled + +val isRemoteNotificationsEnabled + get() = dependencies.flavorConfig.isRemoteNotificationsEnabled