-
Notifications
You must be signed in to change notification settings - Fork 527
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
Added FractionInputInteractionViewTest.kt #4242
Added FractionInputInteractionViewTest.kt #4242
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anandwana001 Can you please take a lead on this PR? I am not sure why I am getting assigned as the code-owner. (I will update this later on in a separate PR).
Thanks.
) | ||
activityScenario.onActivity { activity -> | ||
val pendingAnswer = activity.fractionInteractionViewModel.getPendingAnswer() | ||
Truth.assertThat(pendingAnswer.answer).isInstanceOf(InteractionObject::class.java) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please prefer direct imports here and everywhere else.
assertThat(pendingAnswer.answer).isInstanceOf(InteractionObject::class.java)
val activityScenario = ActivityScenario.launch( | ||
InputInteractionViewTestActivity::class.java | ||
) | ||
Espresso.onView(ViewMatchers.withId(R.id.test_fraction_input_interaction_view)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please prefer direct imports here and everywhere else.
onView(withId(R.id.test_fraction_input_interaction_view))
Hi @bhaktideshmukh, it looks like some changes were requested on this pull request by @rt4914. PTAL. Thanks! |
After reading the issue description, what I understand is currently we use So, what we will require here is a new Also, as part of this issue, we need to write new test cases which cover all the edge cases for fractions. Also, check this comment here - #4135 (comment) @BenHenning Let me know if I misunderstand anything here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left nit thought and a comment above.
- Update
InputInteractionViewTestActivity
to remove all the fraction part. - Add test result screenshots.
@DisableAccessibilityChecks | ||
fun testFractionInput_withWholeNumber_hasCorrectPendingAnswer() { | ||
val activityScenario = ActivityScenario.launch( | ||
InputInteractionViewTestActivity::class.java |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with the new Fraction specific test activity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with the new Fraction specific test activity.
I tried the way you suggested, by creating FractionInputInteractionViewTestActivity to replace InputInteractionViewTestActivity but now tests are failing in FractionInputInteractionViewTest.kt file.
Specific error:--
'java.lang.RuntimeException: Unable to resolve activity for Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=org.oppia.android/.app.testing.FractionInputInteractionViewTestActivity } -- see robolectric/robolectric#4736 for details'
Please do suggest how should I proceed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you share your FractionInputInteractionViewTestActivity
?
Also, did you add it in the manifest file? like <activity android:name=".app.testing.InputInteractionViewTestActivity" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pushed the recent changes.
qualifiers = "port-xxhdpi" | ||
) | ||
@LooperMode(LooperMode.Mode.PAUSED) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the empty line above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the InputInteractionViewTestActivity
as well by removing the logic of FractionInteractionViewModel
as this PR is all about separating out the fraction from it.
Left few more suggestions.
Also, check for failing github actions and update the PR with the latest develop branch.
import org.oppia.android.app.translation.AppLanguageResourceHandler | ||
import org.oppia.android.domain.translation.TranslationController | ||
import javax.inject.Inject | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment.
/**
* This is a dummy activity to test input interaction views.
* It contains [FractionInputInteractionView].
*/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@Inject | ||
lateinit var translationController: TranslationController | ||
|
||
val fractionInteractionViewModel by lazy { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is missing onCreate
function.
Take a look at the similar function in the InputInteractionViewTestActivity
. Add the UI logic too.
Also, see activity_input_interaction_view_test
, how we are binding the UI with the InputInteractionViewTestActivity
. Now, for this PR, we need to separate out the fraction part completely in the new UI file as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
) | ||
@LooperMode(LooperMode.Mode.PAUSED) | ||
|
||
class FractionInputInteractionViewTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run these tests on espresso and add a screenshot in the PR description showing that all the tests are passing.
qualifiers = "port-xxhdpi" | ||
) | ||
@LooperMode(LooperMode.Mode.PAUSED) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the empty line above.
@Singleton | ||
@Component( | ||
modules = [ | ||
StateFragmentTest.TestModule::class, RobolectricModule::class, PlatformParameterModule::class, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this? StateFragmentTest.TestModule
app/src/main/AndroidManifest.xml
Outdated
<activity | ||
android:name=".app.testing.FractionInputInteractionViewTestActivity" | ||
android:theme="@style/OppiaThemeWithoutActionBar" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<activity android:name=".app.testing.FractionInputInteractionViewTestActivity" />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, keep it below the line -
<activity android:name=".app.testing.InputInteractionViewTestActivity" />
Good for readability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
) | ||
@LooperMode(LooperMode.Mode.PAUSED) | ||
|
||
class FractionInputInteractionViewTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class FractionInputInteractionViewTest { | |
class FractionInputInteractionViewTestActivityTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to change the name?
InteractionAnswerErrorOrAvailabilityCheckReceiver { | ||
|
||
@Inject | ||
lateinit var resourceHandler: AppLanguageResourceHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had introduced inject function for this file in ActivityComponentImp
, but we are not calling it.
The way we call the inject function is
(activityComponent as ActivityComponentImpl).inject(this)
without this, these @inject
dependency injections will not work.
…nteration_view_test
@anandwana001 |
Is you PR updated with the latest develop branch? If not let's try update and re run. |
Its still the same |
@anandwana001 I guess I have messed this PR So I will release a new and clean PR for this issue with all your previously suggested changes. |
Explanation
Fixes #4135 : Added FractionInputInteractionViewTest.kt
Essential Checklist
For UI-specific PRs only
If your PR includes UI-related changes, then: