1

I have a problem with typeText()

These instructions work:

await expect(element(by.id('loginUserName'))).toBeVisible();
await element(by.id('loginUserName')).replaceText('johnSmith');
await expect(element(by.id('login'))).toBeVisible();
await element(by.id('login')).tap();

but these do not:

await expect(element(by.id('loginUserName'))).toBeVisible();
await element(by.id('loginUserName')).typeText('johnSmith');
await expect(element(by.id('login'))).toBeVisible();
await element(by.id('login')).tap();

With typeText, the field is filled, but the keyboard stays visible with the focus still on the field. At this point the detox thread stops until the timeout.

Do I have to do something particular to use typeText?

Edit:

In the second part of my app, I have to use the keyboard in a textarea to trigger an action:

await element(by.id('interopValue')).typeText('something');
await element(by.id('interopValue')).replaceText('origin reference detox');
await expect(element(by.id('interopValue'))).toHaveValue(
  'origin reference detox',
);

Just like with the login, the test thread is stopped with the typeText()

enter image description here

Thx

Antoni4
  • 2,535
  • 24
  • 37
Paul
  • 1,290
  • 6
  • 24
  • 46
  • With the login case, the button is displayed on the right of the text input so the keyboard can not hide it. I think the problem is the same in the 2 cases: the tread is stopped when the keyboard is displayed, I have to found something to hide the keyboard without a \n in the value to acccept the multiline – Paul Nov 29 '17 at 10:02
  • Sorry man not sure how to help you with this one. Your problem doesn't seem to be related to the answers I gave. Try editing your question and add extra information, such as version of Detox you are using, version of Xcode, version of Simulator iOS. Also add anything else that might be relevant such as the error message you wrote "because key [K] could not be found on the keyboard" and what causes it. Seems it's EarlGrey related and might have something to do with the iOS version you are using. Try running these tests on iOS 10.3 or 11.1. Let me know if you find the solution. – Antoni4 Nov 29 '17 at 14:34
  • 10.0 was the simulator version, it use ios 11.1, with xcode 9.1, the latest version of detox (6.0.2) and earlgrey is also the latest version (1.12.1). I'm using a french simulator with an azerty keyboard, maybe my problems come from here (https://github.com/wix/detox/issues/92) – Paul Nov 29 '17 at 15:29
  • Yes 100%, on EarlGrey threads I remember reading that it only supports English at the moment. – Antoni4 Nov 29 '17 at 15:30
  • With a qwerty keyboard, It can now type numbers with typeText() but the thread is still stopped once the text is in the input :( – Paul Nov 29 '17 at 15:51
  • Have you tried changing your keyboard settings to 'US International' as suggested in http://github.com/wix/detox/issues/92? – Antoni4 Nov 29 '17 at 15:55
  • yes 'US International' – Paul Nov 29 '17 at 16:03
  • Both in your mac and the simulator? When you go into Simulator Settings -> General -> Keyboard -> Keyboards do you have English (QWERTY)? Also Settings -> General -> Keyboard -> Hardware Keyboard, do you have it setup there as English - U.S. ? – Antoni4 Nov 29 '17 at 16:16
  • I have had similar problems before, which I solved by removing all keyboards in the simulator except for (in my case) the US one required. There should only be one possible keyboard available in the simulator. Weird and annoying, but there you go. – sinewave440hz Mar 05 '18 at 13:38

0 Answers0