From a69ce89aea7cfe9c53be642d7d0998c1162ebf51 Mon Sep 17 00:00:00 2001 From: Karanjot Singh Date: Wed, 24 Mar 2021 05:27:53 +0530 Subject: [PATCH] Added named args to TopicPracticeFragmentTest (#2988) --- .../practice/TopicPracticeFragmentTest.kt | 92 +++++++++---------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt index 878cce8c0a6..f156b304979 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/topic/practice/TopicPracticeFragmentTest.kt @@ -119,9 +119,9 @@ class TopicPracticeFragmentTest { clickPracticeTab() onView( atPositionOnView( - R.id.topic_practice_skill_list, - 0, - R.id.master_skills_text_view + recyclerViewId = R.id.topic_practice_skill_list, + position = 0, + targetViewId = R.id.master_skills_text_view ) ).check( matches( @@ -134,16 +134,16 @@ class TopicPracticeFragmentTest { scrollToPosition(position = 5) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 5, - R.id.topic_practice_start_button + recyclerViewId = R.id.topic_practice_skill_list, + position = 5, + targetViewId = R.id.topic_practice_start_button ) ).check(matches(isCompletelyDisplayed())) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 5, - R.id.topic_practice_start_button + recyclerViewId = R.id.topic_practice_skill_list, + position = 5, + targetViewId = R.id.topic_practice_start_button ) ).check(matches(not(isClickable()))) } @@ -156,17 +156,17 @@ class TopicPracticeFragmentTest { clickPracticeItem(position = 1, targetViewId = R.id.subtopic_check_box) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 1, - R.id.subtopic_check_box + recyclerViewId = R.id.topic_practice_skill_list, + position = 1, + targetViewId = R.id.subtopic_check_box ) ).check(matches(isChecked())) clickPracticeItem(position = 2, targetViewId = R.id.subtopic_check_box) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 2, - R.id.subtopic_check_box + recyclerViewId = R.id.topic_practice_skill_list, + position = 2, + targetViewId = R.id.subtopic_check_box ) ).check(matches(isChecked())) } @@ -181,9 +181,9 @@ class TopicPracticeFragmentTest { scrollToPosition(position = 5) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 5, - R.id.topic_practice_start_button + recyclerViewId = R.id.topic_practice_skill_list, + position = 5, + targetViewId = R.id.topic_practice_start_button ) ).check(matches(isClickable())) } @@ -197,9 +197,9 @@ class TopicPracticeFragmentTest { clickPracticeItem(position = 1, targetViewId = R.id.subtopic_check_box) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 1, - R.id.subtopic_check_box + recyclerViewId = R.id.topic_practice_skill_list, + position = 1, + targetViewId = R.id.subtopic_check_box ) ).check(matches(not(isChecked()))) } @@ -215,9 +215,9 @@ class TopicPracticeFragmentTest { testCoroutineDispatchers.runCurrent() onView( atPositionOnView( - R.id.topic_practice_skill_list, - 5, - R.id.topic_practice_start_button + recyclerViewId = R.id.topic_practice_skill_list, + position = 5, + targetViewId = R.id.topic_practice_start_button ) ).check(matches(not(isClickable()))) } @@ -243,9 +243,9 @@ class TopicPracticeFragmentTest { onView(isRoot()).perform(orientationLandscape()) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 1, - R.id.subtopic_check_box + recyclerViewId = R.id.topic_practice_skill_list, + position = 1, + targetViewId = R.id.subtopic_check_box ) ).check(matches(isChecked())) } @@ -259,18 +259,18 @@ class TopicPracticeFragmentTest { testCoroutineDispatchers.runCurrent() onView( atPositionOnView( - R.id.topic_practice_skill_list, - 5, - R.id.topic_practice_start_button + recyclerViewId = R.id.topic_practice_skill_list, + position = 5, + targetViewId = R.id.topic_practice_start_button ) ).check(matches(not(isClickable()))) onView(isRoot()).perform(orientationLandscape()) scrollToPosition(position = 5) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 5, - R.id.topic_practice_start_button + recyclerViewId = R.id.topic_practice_skill_list, + position = 5, + targetViewId = R.id.topic_practice_start_button ) ).check(matches(not(isClickable()))) } @@ -286,9 +286,9 @@ class TopicPracticeFragmentTest { testCoroutineDispatchers.runCurrent() onView( atPositionOnView( - R.id.topic_practice_skill_list, - 5, - R.id.topic_practice_start_button + recyclerViewId = R.id.topic_practice_skill_list, + position = 5, + targetViewId = R.id.topic_practice_start_button ) ).check(matches(isClickable())) } @@ -300,9 +300,9 @@ class TopicPracticeFragmentTest { clickPracticeTab() onView( atPositionOnView( - R.id.topic_practice_skill_list, - 0, - R.id.master_skills_text_view + recyclerViewId = R.id.topic_practice_skill_list, + position = 0, + targetViewId = R.id.master_skills_text_view ) ).check( matches( @@ -314,9 +314,9 @@ class TopicPracticeFragmentTest { onView(isRoot()).perform(orientationLandscape()) onView( atPositionOnView( - R.id.topic_practice_skill_list, - 0, - R.id.master_skills_text_view + recyclerViewId = R.id.topic_practice_skill_list, + position = 0, + targetViewId = R.id.master_skills_text_view ) ).check( matches( @@ -345,7 +345,7 @@ class TopicPracticeFragmentTest { testCoroutineDispatchers.runCurrent() onView( allOf( - withText(TopicTab.getTabForPosition(2).name), + withText(TopicTab.getTabForPosition(position = 2).name), isDescendantOfA(withId(R.id.topic_tabs_container)) ) ).perform(click()) @@ -364,9 +364,9 @@ class TopicPracticeFragmentTest { private fun clickPracticeItem(position: Int, targetViewId: Int) { onView( atPositionOnView( - R.id.topic_practice_skill_list, - position, - targetViewId + recyclerViewId = R.id.topic_practice_skill_list, + position = position, + targetViewId = targetViewId ) ).perform(click()) testCoroutineDispatchers.runCurrent()