RobotiumTech / robotium

Android UI Testing
http://www.robotium.org
Apache License 2.0
2.86k stars 786 forks source link

robotium typetext wrong order #876

Open Mrxiaoxie opened 7 years ago

Mrxiaoxie commented 7 years ago

When I use typetext() to verify edittext limit conditions , I found that the order of text is wrong. my code: Edite text = solo.getEditText(0); solo.setText(text,""); solo.typeText(text,'2.2222'); assertEquals("2.22", text.getText().toString());

but I get actual result is 22.22 not 2.22 how can I avoid this situation? thank you in advance!

andrewleo commented 7 years ago

This happened to me long time ago. setText maybe more reliable because it uses Android API to input text , while typeText use Instrumentation sendStringSync, it emulates soft keyboard to enter text.

Mrxiaoxie commented 7 years ago

Thank you! But If I use solo.setEditText(text,'2.2222'), the result of text.getText().toString() is empty. I want to simulate the actions of users,but this problem bother me a lot.