Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix instrumented tests for Fdroid flavor #499

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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(),
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -141,6 +142,8 @@ class SettingsTest {
@Test
fun privacy() =
runTest {
if (!isCrashReportingEnabled) return@runTest

preferences.setValuesByKey(
listOf(
SettingsKey.SEND_CRASH to false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading