Tech:
- appium
- in a react-native app
- typescript
- webdriver
- XCUITest
The test:
- head into the login window which is an
SFSafariViewController(not a webview, but a browser window within the app) - try to prefill credentials
Code:
import { driver, $ } from '@wdio/globals';
// it(...
const emailField = await $(TestIds.iOS.loginTextField);
await emailField.click();
await emailField.setValue(Credentials.email);
const passwordField = await $(TestIds.iOS.passwordTextField);
await passwordField.click(); // the problem begins here
await passwordField.setValue(Credentials.password);
Issue:
Login browser window shows up tests begin running, login field is focused and filled, but the password field can't be focused.
The reason is that it's being hidden by the keyboard. (If I manually hide the keyboard, the test succeeds), but unless I do that, I see clicks taking place on the keyboard (around where the password field was supposed to be) but of course they don't work because the keyboard is hiding the field.
As a side effect of that, the password value is being filled in the username field.
What I tried:
passwordField.scrollIntoView();
driver.scroll(0, 100);
passwordField.hideKeyboard();
driver.hideKeyboard();
driver.tap(...)
but none of those worked, it seems like they are not implemented, and I'm super confused. I don't really understand which commands exist (the docs say those exist, types say they do but when I run them they fail).
Full error:
Method is not implemented
[ios/fastlane/test_output/MyApp.app iOS #0-0] unknown method: Method is not implemented
[ios/fastlane/test_output/MyApp.app iOS #0-0] at async Context.<anonymous> (file:///Users/ikokkinidis/MyApp/e2e/wdio/test/spec/ios/IOSLoginTest.e2e.ts:29:5)
How can I focus that field? Thanks