Skip to content

Commit

Permalink
Update tests with classroomId field
Browse files Browse the repository at this point in the history
  • Loading branch information
theMr17 committed Jul 3, 2024
1 parent 96e65df commit c31c6d6
Show file tree
Hide file tree
Showing 9 changed files with 801 additions and 220 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = "test_content_id")
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)

audioPlayerController.play(isPlayingFromAutoPlay = true, reloadingMainContent = false)
testCoroutineDispatchers.runCurrent()
Expand Down Expand Up @@ -538,7 +543,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = "test_content_id")
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)

audioPlayerController.play(isPlayingFromAutoPlay = false, reloadingMainContent = true)
testCoroutineDispatchers.runCurrent()
Expand Down Expand Up @@ -571,7 +581,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = "test_content_id", languageCode = "sw")
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)

audioPlayerController.play(isPlayingFromAutoPlay = false, reloadingMainContent = false)
testCoroutineDispatchers.runCurrent()
Expand Down Expand Up @@ -604,7 +619,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = null)
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)

audioPlayerController.play(isPlayingFromAutoPlay = false, reloadingMainContent = false)
testCoroutineDispatchers.runCurrent()
Expand Down Expand Up @@ -634,7 +654,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = "test_content_id", languageCode = "sw")
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)
audioPlayerController.play(isPlayingFromAutoPlay = false, reloadingMainContent = false)
testCoroutineDispatchers.runCurrent()

Expand Down Expand Up @@ -669,7 +694,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = null)
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)
audioPlayerController.play(isPlayingFromAutoPlay = false, reloadingMainContent = false)
testCoroutineDispatchers.runCurrent()

Expand Down Expand Up @@ -704,7 +734,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = "test_content_id", languageCode = "sw")
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)
audioPlayerController.play(isPlayingFromAutoPlay = false, reloadingMainContent = false)
testCoroutineDispatchers.runCurrent()
fakeAnalyticsEventLogger.clearAllEvents() // Remove unrelated events.
Expand All @@ -723,7 +758,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = "test_content_id", languageCode = "sw")
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)
testCoroutineDispatchers.runCurrent()
fakeAnalyticsEventLogger.clearAllEvents() // Remove unrelated events.

Expand All @@ -740,7 +780,12 @@ class AudioPlayerControllerTest {
val explorationId = TEST_EXPLORATION_ID_5
arrangeMediaPlayer(contentId = "test_content_id", languageCode = "sw")
logIntoAnalyticsReadyAdminProfile()
beginExploration(topicId = "test_topic_id", storyId = "test_story_id", explorationId)
beginExploration(
classroomId = "test_classroom_id",
topicId = "test_topic_id",
storyId = "test_story_id",
explorationId
)
testCoroutineDispatchers.runCurrent()
fakeAnalyticsEventLogger.clearAllEvents() // Remove unrelated events.

Expand Down Expand Up @@ -791,10 +836,15 @@ class AudioPlayerControllerTest {
)
}

private fun beginExploration(topicId: String, storyId: String, explorationId: String) {
private fun beginExploration(
classroomId: String,
topicId: String,
storyId: String,
explorationId: String
) {
val playingProvider =
explorationDataController.startPlayingNewExploration(
internalProfileId = 0, topicId, storyId, explorationId
internalProfileId = 0, classroomId, topicId, storyId, explorationId
)
monitorFactory.waitForNextSuccessfulResult(playingProvider)
monitorFactory.waitForNextSuccessfulResult(explorationProgressController.getCurrentState())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.oppia.android.domain.classify.rules.numericexpressioninput.NumericExp
import org.oppia.android.domain.classify.rules.numericinput.NumericInputRuleModule
import org.oppia.android.domain.classify.rules.ratioinput.RatioInputModule
import org.oppia.android.domain.classify.rules.textinput.TextInputRuleModule
import org.oppia.android.domain.classroom.TEST_CLASSROOM_ID_0
import org.oppia.android.domain.exploration.testing.ExplorationStorageTestModule
import org.oppia.android.domain.hintsandsolution.HintsAndSolutionConfigModule
import org.oppia.android.domain.hintsandsolution.HintsAndSolutionProdModule
Expand Down Expand Up @@ -109,7 +110,11 @@ class ExplorationActiveTimeControllerTest {

applicationLifecycleObserver.onAppInForeground()
startPlayingNewExploration(
TEST_TOPIC_ID_0, TEST_STORY_ID_0, TEST_EXPLORATION_ID_2, firstTestProfile
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
firstTestProfile
)

testCoroutineDispatchers.advanceTimeBy(SESSION_LENGTH_1)
Expand All @@ -131,7 +136,11 @@ class ExplorationActiveTimeControllerTest {

applicationLifecycleObserver.onAppInForeground()
startPlayingNewExploration(
TEST_TOPIC_ID_0, TEST_STORY_ID_0, TEST_EXPLORATION_ID_2, firstTestProfile
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
firstTestProfile
)

testCoroutineDispatchers.advanceTimeBy(SESSION_LENGTH_1)
Expand All @@ -153,7 +162,11 @@ class ExplorationActiveTimeControllerTest {

explorationActiveTimeController.onAppInForeground()
startPlayingNewExploration(
TEST_TOPIC_ID_0, TEST_STORY_ID_0, TEST_EXPLORATION_ID_2, firstTestProfile
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
firstTestProfile
)

testCoroutineDispatchers.advanceTimeBy(SESSION_LENGTH_1)
Expand Down Expand Up @@ -206,7 +219,11 @@ class ExplorationActiveTimeControllerTest {

applicationLifecycleObserver.onAppInForeground()
startPlayingNewExploration(
TEST_TOPIC_ID_0, TEST_STORY_ID_0, TEST_EXPLORATION_ID_2, firstTestProfile
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
firstTestProfile
)

testCoroutineDispatchers.advanceTimeBy(SESSION_LENGTH_1)
Expand Down Expand Up @@ -262,6 +279,7 @@ class ExplorationActiveTimeControllerTest {

explorationActiveTimeController.onAppInForeground()
startPlayingNewExploration(
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
Expand Down Expand Up @@ -308,6 +326,7 @@ class ExplorationActiveTimeControllerTest {
testCoroutineDispatchers.advanceTimeBy(TimeUnit.DAYS.toMillis(1))

startPlayingNewExploration(
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
Expand Down Expand Up @@ -353,6 +372,7 @@ class ExplorationActiveTimeControllerTest {
applicationLifecycleObserver.onAppInForeground()

startPlayingNewExploration(
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
Expand Down Expand Up @@ -380,6 +400,7 @@ class ExplorationActiveTimeControllerTest {
applicationLifecycleObserver.onAppInForeground()

startPlayingNewExploration(
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
Expand All @@ -389,6 +410,7 @@ class ExplorationActiveTimeControllerTest {
stopExploration()

startPlayingNewExploration(
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_1,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
Expand Down Expand Up @@ -423,6 +445,7 @@ class ExplorationActiveTimeControllerTest {
applicationLifecycleObserver.onAppInForeground()

startPlayingNewExploration(
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
Expand All @@ -432,6 +455,7 @@ class ExplorationActiveTimeControllerTest {
stopExploration()

startPlayingNewExploration(
TEST_CLASSROOM_ID_0,
TEST_TOPIC_ID_0,
TEST_STORY_ID_0,
TEST_EXPLORATION_ID_2,
Expand Down Expand Up @@ -460,14 +484,15 @@ class ExplorationActiveTimeControllerTest {
}

private fun startPlayingNewExploration(
classroomId: String,
topicId: String,
storyId: String,
explorationId: String,
profileId: ProfileId
) {
val startPlayingProvider =
explorationDataController.startPlayingNewExploration(
profileId.internalId, topicId, storyId, explorationId
profileId.internalId, classroomId, topicId, storyId, explorationId
)
monitorFactory.waitForNextSuccessfulResult(startPlayingProvider)
}
Expand Down
Loading

0 comments on commit c31c6d6

Please sign in to comment.