You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. Write a test for an activity which has a text input field
2. call onView(withId(R.id.input_field)).perform(typeText("@{!_)")); in your
text to populate the field
What is the expected output?
The field should be filled with the string: @{!_)
What do you see instead?
The field is filled with the text "`!=
What version of the product are you using? On what operating system?
Newly released espresso build with custom dependencies
espresso-1.0-SNAPSHOT.jar etc
Test device is Android 4.1.1 Galaxy Note 2 for the Japanese market.
Please provide any additional information below.
Keyboard layout differs from the default android keyboard
the relevant part of the test code:
public LoginTest() {
super(Login.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
getActivity();
}
@Test
public void testLogin() {
onView(withId(R.id.edit_login)).perform(typeText("@{!_)"));
...
}
Original issue reported on code.google.com by maik.vl...@vuzz.com on 23 Oct 2013 at 7:16
This seems to be an IME specific issue. This IME has a different interpretation
of these special characters then what is expected (we get from
http://developer.android.com/reference/android/view/KeyCharacterMap.html)
As a workaround, you can setText directly on the EditText by using your own
ViewAction... something like this:
final class SetTextAction implements ViewAction {
private final String text;
SetTextAction(String text) {
this.text = checkNotNull(text);
}
@SuppressWarnings("unchecked")
@Override
public Matcher<View> getConstraints() {
return allOf(isDisplayed(), isAssignableFrom(EditText.class));
}
@Override
public void perform(UiController uiController, View view) {
((EditText) view).setText(text);
}
@Override
public String getDescription() {
return "set text";
}
}
We should probably add this to Espresso's ViewActions collection.
Original comment by vale...@google.com on 23 Oct 2013 at 7:07
Original issue reported on code.google.com by
maik.vl...@vuzz.com
on 23 Oct 2013 at 7:16Attachments:
The text was updated successfully, but these errors were encountered: