False positives: junit.framework.AssertionFailedError: EditText is not found

0
0

I have a problem setting up Robotium tests to run on Travis without random false posivities.

Every couple of builds I get

pl.mg6.agrtt.TestActivityTests > testCanEnterTextAndPressButton[test(AVD) - 4.4.2] FAILED
junit
.framework.AssertionFailedError: EditText is not found!
at com
.robotium.solo.Waiter.waitForAndGetView(Waiter.java:540)

on all my tests.

I have created a simple project on GitHub to show the issue.

You may see how it builds on Travis. Note build #7 failed after modyfing unrelated file.

I’m suspecting this to be caused by emulator being locked or its sceeen dimmed. I could reproduce this issue on local machine by turning connected device’s screen off and then running

./gradlew connectedAndroidTest


After modyfing tests I got a different error message, which is somewhat more informative, so I’m adding it just in case someone tries to find a solution:

pl.mg6.agrtt.TestActivityTests > testCanFindViewsEnterTextAndPressButton[test(AVD) - 4.4.2] FAILED
junit
.framework.AssertionFailedError: Click at (160.0, 264.0) can not be completed! (java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission)
at com
.robotium.solo.Clicker.clickOnScreen(Clicker.java:106)
  • You must to post comments
0
0

While the root cause of this problem is still unknown to me, after some investigation and with a help from Robotium’s author Renas Reda I could confirm what I initially suspected that emulator indeed locks itself.

A workaround I’m using now is this code put in setUp method:

getInstrumentation().runOnMainSync(new Runnable() {
@Override
public void run() {
getActivity
().getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
}
});
  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Website