Skip to content

Fix #5895: Support feature flag toggling in StateFragmentTest#6118

Open
harshsomankar123-tech wants to merge 7 commits intooppia:developfrom
harshsomankar123-tech:test
Open

Fix #5895: Support feature flag toggling in StateFragmentTest#6118
harshsomankar123-tech wants to merge 7 commits intooppia:developfrom
harshsomankar123-tech:test

Conversation

@harshsomankar123-tech
Copy link
Copy Markdown
Contributor

@harshsomankar123-tech harshsomankar123-tech commented Feb 27, 2026

Explanation

Fixes #5895
Support feature flag toggling in StateFragmentTest

This PR implements support for feature flag toggling mid-session within StateFragmentTest. The changes follow the approach approved in the issue:

  • Moved executeInPreviousAppInstance into StateFragmentTest.
  • Updated the internal TestApplication to override attachBaseContext.
  • Added a new test (testFlashback_featureFlagOff_thenFeatureFlagOn) to verify the feature flag change mid-session. This test confirms that the flashback button successfully becomes visible after enabling the flag.

Essential Checklist

  • The PR title and explanation each start with "Fix #bugnum: " (If this PR fixes part of an issue, prefix the title with "Fix part of #bugnum: ...".)
  • Any changes to scripts/assets files have their rationale included in the PR explanation.
  • The PR follows the style guide.
  • The PR does not contain any unnecessary code changes from Android Studio (reference).
  • The PR is made from a branch that's not called "develop" and is up-to-date with "develop".
  • The PR is assigned to the appropriate reviewers (reference).

For UI-specific PRs only

Not applicable. This PR is entirely scoped to test infrastructure and unit/instrumentation tests (StateFragmentTest). It adds support for feature flag toggling during tests. No production Android UI components, layouts, or user-facing elements are modified. No screenshots, accessibility recordings, or UI-specific manual checks are required.

@harshsomankar123-tech harshsomankar123-tech requested a review from a team as a code owner February 27, 2026 15:23
@adhiamboperes adhiamboperes self-assigned this Feb 27, 2026
@github-actions
Copy link
Copy Markdown

APK & AAB differences analysis

Note that this is a summarized snapshot. See the CI artifacts for detailed differences.

Dev

Expand to see flavor specifics

Universal APK

APK file size: 19 MiB (old), 19 MiB (new), 288 bytes (Removed)

APK download size (estimated): 18 MiB (old), 18 MiB (new), 912 bytes (Added)

Method count: 265336 (old), 265327 (new), 9 (Removed)

Features: 1 (old), 1 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 7117 (old), 7117 (new), 0 (No change)

  • Anim: 43 (old), 43 (new), 0 (No change)
  • Animator: 26 (old), 26 (new), 0 (No change)
  • Array: 15 (old), 15 (new), 0 (No change)
  • Attr: 922 (old), 922 (new), 0 (No change)
  • Bool: 9 (old), 9 (new), 0 (No change)
  • Color: 1005 (old), 1005 (new), 0 (No change)
  • Dimen: 1093 (old), 1093 (new), 0 (No change)
  • Drawable: 393 (old), 393 (new), 0 (No change)
  • Id: 1361 (old), 1361 (new), 0 (No change)
  • Integer: 37 (old), 37 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 401 (old), 401 (new), 0 (No change)
  • Menu: 3 (old), 3 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • Raw: 2 (old), 2 (new), 0 (No change)
  • String: 938 (old), 938 (new), 0 (No change)
  • Style: 840 (old), 840 (new), 0 (No change)
  • Xml: 7 (old), 7 (new), 0 (No change)

Lesson assets: 113 (old), 113 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 19 MiB (old), 19 MiB (new), 288 bytes (Removed)
APK download size (estimated): 18 MiB (old), 18 MiB (new), 573 bytes (Added)
Method count: 265336 (old), 265327 (new), 9 (Removed)

Configuration hdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 18 KiB (old), 18 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 49 KiB (old), 49 KiB (new), 0 bytes (No change)
APK download size (estimated): 14 KiB (old), 14 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 46 KiB (old), 46 KiB (new), 0 bytes (No change)
APK download size (estimated): 14 KiB (old), 14 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 86 KiB (old), 86 KiB (new), 0 bytes (No change)
APK download size (estimated): 29 KiB (old), 29 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 57 KiB (old), 57 KiB (new), 0 bytes (No change)
APK download size (estimated): 21 KiB (old), 21 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 63 KiB (old), 63 KiB (new), 0 bytes (No change)
APK download size (estimated): 29 KiB (old), 29 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 64 KiB (old), 64 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Alpha

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 304 bytes (Removed)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 468 bytes (Removed)

Method count: 118604 (old), 118594 (new), 10 (Removed)

Features: 1 (old), 1 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 6051 (old), 6051 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 853 (old), 853 (new), 0 (No change)
  • Dimen: 815 (old), 815 (new), 0 (No change)
  • Drawable: 355 (old), 355 (new), 0 (No change)
  • Id: 1302 (old), 1302 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 359 (old), 359 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 859 (old), 859 (new), 0 (No change)
  • Style: 485 (old), 485 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 114 (old), 114 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 11 MiB (old), 11 MiB (new), 300 bytes (Removed)
APK download size (estimated): 10 MiB (old), 10 MiB (new), 439 bytes (Removed)
Method count: 118604 (old), 118594 (new), 10 (Removed)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 45 KiB (old), 45 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Beta

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 360 bytes (Removed)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 907 bytes (Added)

Method count: 118611 (old), 118601 (new), 10 (Removed)

Features: 1 (old), 1 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 6051 (old), 6051 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 853 (old), 853 (new), 0 (No change)
  • Dimen: 815 (old), 815 (new), 0 (No change)
  • Drawable: 355 (old), 355 (new), 0 (No change)
  • Id: 1302 (old), 1302 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 359 (old), 359 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 859 (old), 859 (new), 0 (No change)
  • Style: 485 (old), 485 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 114 (old), 114 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 11 MiB (old), 11 MiB (new), 364 bytes (Removed)
APK download size (estimated): 10 MiB (old), 10 MiB (new), 2070 bytes (Added)
Method count: 118611 (old), 118601 (new), 10 (Removed)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 45 KiB (old), 45 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Ga

Expand to see flavor specifics

Universal APK

APK file size: 11 MiB (old), 11 MiB (new), 224 bytes (Removed)

APK download size (estimated): 10 MiB (old), 10 MiB (new), 462 bytes (Added)

Method count: 118611 (old), 118601 (new), 10 (Removed)

Features: 1 (old), 1 (new), 0 (No change)

Permissions: 6 (old), 6 (new), 0 (No change)

Resources: 6051 (old), 6051 (new), 0 (No change)

  • Anim: 33 (old), 33 (new), 0 (No change)
  • Animator: 24 (old), 24 (new), 0 (No change)
  • Array: 14 (old), 14 (new), 0 (No change)
  • Attr: 888 (old), 888 (new), 0 (No change)
  • Bool: 8 (old), 8 (new), 0 (No change)
  • Color: 853 (old), 853 (new), 0 (No change)
  • Dimen: 815 (old), 815 (new), 0 (No change)
  • Drawable: 355 (old), 355 (new), 0 (No change)
  • Id: 1302 (old), 1302 (new), 0 (No change)
  • Integer: 32 (old), 32 (new), 0 (No change)
  • Interpolator: 11 (old), 11 (new), 0 (No change)
  • Layout: 359 (old), 359 (new), 0 (No change)
  • Menu: 1 (old), 1 (new), 0 (No change)
  • Mipmap: 1 (old), 1 (new), 0 (No change)
  • Plurals: 10 (old), 10 (new), 0 (No change)
  • String: 859 (old), 859 (new), 0 (No change)
  • Style: 485 (old), 485 (new), 0 (No change)
  • Xml: 1 (old), 1 (new), 0 (No change)

Lesson assets: 114 (old), 114 (new), 0 (No change)

AAB differences

Expand to see AAB specifics

Supported configurations:

  • hdpi (same)
  • ldpi (same)
  • mdpi (same)
  • tvdpi (same)
  • xhdpi (same)
  • xxhdpi (same)
  • xxxhdpi (same)

Base APK

APK file size: 11 MiB (old), 11 MiB (new), 220 bytes (Removed)
APK download size (estimated): 10 MiB (old), 10 MiB (new), 770 bytes (Added)
Method count: 118611 (old), 118601 (new), 10 (Removed)

Configuration hdpi

APK file size: 43 KiB (old), 43 KiB (new), 0 bytes (No change)
APK download size (estimated): 17 KiB (old), 17 KiB (new), 0 bytes (No change)

Configuration ldpi

APK file size: 45 KiB (old), 45 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration mdpi

APK file size: 38 KiB (old), 38 KiB (new), 0 bytes (No change)
APK download size (estimated): 13 KiB (old), 13 KiB (new), 0 bytes (No change)

Configuration tvdpi

APK file size: 73 KiB (old), 73 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

Configuration xhdpi

APK file size: 50 KiB (old), 50 KiB (new), 0 bytes (No change)
APK download size (estimated): 20 KiB (old), 20 KiB (new), 0 bytes (No change)

Configuration xxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 28 KiB (old), 28 KiB (new), 0 bytes (No change)

Configuration xxxhdpi

APK file size: 55 KiB (old), 55 KiB (new), 0 bytes (No change)
APK download size (estimated): 27 KiB (old), 27 KiB (new), 0 bytes (No change)

@harshsomankar123-tech
Copy link
Copy Markdown
Contributor Author

harshsomankar123-tech commented Mar 2, 2026

@BenHenning @adhiamboperes PTAL

@oppiabot
Copy link
Copy Markdown

oppiabot bot commented Mar 2, 2026

Unassigning @harshsomankar123-tech since a re-review was requested. @harshsomankar123-tech, please make sure you have addressed all review comments. Thanks!

@oppiabot
Copy link
Copy Markdown

oppiabot bot commented Mar 9, 2026

Hi @harshsomankar123-tech, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you!

@oppiabot oppiabot bot added stale Corresponds to items that haven't seen a recent update and may be automatically closed. and removed stale Corresponds to items that haven't seen a recent update and may be automatically closed. labels Mar 9, 2026
@oppiabot
Copy link
Copy Markdown

oppiabot bot commented Mar 19, 2026

Hi @harshsomankar123-tech, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you! If you're unsure how to reassign this PR to a reviewer, please make sure to review the wiki page that details the Guidance on submitting PRs.

@oppiabot oppiabot bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 19, 2026
@harshsomankar123-tech
Copy link
Copy Markdown
Contributor Author

@BenHenning PTAL

@oppiabot oppiabot bot removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 21, 2026
@BenHenning
Copy link
Copy Markdown
Member

Since @adhiamboperes has already been reviewing this, deassigning myself.

Also @harshsomankar123-tech make sure to fix failing CI checks otherwise that will end up blocking review, anyway, since we need to review follow-up fixes which means another back-and-forth.

@oppiabot
Copy link
Copy Markdown

oppiabot bot commented Mar 29, 2026

Hi @harshsomankar123-tech, I'm going to mark this PR as stale because it hasn't had any updates for 7 days. If no further activity occurs within 7 days, it will be automatically closed so that others can take up the issue.
If you are still working on this PR, please make a follow-up commit within 3 days (and submit it for review, if applicable). Please also let us know if you are stuck so we can help you! If you're unsure how to reassign this PR to a reviewer, please make sure to review the wiki page that details the Guidance on submitting PRs.

@oppiabot oppiabot bot added the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 29, 2026
@harshsomankar123-tech harshsomankar123-tech marked this pull request as draft March 29, 2026 01:49
@oppiabot oppiabot bot removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Mar 29, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

Coverage Report

Results

Number of files assessed: 46
Overall Coverage: 88.29%
Coverage Analysis: PASS

Passing coverage

Files with passing code coverage
File Coverage Lines Hit Status Min Required
EditTextInputAction.kttesting/src/main/java/org/oppia/android/testing/espresso/EditTextInputAction.kt
82.35% 14 / 17 70%
EventLogSubject.kttesting/src/main/java/org/oppia/android/testing/logging/EventLogSubject.kt
97.66% 501 / 513 70%
EventBundleCreator.ktutility/src/main/java/org/oppia/android/util/logging/EventBundleCreator.kt
76.23% 340 / 446 70%
EventTypeToHumanReadableNameConverter.ktutility/src/main/java/org/oppia/android/util/logging/EventTypeToHumanReadableNameConverter.kt
100.00% 57 / 57 70%

Exempted coverage

Files exempted from coverage
File Exemption Reason
TestDispatcherModule.kttesting/src/main/java/org/oppia/android/testing/threading/TestDispatcherModule.kt
This file is exempted from having a test file; skipping coverage check.
TestCoroutineDispatchersInjector.kttesting/src/main/java/org/oppia/android/testing/threading/TestCoroutineDispatchersInjector.kt
This file is exempted from having a test file; skipping coverage check.
CreateProfileFragment.ktapp/src/main/java/org/oppia/android/app/onboarding/CreateProfileFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
MathExpressionInteractionsView.ktapp/src/main/java/org/oppia/android/app/customview/interaction/MathExpressionInteractionsView.kt
This file is incompatible with code coverage tooling; skipping coverage check.
PromotedStoryCardView.ktapp/src/main/java/org/oppia/android/app/customview/PromotedStoryCardView.kt
This file is exempted from having a test file; skipping coverage check.
FractionInputInteractionViewTestActivity.ktapp/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
InputInteractionViewTestActivity.ktapp/src/main/java/org/oppia/android/app/testing/InputInteractionViewTestActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TextInputInteractionViewTestActivity.ktapp/src/main/java/org/oppia/android/app/testing/TextInputInteractionViewTestActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
RatioInputInteractionViewTestActivity.ktapp/src/main/java/org/oppia/android/app/testing/RatioInputInteractionViewTestActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
AddProfileActivity.ktapp/src/main/java/org/oppia/android/app/profile/AddProfileActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
PinPasswordActivity.ktapp/src/main/java/org/oppia/android/app/profile/PinPasswordActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ProfileLoginFragment.ktapp/src/main/java/org/oppia/android/app/profile/ProfileLoginFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
AdminPinActivity.ktapp/src/main/java/org/oppia/android/app/profile/AdminPinActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
AdminAuthActivity.ktapp/src/main/java/org/oppia/android/app/profile/AdminAuthActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ProfileResetPinFragment.ktapp/src/main/java/org/oppia/android/app/settings/profile/ProfileResetPinFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ProfileRenameFragment.ktapp/src/main/java/org/oppia/android/app/settings/profile/ProfileRenameFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
PlatformParametersFragment.ktapp/src/main/java/org/oppia/android/app/devoptions/platformparameters/PlatformParametersFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
MathExpressionParserFragment.ktapp/src/main/java/org/oppia/android/app/devoptions/mathexpressionparser/MathExpressionParserFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ExplorationActivity.ktapp/src/main/java/org/oppia/android/app/player/exploration/ExplorationActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
AudioViewModel.ktapp/src/main/java/org/oppia/android/app/player/audio/AudioViewModel.kt
This file is exempted from having a test file; skipping coverage check.
AudioFragment.ktapp/src/main/java/org/oppia/android/app/player/audio/AudioFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
DragDropSortInteractionView.ktapp/src/main/java/org/oppia/android/app/player/state/DragDropSortInteractionView.kt
This file is exempted from having a test file; skipping coverage check.
SelectionInteractionView.ktapp/src/main/java/org/oppia/android/app/player/state/SelectionInteractionView.kt
This file is exempted from having a test file; skipping coverage check.
StateFragment.ktapp/src/main/java/org/oppia/android/app/player/state/StateFragment.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ContinueInteractionViewModel.ktapp/src/main/java/org/oppia/android/app/player/state/itemviewmodel/ContinueInteractionViewModel.kt
This file is exempted from having a test file; skipping coverage check.
StatePlayerRecyclerViewAssembler.ktapp/src/main/java/org/oppia/android/app/player/state/StatePlayerRecyclerViewAssembler.kt
This file is exempted from having a test file; skipping coverage check.
SurveyFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/survey/SurveyFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
SurveyNpsItemOptionView.ktapp/src/main/java/org/oppia/android/app/survey/SurveyNpsItemOptionView.kt
This file is exempted from having a test file; skipping coverage check.
SurveyMultipleChoiceOptionView.ktapp/src/main/java/org/oppia/android/app/survey/SurveyMultipleChoiceOptionView.kt
This file is exempted from having a test file; skipping coverage check.
StoryFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/story/StoryFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
ViewBindingShim.ktapp/src/main/java/org/oppia/android/app/shim/ViewBindingShim.kt
This file is exempted from having a test file; skipping coverage check.
ViewBindingShimImpl.ktapp/src/main/java/org/oppia/android/app/shim/ViewBindingShimImpl.kt
This file is exempted from having a test file; skipping coverage check.
QuestionPlayerActivity.ktapp/src/main/java/org/oppia/android/app/topic/questionplayer/QuestionPlayerActivity.kt
This file is incompatible with code coverage tooling; skipping coverage check.
TopicLessonsFragmentPresenter.ktapp/src/main/java/org/oppia/android/app/topic/lessons/TopicLessonsFragmentPresenter.kt
This file is exempted from having a test file; skipping coverage check.
ComingSoonTopicsListView.ktapp/src/main/java/org/oppia/android/app/home/promotedlist/ComingSoonTopicsListView.kt
This file is exempted from having a test file; skipping coverage check.
PromotedStoryListView.ktapp/src/main/java/org/oppia/android/app/home/promotedlist/PromotedStoryListView.kt
This file is exempted from having a test file; skipping coverage check.
BindableAdapter.ktapp/src/main/java/org/oppia/android/app/recyclerview/BindableAdapter.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ExplorationDataController.ktdomain/src/main/java/org/oppia/android/domain/exploration/ExplorationDataController.kt
This file is incompatible with code coverage tooling; skipping coverage check.
ExplorationProgressController.ktdomain/src/main/java/org/oppia/android/domain/exploration/ExplorationProgressController.kt
This file is incompatible with code coverage tooling; skipping coverage check.
AudioPlayerController.ktdomain/src/main/java/org/oppia/android/domain/audio/AudioPlayerController.kt
This file is incompatible with code coverage tooling; skipping coverage check.
StateRetriever.ktdomain/src/main/java/org/oppia/android/domain/util/StateRetriever.kt
This file is incompatible with code coverage tooling; skipping coverage check.
LearnerAnalyticsLogger.ktdomain/src/main/java/org/oppia/android/domain/oppialogger/analytics/LearnerAnalyticsLogger.kt
This file is incompatible with code coverage tooling; skipping coverage check.

Refer test_file_exemptions.textproto for the comprehensive list of file exemptions and their required coverage percentages.

To learn more, visit the Oppia Android Code Coverage wiki page

@harshsomankar123-tech harshsomankar123-tech marked this pull request as ready for review April 1, 2026 05:07
@harshsomankar123-tech
Copy link
Copy Markdown
Contributor Author

@adhiamboperes PTAL

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

@harshsomankar123-tech this PR is being marked as draft because the PR description must contain 'Fixes #' or 'Fixes part of #' for each issue the PR is changing, and each one on its own line with no other text.

@github-actions github-actions bot marked this pull request as draft April 1, 2026 05:23
@harshsomankar123-tech harshsomankar123-tech marked this pull request as ready for review April 1, 2026 23:04
Copy link
Copy Markdown
Contributor

@adhiamboperes adhiamboperes left a comment

Choose a reason for hiding this comment

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

Thanks @harshsomankar123-tech!

I have left a suggestion on how I thought the test should be written, but there could be failures. Please try it and share any error messages that you get.

Comment on lines +5834 to +5855
fun testFlashback_featureFlagOff_thenFeatureFlagOn() {
// Simulate previous app instance with feature flag disabled.
TestPlatformParameterModule.forceEnableFlashbackSupport(false)
executeInPreviousAppInstance { _ ->
// No additional state needs to be arranged since the flag is already disabled.
}

// In the current app instance, keep feature flag off and verify button is not shown.
setUpTestWithFlashbackFeatureOff()
launchForExploration(TEST_EXPLORATION_ID_2, shouldSavePartialProgress = false).use {
startPlayingExploration()

navigateToPrototypeRatioInputState()

// Submit wrong answer.
typeRatioExpression("4:8")
clickSubmitAnswerButton()

// Verify flashback button is NOT shown (flag is off).
onView(withId(R.id.flashback_button)).check(doesNotExist())
}
}
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.

This test contains a number of mistakes.

  1. The executeInPreviousAppInstance is not set up to do anything.
  2. Both previous and current instances are testing for the flag off condition, when the test name says featureFlagOff_thenFeatureFlagOn
Suggested change
fun testFlashback_featureFlagOff_thenFeatureFlagOn() {
// Simulate previous app instance with feature flag disabled.
TestPlatformParameterModule.forceEnableFlashbackSupport(false)
executeInPreviousAppInstance { _ ->
// No additional state needs to be arranged since the flag is already disabled.
}
// In the current app instance, keep feature flag off and verify button is not shown.
setUpTestWithFlashbackFeatureOff()
launchForExploration(TEST_EXPLORATION_ID_2, shouldSavePartialProgress = false).use {
startPlayingExploration()
navigateToPrototypeRatioInputState()
// Submit wrong answer.
typeRatioExpression("4:8")
clickSubmitAnswerButton()
// Verify flashback button is NOT shown (flag is off).
onView(withId(R.id.flashback_button)).check(doesNotExist())
}
}
fun testFlashback_featureFlagOff_thenFeatureFlagOn() {
executeInPreviousAppInstance { _ ->
TestPlatformParameterModule.forceEnableFlashbackSupport(false)
startPlayingExploration()
navigateToPrototypeRatioInputState()
// Submit wrong answer.
typeRatioExpression("4:8")
clickSubmitAnswerButton()
// Verify flashback button is NOT shown.
onView(withId(R.id.flashback_button)).check(doesNotExist())
}
// In the current app instance, keep feature flag on and verify button is shown.
setUpTestWithFlashbackFeatureOn()
launchForExploration(TEST_EXPLORATION_ID_2, shouldSavePartialProgress = false).use {
startPlayingExploration()
navigateToPrototypeRatioInputState()
// Submit wrong answer.
typeRatioExpression("4:8")
clickSubmitAnswerButton()
// Verify flashback button is visible.
scrollToViewType(FLASHBACK_BUTTON)
onView(withId(R.id.flashback_button)).check(
matches(withText(R.string.state_flashback_button))
)
}
}

@adhiamboperes adhiamboperes removed their assignment Apr 8, 2026
@harshsomankar123-tech
Copy link
Copy Markdown
Contributor Author

Hi @adhiamboperes, thanks for the detailed suggestions! PTAL
I’ve updated the tests based on your feedback:

  • Feature Flag Tests: Updated to use executeInPreviousAppInstance. I also ensured the activity is explicitly launched within that block (via launchForExploration) so that it is resumed and available for Espresso actions like startPlayingExploration().
  • Property Initialization: Added a setUpTest() call at the start of the tests to ensure all injected properties are properly initialized throughout the lifecycle.
    The tests should now align with the suggested architecture.
    Thanks again for the guidance!

@oppiabot
Copy link
Copy Markdown

oppiabot bot commented Apr 11, 2026

Unassigning @harshsomankar123-tech since a re-review was requested. @harshsomankar123-tech, please make sure you have addressed all review comments. Thanks!

@adhiamboperes
Copy link
Copy Markdown
Contributor

@harshsomankar123-tech, some of the new tests are failing. Have you run them locally on your machine?

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.

[Feature Request]: Support feature flag toggling in StateFragmentTest

3 participants