Skip to content

Fixes oppia#5815: Add tests for PRs #4259 and #4271#6306

Open
adanaamir wants to merge 1 commit into
oppia:developfrom
adanaamir:story-fragment-tests-5815
Open

Fixes oppia#5815: Add tests for PRs #4259 and #4271#6306
adanaamir wants to merge 1 commit into
oppia:developfrom
adanaamir:story-fragment-tests-5815

Conversation

@adanaamir

Copy link
Copy Markdown

Overview

Fixes #5815

This PR adds the missing instrumentation tests for the StoryFragmentPresenter routing scenarios that were left out of PR #4271.

What this PR does:

This PR adds test coverage for the following chapter navigation scenarios in StoryFragmentTest.kt:

  • Resuming an in-progress chapter navigates to ResumeLessonActivity.
  • Replaying a completed chapter navigates to ExplorationActivity.
  • Playing a chapter that has not been started navigates to ExplorationActivity.

To support verification of resume navigation, this PR updates the test activity to forward RouteToResumeLessonListener callbacks to a mocked listener, following the existing pattern already used for RouteToExplorationListener.

Testing

Added the following instrumentation tests:

  • testStoryFragment_notStartedChapter_clickChapter_routesToExploration()
  • testStoryFragment_completedChapter_clickChapter_routesToExplorationAsReplay()
  • testStoryFragment_inProgressSavedChapter_clickChapter_routesToResumeLesson()

@adanaamir
adanaamir requested a review from a team as a code owner July 7, 2026 14:27
@adanaamir
adanaamir requested a review from manas-yu July 7, 2026 14:27
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 512cc2b8-d023-4c0d-a378-246462e46b3f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Neer-rn Neer-rn self-assigned this Jul 7, 2026

@Neer-rn Neer-rn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @adanaamir, the overall approach is right but I have left few comments please address them and then assign back to me.

Comment on lines +934 to +936
)
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think ktlint would fail here. Did you test this locally? The closing parenthesis should be indented by 8 spaces, not 6. I think this indentation issue appears in multiple plaves, so please fix all of them and push the code only once ktlint passes locally.


verify(mockRouteToResumeLessonListener)
.routeToResumeLesson(
anyOrNull(), anyString(), anyString(), anyString(), anyString(), anyOrNull(), anyOrNull()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since resume routing is the new coverage this issue asked for consider capturing the arguments and asserting the checkpoint. Take a look what RecentlyPlayedFragmentTest does you will get the idea what I am talking about.


verify(mockRouteToExplorationListener)
.routeToExploration(
anyOrNull(), anyString(), anyString(), anyString(), anyString(), anyOrNull(), anyBoolean()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since a not started chapter always starts with checkpointing enabled please use eq(true) here instead of anyBoolean().

@Test // TODO(#3245): Error -> URLSpan should be used in place of ClickableSpan
@DisableAccessibilityChecks
fun testStoryFragment_inProgressSavedChapter_clickChapter_routesToResumeLesson() {
storyProgressTestHelper.markInProgressSavedFractionsStory0Exp0(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This only marks the chapter as IN_PROGRESS_SAVED, but it never saves an actual checkpoint. Checkpoint retrieval then fails, so the presenter falls back to routeToExploration and the resume mock is never called. Found out this from your failing CI. Again PTAL at how RecentlyPlayedFragmentTest handles this. I think no BUILD changes are needed, and the fake clock is already set up correctly in setUp() so this should be an easy fix.

@oppiabot oppiabot Bot unassigned Neer-rn Jul 8, 2026
@oppiabot

oppiabot Bot commented Jul 8, 2026

Copy link
Copy Markdown

Unassigning @Neer-rn since the review is done.

@oppiabot

oppiabot Bot commented Jul 8, 2026

Copy link
Copy Markdown

Hi @adanaamir, it looks like some changes were requested on this pull request by @Neer-rn. PTAL. Thanks!

@oppiabot

oppiabot Bot commented Jul 15, 2026

Copy link
Copy Markdown

Hi @adanaamir, 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 Jul 15, 2026
@adhiamboperes

Copy link
Copy Markdown
Contributor

@adanaamir, friendly ping on @Neer-rn's review comments. Could you please let us know when you will be able to address them?

@oppiabot oppiabot Bot removed the stale Corresponds to items that haven't seen a recent update and may be automatically closed. label Jul 16, 2026
@adanaamir

Copy link
Copy Markdown
Author

hello @adhiamboperes , I'm sorry i couldnt inform earlier, I've actually gotten busy with my internship. Due to which i havent been able to focus on this. I'll try to work on this if i have time, but if you want to unassign me and assign someone else, then thats fine by me.
Thankyou!!

@oppiabot

oppiabot Bot commented Jul 23, 2026

Copy link
Copy Markdown

Hi @adanaamir, 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 Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Corresponds to items that haven't seen a recent update and may be automatically closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for PRs #4259 and #4271

3 participants