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

Fixes part of #4302 - Introducing a JUnit annotation & rule for overriding Platform Parameters and Feature Flags #5565

Open
wants to merge 43 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
1867a89
Introducing Junit annotations and Test Rules to override Platform par…
Rd4dev Oct 25, 2024
1195cc1
Implementation of class level annotation and repeatable annotations f…
Rd4dev Nov 4, 2024
d452b05
Fix ktlint issues
Rd4dev Nov 4, 2024
caecfe7
Reverting unnecessary changes
Rd4dev Nov 4, 2024
c580a59
Fix unused import ktlint issue
Rd4dev Nov 4, 2024
1fbc9ca
Merge branch 'develop' of https://github.com/Rd4dev/oppia-android int…
Rd4dev Nov 22, 2024
975e372
Experimenting with enums and SpotlightFragmentTest
Rd4dev Dec 11, 2024
f8016ba
Save lobby for migrating from TestPlatformParameterModule to Platform…
Rd4dev Dec 11, 2024
1d363c4
SharedTests Migration from TestPlatformParamaterModule to PlatformPar…
Rd4dev Dec 12, 2024
56460a9
Done with app module test migrations
Rd4dev Dec 12, 2024
0872cd8
Save lobby for domain tests migration
Rd4dev Dec 13, 2024
6d90d31
Fix ktlint issues
Rd4dev Dec 13, 2024
73e9b79
Resolved merge conflicts
Rd4dev Dec 13, 2024
d9adbc0
Domain Module test migration
Rd4dev Jan 4, 2025
3072d10
Fix Lint Issues
Rd4dev Jan 4, 2025
17bdcf6
Test migration minus 6 test files
Rd4dev Jan 4, 2025
3e68937
Fix Lint checks
Rd4dev Jan 4, 2025
b732997
Resolve merge conflicts
Rd4dev Jan 4, 2025
68adfaf
Fix StateFragmentTest and ProfileChooserFragment
Rd4dev Jan 5, 2025
ada809d
Fix StateFragmentTest and ProfileChooserFragment
Rd4dev Jan 5, 2025
f990692
Reverting latex platform parameter constant
Rd4dev Jan 5, 2025
7269652
Fix HomeActivityTest
Rd4dev Jan 5, 2025
5a63604
Fix ExplorationActivityTest and reverted ExplorationProgressModuleTes…
Rd4dev Jan 5, 2025
66a0340
Migrated all modules from TestPlatformParameterModule to PlatformPara…
Rd4dev Jan 5, 2025
c54f3e9
Removed the test platform parameter module
Rd4dev Jan 5, 2025
73b4067
Trying out Test Rule declaration check with RegexPatternValidationCheck
Rd4dev Jan 6, 2025
59db0bd
Added missing OppiaTestRule in every test file
Rd4dev Jan 6, 2025
2ddadb5
Fix Oppia Test Rule imports in few utility modules
Rd4dev Jan 6, 2025
de2e8e3
Lint fixes and a few more dep additions
Rd4dev Jan 6, 2025
16a77c4
Removed the inclusion of oppia test rule from scripts and fixed few m…
Rd4dev Jan 6, 2025
e537a0f
Fixing the rest of the test cases to get past unit tests
Rd4dev Jan 7, 2025
fa312df
Fix failing instrumentation tests
Rd4dev Jan 7, 2025
1144baa
Adding a fallback value in getCurrentPlatform
Rd4dev Jan 7, 2025
f490edb
Fix parameterized tests with rule declaration fall back in domain module
Rd4dev Jan 7, 2025
6499245
Added KDocs for annotations and parameter constants
Rd4dev Jan 7, 2025
c6b5fd3
Lint and KDoc fixes
Rd4dev Jan 7, 2025
c509cec
Implementation of platform parameter overrides
Rd4dev Jan 7, 2025
a042bda
Added RegexPatternValidationCheckTests for missing oppia test rule de…
Rd4dev Jan 7, 2025
20bd806
Lint fixes for max line length
Rd4dev Jan 7, 2025
11fd281
Added PlatformParameterModuleTests, removed parameters provided from …
Rd4dev Jan 8, 2025
79fb3d4
Added test cases for PlatformParameterModule reset / clear overrides
Rd4dev Jan 8, 2025
9129cd8
Reverting log stream setting
Rd4dev Jan 8, 2025
bcc9d4a
Fix failing test case that had remaining test module declarations
Rd4dev Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 0 additions & 1 deletion app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -906,7 +906,6 @@ TEST_DEPS = [
"//testing/src/main/java/org/oppia/android/testing/mockito",
"//testing/src/main/java/org/oppia/android/testing/network",
"//testing/src/main/java/org/oppia/android/testing/network:test_module",
"//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module",
"//testing/src/main/java/org/oppia/android/testing/robolectric:is_on_robolectric",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/threading:coroutine_executor_service",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,16 @@ import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule
import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule
import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule
import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule
import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.DisableFeatureFlag
import org.oppia.android.testing.EnableFeatureFlag
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule
import org.oppia.android.testing.platformparameter.TestPlatformParameterModule
import org.oppia.android.testing.profile.ProfileTestHelper
import org.oppia.android.testing.robolectric.RobolectricModule
import org.oppia.android.testing.threading.TestCoroutineDispatchers
Expand All @@ -128,6 +130,7 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule
import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule
import org.oppia.android.util.parser.image.GlideImageLoaderModule
import org.oppia.android.util.parser.image.ImageParsingModule
import org.oppia.android.util.platformparameter.FeatureFlag
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
Expand All @@ -140,6 +143,7 @@ import javax.inject.Singleton
application = AdministratorControlsActivityTest.TestApplication::class,
qualifiers = "port-xxhdpi"
)
@EnableFeatureFlag(FeatureFlag.EDIT_ACCOUNTS_OPTIONS_UI)
class AdministratorControlsActivityTest {
@get:Rule
val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()
Expand Down Expand Up @@ -181,7 +185,6 @@ class AdministratorControlsActivityTest {

@Before
fun setUp() {
TestPlatformParameterModule.forceEnableEditAccountsOptionsUi(true)
Intents.init()
setUpTestApplicationComponent()
testCoroutineDispatchers.registerIdlingResource()
Expand Down Expand Up @@ -234,8 +237,8 @@ class AdministratorControlsActivityTest {
}

@Test
@DisableFeatureFlag(FeatureFlag.EDIT_ACCOUNTS_OPTIONS_UI)
fun testAdministratorControlsFragment_editAccountOptionsDisabled_generalOptionsIsNotDisplayed() {
TestPlatformParameterModule.forceEnableEditAccountsOptionsUi(false)

launch<AdministratorControlsActivity>(
createAdministratorControlsActivityIntent(
Expand Down Expand Up @@ -618,8 +621,8 @@ class AdministratorControlsActivityTest {

@Test
@Config(qualifiers = "sw600dp")
@EnableFeatureFlag(FeatureFlag.DOWNLOADS_SUPPORT)
fun testAdminControls_selectAdmin_tabletConfigChange_downloadsEnabled_hasNoDownloadSettings() {
TestPlatformParameterModule.forceEnableDownloadsSupport(true)
launch<AdministratorControlsActivity>(
createAdministratorControlsActivityIntent(
profileId = profileId
Expand All @@ -637,8 +640,8 @@ class AdministratorControlsActivityTest {

@Test
@Config(qualifiers = "sw600dp")
@EnableFeatureFlag(FeatureFlag.DOWNLOADS_SUPPORT)
fun testAdminControls_selectUser_tabletConfigChange_downloadsEnabled_hasDownloadSettings() {
TestPlatformParameterModule.forceEnableDownloadsSupport(true)
launch<AdministratorControlsActivity>(
createAdministratorControlsActivityIntent(
profileId = profileId
Expand All @@ -657,8 +660,8 @@ class AdministratorControlsActivityTest {

@Test
@Config(qualifiers = "sw600dp")
@EnableFeatureFlag(FeatureFlag.DOWNLOADS_SUPPORT)
fun testAdminControls_selectAdmin_tabletConfigChange_downloadsDisabled_hasNoDownloadSettings() {
TestPlatformParameterModule.forceEnableDownloadsSupport(false)
launch<AdministratorControlsActivity>(
createAdministratorControlsActivityIntent(
profileId = profileId
Expand All @@ -678,8 +681,8 @@ class AdministratorControlsActivityTest {

@Test
@Config(qualifiers = "sw600dp")
@DisableFeatureFlag(FeatureFlag.DOWNLOADS_SUPPORT)
fun testAdminControls_selectUser_tabletConfigChange_downloadsDisabled_hasNoDownloadSettings() {
TestPlatformParameterModule.forceEnableDownloadsSupport(false)
launch<AdministratorControlsActivity>(
createAdministratorControlsActivityIntent(
profileId = profileId
Expand Down Expand Up @@ -905,7 +908,7 @@ class AdministratorControlsActivityTest {
@Component(
modules = [
RobolectricModule::class,
TestPlatformParameterModule::class, PlatformParameterSingletonModule::class,
PlatformParameterModule::class, PlatformParameterSingletonModule::class,
TestDispatcherModule::class, ApplicationModule::class,
LoggerModule::class, ContinueModule::class, FractionInputModule::class,
ItemSelectionInputModule::class, MultipleChoiceInputModule::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,16 @@ import org.oppia.android.domain.oppialogger.analytics.ApplicationLifecycleModule
import org.oppia.android.domain.oppialogger.analytics.CpuPerformanceSnapshotterModule
import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModule
import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule
import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.DisableFeatureFlag
import org.oppia.android.testing.EnableFeatureFlag
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
import org.oppia.android.testing.firebase.TestAuthenticationModule
import org.oppia.android.testing.junit.InitializeDefaultLocaleRule
import org.oppia.android.testing.platformparameter.TestPlatformParameterModule
import org.oppia.android.testing.profile.ProfileTestHelper
import org.oppia.android.testing.robolectric.RobolectricModule
import org.oppia.android.testing.threading.TestCoroutineDispatchers
Expand All @@ -108,6 +110,7 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule
import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule
import org.oppia.android.util.parser.image.GlideImageLoaderModule
import org.oppia.android.util.parser.image.ImageParsingModule
import org.oppia.android.util.platformparameter.FeatureFlag
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import javax.inject.Inject
Expand All @@ -119,6 +122,8 @@ import javax.inject.Singleton
application = AdministratorControlsFragmentTest.TestApplication::class,
qualifiers = "port-xxhdpi"
)
@EnableFeatureFlag(FeatureFlag.EDIT_ACCOUNTS_OPTIONS_UI)
@EnableFeatureFlag(FeatureFlag.DOWNLOADS_SUPPORT)
class AdministratorControlsFragmentTest {

@get:Rule
Expand All @@ -142,8 +147,6 @@ class AdministratorControlsFragmentTest {

@Before
fun setUp() {
TestPlatformParameterModule.forceEnableEditAccountsOptionsUi(true)
TestPlatformParameterModule.forceEnableDownloadsSupport(true)
Intents.init()
setUpTestApplicationComponent()
profileTestHelper.initializeProfiles()
Expand Down Expand Up @@ -223,8 +226,8 @@ class AdministratorControlsFragmentTest {
}

@Test
@DisableFeatureFlag(FeatureFlag.DOWNLOADS_SUPPORT)
fun testAdministratorControlsFragment_downloadPermissionsAndSettings_autoUpdateIsNotDisplayed() {
TestPlatformParameterModule.forceEnableDownloadsSupport(false)
launch<AdministratorControlsFragmentTestActivity>(
createAdministratorControlsFragmentTestActivityIntent(
profileId = internalProfileId
Expand Down Expand Up @@ -593,7 +596,7 @@ class AdministratorControlsFragmentTest {
@Component(
modules = [
RobolectricModule::class,
TestPlatformParameterModule::class, PlatformParameterSingletonModule::class,
PlatformParameterModule::class, PlatformParameterSingletonModule::class,
TestDispatcherModule::class, ApplicationModule::class,
LoggerModule::class, ContinueModule::class, FractionInputModule::class,
ItemSelectionInputModule::class, MultipleChoiceInputModule::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ app_test(
"//testing/src/main/java/org/oppia/android/testing/junit:initialize_default_locale_rule",
"//testing/src/main/java/org/oppia/android/testing/logging:event_log_subject",
"//testing/src/main/java/org/oppia/android/testing/logging:sync_status_test_module",
"//testing/src/main/java/org/oppia/android/testing/platformparameter:test_module",
"//testing/src/main/java/org/oppia/android/testing/robolectric:test_module",
"//testing/src/main/java/org/oppia/android/testing/threading:test_module",
"//testing/src/main/java/org/oppia/android/testing/time:test_module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ import org.oppia.android.domain.oppialogger.logscheduler.MetricLogSchedulerModul
import org.oppia.android.domain.oppialogger.loguploader.LogReportWorkerModule
import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorker
import org.oppia.android.domain.oppialogger.loguploader.LogUploadWorkerFactory
import org.oppia.android.domain.platformparameter.PlatformParameterModule
import org.oppia.android.domain.platformparameter.PlatformParameterSingletonModule
import org.oppia.android.domain.question.QuestionModule
import org.oppia.android.domain.workmanager.WorkManagerConfigurationModule
import org.oppia.android.testing.EnableFeatureFlag
import org.oppia.android.testing.FakeAnalyticsEventLogger
import org.oppia.android.testing.OppiaTestRule
import org.oppia.android.testing.TestLogReportingModule
Expand All @@ -109,7 +111,6 @@ import org.oppia.android.testing.logging.EventLogSubject.Companion.assertThat
import org.oppia.android.testing.logging.EventLogSubject.LearnerDetailsContextSubject
import org.oppia.android.testing.logging.SyncStatusTestModule
import org.oppia.android.testing.logging.TestSyncStatusManager
import org.oppia.android.testing.platformparameter.TestPlatformParameterModule
import org.oppia.android.testing.profile.ProfileTestHelper
import org.oppia.android.testing.robolectric.RobolectricModule
import org.oppia.android.testing.threading.TestCoroutineDispatchers
Expand All @@ -132,6 +133,7 @@ import org.oppia.android.util.networking.NetworkConnectionUtilDebugModule
import org.oppia.android.util.parser.html.HtmlParserEntityTypeModule
import org.oppia.android.util.parser.image.GlideImageLoaderModule
import org.oppia.android.util.parser.image.ImageParsingModule
import org.oppia.android.util.platformparameter.FeatureFlag
import org.robolectric.annotation.Config
import org.robolectric.annotation.LooperMode
import java.security.MessageDigest
Expand All @@ -151,6 +153,9 @@ import javax.inject.Singleton
application = ProfileAndDeviceIdFragmentTest.TestApplication::class,
qualifiers = "port-xxhdpi"
)
@EnableFeatureFlag(FeatureFlag.EDIT_ACCOUNTS_OPTIONS_UI)
@EnableFeatureFlag(FeatureFlag.LEARNER_STUDY_ANALYTICS)
@EnableFeatureFlag(FeatureFlag.LOGGING_LEARNER_STUDY_IDS)
class ProfileAndDeviceIdFragmentTest {
@get:Rule val initializeDefaultLocaleRule = InitializeDefaultLocaleRule()
@get:Rule val oppiaTestRule = OppiaTestRule()
Expand All @@ -173,9 +178,6 @@ class ProfileAndDeviceIdFragmentTest {

@Before
fun setUp() {
TestPlatformParameterModule.forceEnableEditAccountsOptionsUi(true)
TestPlatformParameterModule.forceEnableLearnerStudyAnalytics(true)
TestPlatformParameterModule.forceEnableLoggingLearnerStudyIds(true)
setUpTestApplicationComponent()
Intents.init()
testCoroutineDispatchers.registerIdlingResource()
Expand Down Expand Up @@ -1116,7 +1118,7 @@ class ProfileAndDeviceIdFragmentTest {
@Singleton
@Component(
modules = [
TestPlatformParameterModule::class,
PlatformParameterModule::class,
TestModule::class, RobolectricModule::class, PlatformParameterSingletonModule::class,
TestDispatcherModule::class, ApplicationModule::class, LoggerModule::class,
ContinueModule::class, FractionInputModule::class, ItemSelectionInputModule::class,
Expand Down
Loading
Loading