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

Click() becomes longClick() #45

Open
GoogleCodeExporter opened this issue May 26, 2015 · 7 comments
Open

Click() becomes longClick() #45

GoogleCodeExporter opened this issue May 26, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
onView(withId(R.id.abc)).perform(click()) sometimes does long click instead

What is the expected output? What do you see instead?
It should always do click. Doing long click sometimes makes the test flaky.

What version of the product are you using? On what operating system?
All versions of Android OS. Espresso 1.1 test kit

Please provide any additional information below.
I understand that you put a comment there saying that there's no perfect way to 
do this, but I remember that I didn't see this problem when I was using 
Robotium. Here is what Robotium does:


long downTime = SystemClock.uptimeMillis();
                        long eventTime = SystemClock.uptimeMillis();
                        MotionEvent event = MotionEvent.obtain(downTime, eventTime,
                                        MotionEvent.ACTION_DOWN, x, y, 0);
                        MotionEvent event2 = MotionEvent.obtain(downTime, eventTime,
                                        MotionEvent.ACTION_UP, x, y, 0);
                        try{
                                inst.sendPointerSync(event);
                                inst.sendPointerSync(event2);
                                successfull = true;
                        }

Espresso is using the UiController, so it may not be able to send motion event 
like Robotium does. But, the downtime and event time is also different between 
Espresso and Robotium. Maybe it can improve this problem by making this part of 
code as close as Robotium.

Original issue reported on code.google.com by [email protected] on 15 Jan 2014 at 8:56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant