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

Robolectric failure for Toast message (Reference -PlatfromParameterIntegrationTest) #3446

Closed
Arjupta opened this issue Jul 8, 2021 · 0 comments · Fixed by #3478
Closed
Assignees
Labels
Z-ibt Temporary label for Ben to keep track of issues he's triaged.

Comments

@Arjupta
Copy link
Contributor

Arjupta commented Jul 8, 2021

PR Reference - #3405 (Its replica is made here which is facing same error)

Description - #3405 (comment)

Issue

Cannot run a test on Robolectric but working on Espresso.

  There was 1 failure:
  1) testSplashTestActivity_updateEmptyDatabase_readDatabaseValues_checkWelcomeMsgIsVisible(org.oppia.android.app.testing.PlatformParameterIntegrationTest)
  androidx.test.espresso.NoMatchingRootException: Matcher 'is toast' did not match any of the following roots: [Root{application-window-token=android.view.ViewRootImpl$W@65ea45a0, window-token=android.view.ViewRootImpl$W@65ea45a0, has-window-focus=true, layout-params-type=1, layout-params-string={(0,0)(fillxfill) ty=BASE_APPLICATION wanim=0x10302f8
    fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS
    pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND}, decor-view-string=DecorView{id=-1, visibility=VISIBLE, width=960, height=1410, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params={(0,0)(fillxfill) ty=BASE_APPLICATION wanim=0x10302f8
    fl=LAYOUT_IN_SCREEN LAYOUT_INSET_DECOR SPLIT_TOUCH HARDWARE_ACCELERATED DRAWS_SYSTEM_BAR_BACKGROUNDS
    pfl=FORCE_DRAW_STATUS_BAR_BACKGROUND}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}}]
	  at java.base/java.lang.Thread.getStackTrace(Thread.java:1654)
	  at androidx.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:96)
	  at androidx.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:59)
	  at androidx.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:322)
	  at androidx.test.espresso.ViewInteraction.check(ViewInteraction.java:306)
	  at org.oppia.android.app.testing.PlatformParameterIntegrationTest.testSplashTestActivity_updateEmptyDatabase_readDatabaseValues_checkWelcomeMsgIsVisible(PlatformParameterIntegrationTest_updated.kt:132)
	  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	  at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	  at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	  at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	  at org.oppia.android.testing.OppiaTestRule$apply$1.evaluate(OppiaTestRule.kt:18)
	  at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	  at org.robolectric.RobolectricTestRunner$HelperTestRunner$1.evaluate(RobolectricTestRunner.java:575)
	  at org.robolectric.internal.SandboxTestRunner$2.lambda$evaluate$0(SandboxTestRunner.java:263)
	  at org.robolectric.internal.bytecode.Sandbox.lambda$runOnMainThread$0(Sandbox.java:89)
	  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	  at java.base/java.lang.Thread.run(Thread.java:844)
anandwana001 pushed a commit that referenced this issue Jul 23, 2021
…and Robolectric [RunAllTests] (#3478)

* Added Robolectric dependency for androidTestImplementation in app module. This fixed the PlatformParameterTest to run on both Espresso and Robolectric

* Shifted the tests to testing directory as per the suggestion

* Removing ShadowToast.reset()
@BenHenning BenHenning added the Z-ibt Temporary label for Ben to keep track of issues he's triaged. label Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-ibt Temporary label for Ben to keep track of issues he's triaged.
3 participants