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

[iOS] Fail to type text with azerty Keyboard #92

Closed
padupuy opened this issue Mar 3, 2017 · 5 comments
Closed

[iOS] Fail to type text with azerty Keyboard #92

padupuy opened this issue Mar 3, 2017 · 5 comments

Comments

@padupuy
Copy link

padupuy commented Mar 3, 2017

Hello,

I use the latest version of your library detox 4.3.1, detox-server 1.1.0 with RN 0.40.0.

I am a french user and use a physical azerty keyboard and my keyboard settings are set on French / numeric.
❌ When I try to execute a simple test, it fails miserably because the robot couldn't find the keys 😂.
✅ To pass the test to green, i have to change my keyboard settings to 'US International'

capture d ecran 2017-03-03 a 18 29 36

Here is the error log

Error: Cannot find UI element.
Exception with Action: {
  "Action Name" : "Type 'admin'",
  "Element Matcher" : "(respondsToSelector(accessibilityIdentifier) && accessibilityID('username'))",
  "Recovery Suggestion" : "Check if element exists in the UI, modify assert criteria, or adjust the matcher"
}

Error Trace: [
  {
    "Description" : "Failed to type string 'admin', because key [K] could not be found on the keyboard.",
    "Description Glossary" :     {
      "K" : "a"
    },
    "Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
    "Code" : "0",
    "File Name" : "GREYKeyboard.m",
    "Function Name" : "+[GREYKeyboard grey_setErrorForkeyNotFoundWithAccessibilityLabel:forTypingString:error:]",
    "Line" : "465"
  }
]

Here is my code

describe('Login', function () {
    it('should login', function () {
        element(by.id('username')).typeText('admin');
        element(by.id('password')).typeText('admin');
        element(by.label('connectButton')).tap();
    });
});
@gregorybesson
Copy link

This bug seems related to this one google/EarlGrey#31 from the EarlGrey Project.

@rotemmiz
Copy link
Member

rotemmiz commented Mar 4, 2017

Hey @padupuy ,
As @gregorybesson said, this is indeed an issue with EarlGrey. The implementation of typeText actually taps the character sequence on the device's virtual keyboard.
This issue can be easily avoided by using replaceText instead of typeText.

Try this instead, it should work no matter what your keyboard setup is.

describe('Login', function () {
    it('should login', function () {
        element(by.id('username')).replaceText('admin');
        element(by.id('password')).replaceText('admin');
        element(by.label('connectButton')).tap();
    });
});

@rotemmiz rotemmiz closed this as completed Mar 5, 2017
@padupuy
Copy link
Author

padupuy commented Mar 5, 2017

@rotemmiz thank's for the tips, it works !

@LeoNatan
Copy link
Contributor

LeoNatan commented Mar 5, 2017

@rotemmiz Perhaps we should keep this open and open an issue with Earl Grey?

@tirodkar
Copy link

Hello Folks, in case you need to type with a different language or a different keyboard, please take a look at using grey_replaceText() instead of grey_typetext(). Do tell us if there any issues.

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants