xiaofans / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

Click can not be completed #448

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Emulator launched with -no-window
2. Simple test that clicks a view on the screen
3. AssertionFailedError: click can not be completed

What is the expected output? What do you see instead?
The view should be clicked but fails

What version of the product are you using? On what operating system?
4.1 / Mac OS x 10.8.3 & Ubuntu 12.04 64-bit

Please provide any additional information below.
The issue does not happen if the Android emulator is launched with the window 
shown. This only happens on headless servers such as Jenkins running on AWS. 

Original issue reported on code.google.com by daniel.o...@silvercar.com on 6 May 2013 at 6:46

GoogleCodeExporter commented 9 years ago
FYI, others are having the same issue -> 
http://stackoverflow.com/questions/16375351/robotium-in-no-window-emulator-throw
s-click-can-not-be-completed/16405219

Original comment by daniel.o...@silvercar.com on 6 May 2013 at 6:51

GoogleCodeExporter commented 9 years ago
Without a window, robotium can not send a pointer sync to click a view. Please 
see this discussion:

http://groups.google.com/group/robotium-developers/browse_thread/thread/a115a228
02a348fb

Original comment by renasr...@gmail.com on 8 May 2013 at 12:11

GoogleCodeExporter commented 9 years ago
I tried responding in that link and some clever person decided not to approve 
my comment. I'll write it here. I don't understand why Robotium can't do this 
but ActivityInstrumentationTestCase2 is able to.

Example.
The following does not work:
solo.clickOnView(view);

But the following does work:
runTestOnUiThread(new Runnable() {
    @Override
    public void run() {
        assertTrue(view.performClick());
    }
});

Why can't Robotium perform the click in the UI thread and thus get around this 
problem? Why am I able to code a workaround and Robotium can't implement this 
workaround in a headless environment?

Original comment by gamebo...@gmail.com on 8 May 2013 at 7:33

GoogleCodeExporter commented 9 years ago
The way in which Robotium works is that it sends a pointer sync and in that
way emulates a real user clicking somewhere. It asks a view where it is
located and then sends a pointer sync that location. When you are using
your app with non-window the view will give incorrect values back as its
not really shown in any window.

Original comment by renasr...@gmail.com on 9 May 2013 at 6:16