-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
problems when using "waitFor" #138
Comments
Update Seems like waitFor will pass any expectation! I change that code to await expect(element(by.id('status_text'))).toNotExist();
await element(by.id('fetch_status_button')).tap();
await expect(element(by.id('whatever'))).toBeVisible(); And it passes! |
Several things.
await waitFor(element(by.id('whatever'))).toBeVisible(); It should be: await waitFor(element(by.id('whatever'))).toBeVisible().withTimeout(2000); I agree that it's confusing because people forget the |
I confirmed that RN 0.44 broke text/label matching in detox. We're on it, trying to fix. ID matching should work anyway. Your examples don't use waitFor, they use expect , can you please fix them according to @talkol's suggestion and see if it the error persists? |
Hey @irrigator. BTW, RN44 is now supported in detox@5.0.9 |
@rotemmiz Looked at the docs of waitFor withTimeout. should it raise an exception if the timeout expires and the condition hasn't been met ? |
Hey @jeduden, |
@rotemmiz in the earl grey docs. the docs are specifying that NO is returned in this case. Is this also the case for withTimeout ? i.e. |
@jeduden no, we return nothing currently, I know it's broken, but until we have a small refactor in that area we can't return this value. |
I'm using the newest version of detox and RN and at first my test case looks like this:
Problem 1: The tap action will trigger a network request and when that request succeeds the UI will show a Text component containing "status: 200". According to the doc of
waitFor
, "In most cases, tests should be automatically synchronized with the app.", it seems to me here I can useexpect
instead ofwaitFor
and the runner will wait for the request to complete. However, it doesn't and the test case fails. So I changeexpect
towaitFor
.Problem 2: This time it does wait for the request. However, I get "TypeError: waitFor(...).toHaveText is not a function". If I change
toHaveText
totoBeVisible
, everything works! So I guess maybewaitFor
does not work withtoHaveText
yet?The text was updated successfully, but these errors were encountered: