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 #511 : Past expanded answers do not collapse in the question player #1456

Merged
merged 26 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
988e0cb
fix previous response collapse
anandwana001 Jul 8, 2020
f19973c
Merge branch 'develop' into question-player-previous-collapse
BenHenning Jul 13, 2020
6bebea4
Merge branch 'develop' into question-player-previous-collapse
BenHenning Jul 14, 2020
f3a5993
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Jul 29, 2020
2585f95
Merge remote-tracking branch 'origin/question-player-previous-collaps…
anandwana001 Jul 29, 2020
6745596
added correct import
anandwana001 Jul 29, 2020
f6cf1f6
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Jul 30, 2020
7409c79
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Aug 4, 2020
839aa55
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Aug 7, 2020
bed8507
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Aug 11, 2020
a8a5c9b
added test cases
anandwana001 Aug 11, 2020
72c3933
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Aug 13, 2020
3cbfbec
added test for question player
anandwana001 Aug 13, 2020
b2659b8
fix ktlint
anandwana001 Aug 13, 2020
c634780
update skill_id to test_skill_id
anandwana001 Aug 14, 2020
dbd9a4d
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Aug 18, 2020
29548eb
added QuestionPlayerActivityLocalTest
anandwana001 Aug 19, 2020
9b68e3c
nit changes as suggested
anandwana001 Aug 20, 2020
14baaa2
removed unused import
anandwana001 Aug 20, 2020
4ca7d05
failed test to check over CI
anandwana001 Aug 22, 2020
9011b27
revert failed test to check over CI
anandwana001 Aug 22, 2020
ec8c7d3
updating dagger modules
anandwana001 Aug 23, 2020
e23ea0e
adding profile init in test
anandwana001 Aug 23, 2020
163d253
Merge branch 'develop' of https://github.com/oppia/oppia-android into…
anandwana001 Aug 23, 2020
d28ea84
fix merge issue
anandwana001 Aug 23, 2020
0322c27
added questionplayer test to CI
anandwana001 Aug 24, 2020
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Robolectric tests - FAQ, Help, Mydownloads, Parser, ProfileProgress, RecyclerView, Story, Utility tests
# We require 'sudo' to avoid an error of the existing android sdk. See https://github.com/actions/starter-workflows/issues/58
run: |
sudo ./gradlew :app:testDebugUnitTest --tests org.oppia.app.faq* --tests org.oppia.app.help* --tests org.oppia.app.mydownloads* --tests org.oppia.app.parser* --tests org.oppia.app.profileprogress* --tests org.oppia.app.recyclerview* --tests org.oppia.app.splash* --tests org.oppia.app.story* --tests org.oppia.app.utility*
sudo ./gradlew :app:testDebugUnitTest --tests org.oppia.app.faq* --tests org.oppia.app.help* --tests org.oppia.app.mydownloads* --tests org.oppia.app.parser* --tests org.oppia.app.profileprogress* --tests org.oppia.app.recyclerview* --tests org.oppia.app.splash* --tests org.oppia.app.story* --tests org.oppia.app.utility* --tests org.oppia.app.topic.questionplayer*
- name: Upload App Test Reports
uses: actions/upload-artifact@v2
if: ${{ always() }} # IMPORTANT: Upload reports regardless of status
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.oppia.app.topic.questionplayer

import androidx.databinding.ObservableArrayList
import androidx.databinding.ObservableBoolean
import androidx.databinding.ObservableField
import androidx.databinding.ObservableList
import org.oppia.app.model.UserAnswer
import org.oppia.app.player.state.answerhandling.AnswerErrorCategory
import org.oppia.app.player.state.answerhandling.InteractionAnswerHandler
import org.oppia.app.player.state.itemviewmodel.StateItemViewModel
import org.oppia.app.viewmodel.ObservableArrayList
import org.oppia.app.viewmodel.ObservableViewModel
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/previous_response_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/previous_response_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/previous_response_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</data>

<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/previous_response_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.contrib.RecyclerViewActions.scrollToHolder
import androidx.test.espresso.contrib.RecyclerViewActions.scrollToPosition
import androidx.test.espresso.matcher.RootMatchers.isDialog
import androidx.test.espresso.matcher.ViewMatchers.hasChildCount
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.isEnabled
import androidx.test.espresso.matcher.ViewMatchers.withId
Expand Down Expand Up @@ -48,6 +49,7 @@ import org.oppia.app.player.exploration.TAG_HINTS_AND_SOLUTION_DIALOG
import org.oppia.app.player.state.itemviewmodel.StateItemViewModel
import org.oppia.app.player.state.itemviewmodel.StateItemViewModel.ViewType.CONTINUE_NAVIGATION_BUTTON
import org.oppia.app.player.state.itemviewmodel.StateItemViewModel.ViewType.FRACTION_INPUT_INTERACTION
import org.oppia.app.player.state.itemviewmodel.StateItemViewModel.ViewType.PREVIOUS_RESPONSES_HEADER
import org.oppia.app.player.state.itemviewmodel.StateItemViewModel.ViewType.SELECTION_INTERACTION
import org.oppia.app.player.state.itemviewmodel.StateItemViewModel.ViewType.SUBMIT_ANSWER_BUTTON
import org.oppia.app.player.state.testing.StateFragmentTestActivity
Expand Down Expand Up @@ -101,9 +103,15 @@ class StateFragmentLocalTest {
createAudioUrl(explorationId = "MjZzEVOG47_1", audioFileName = "content-en-ouqm7j21vt8.mp3")
private val audioDataSource1 = DataSource.toDataSource(AUDIO_URL_1, /* headers= */ null)

@Inject lateinit var profileTestHelper: ProfileTestHelper
@Inject lateinit var testCoroutineDispatchers: TestCoroutineDispatchers
@Inject @field:ApplicationContext lateinit var context: Context
@Inject
lateinit var profileTestHelper: ProfileTestHelper

@Inject
lateinit var testCoroutineDispatchers: TestCoroutineDispatchers

@Inject
@field:ApplicationContext
lateinit var context: Context

private val internalProfileId: Int = 1

Expand Down Expand Up @@ -228,6 +236,65 @@ class StateFragmentLocalTest {
}
}

@Test
fun testStateFragment_submitTwoWrongAnswers_checkPreviousHeaderVisible() {
launchForExploration(FRACTIONS_EXPLORATION_ID_1).use {
startPlayingExploration()
playThroughState1()

submitTwoWrongAnswers()
onView(withId(R.id.state_recycler_view)).perform(scrollToViewType(PREVIOUS_RESPONSES_HEADER))
onView(withId(R.id.previous_response_header)).check(matches(isDisplayed()))
}
}

@Test
fun testStateFragment_submitTwoWrongAnswers_checkPreviousHeaderCollapsed() {
launchForExploration(FRACTIONS_EXPLORATION_ID_1).use {
startPlayingExploration()
playThroughState1()

submitTwoWrongAnswers()
onView(withId(R.id.state_recycler_view)).perform(scrollToViewType(PREVIOUS_RESPONSES_HEADER))
onView(withId(R.id.previous_response_header)).check(matches(isDisplayed()))
onView(withId(R.id.state_recycler_view)).check(matches(hasChildCount(/* childCount= */ 5)))
}
}

@Test
fun testStateFragment_submitTwoWrongAnswers_expandResponse_checkPreviousHeaderExpanded() {
launchForExploration(FRACTIONS_EXPLORATION_ID_1).use {
startPlayingExploration()
playThroughState1()

submitTwoWrongAnswers()

onView(withId(R.id.state_recycler_view)).perform(scrollToViewType(PREVIOUS_RESPONSES_HEADER))
onView(withId(R.id.previous_response_header)).perform(click())
onView(withId(R.id.state_recycler_view)).check(matches(hasChildCount(/* childCount= */ 6)))
}
}

@Test
fun testStateFragment_expandCollapseResponse_checkPreviousHeaderCollapsed() {
launchForExploration(FRACTIONS_EXPLORATION_ID_1).use {
startPlayingExploration()
playThroughState1()

submitTwoWrongAnswers()

onView(withId(R.id.state_recycler_view)).perform(scrollToViewType(PREVIOUS_RESPONSES_HEADER))
onView(withId(R.id.previous_response_header)).check(matches(isDisplayed()))
onView(withId(R.id.state_recycler_view)).check(matches(hasChildCount(/* childCount= */ 5)))
onView(withId(R.id.state_recycler_view)).perform(scrollToViewType(PREVIOUS_RESPONSES_HEADER))
onView(withSubstring("Previous Responses")).perform(click())
onView(withId(R.id.state_recycler_view)).check(matches(hasChildCount(/* childCount= */ 6)))
onView(withId(R.id.state_recycler_view)).perform(scrollToViewType(PREVIOUS_RESPONSES_HEADER))
onView(withSubstring("Previous Responses")).perform(click())
onView(withId(R.id.state_recycler_view)).check(matches(hasChildCount(/* childCount= */ 5)))
}
}

@Test
fun testStateFragment_nextState_submitInitialWrongAnswer_noHintAvailable() {
launchForExploration(FRACTIONS_EXPLORATION_ID_1).use {
Expand Down
Loading