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

test fail with timeout #134

Closed
iwater opened this issue May 20, 2017 · 8 comments
Closed

test fail with timeout #134

iwater opened this issue May 20, 2017 · 8 comments

Comments

@iwater
Copy link

iwater commented May 20, 2017

add testid "skip_login" and test with xcode Identifier, but always got timeout
2017-05-20 4 02 05
2017-05-20 4 02 26

describe('Example', () => {
  beforeEach(async () => {
    await device.reloadReactNative()
  })

  it('should show hello screen after tap', async () => {
    await element(by.id('skip_login')).tap()
  })

})
@bogobogo
Copy link
Contributor

Hey @iwater,

Your test is missing an Expectation. You are currently performing an action on an element with the id skip_login without writing what is the desired outcome, so you are not actually testing. An example with an Expectation would look like:

it('should show hello screen after tap', async () => {
    await element(by.id('skip_login')).tap()
    await expect(element(by.id('hello_screen'))).toBeVisible()
  })

You can read more about expectations here

@iwater
Copy link
Author

iwater commented May 20, 2017

change to
await expect(element(by.id('skip_login'))).toBeVisible()

but got same result timeout

@DanielMSchmidt
Copy link
Contributor

@bogobogo May be a bit off topic, but do you think this error in general would be valuable to add to Troubleshooting.RunningTests?

@rotemmiz
Copy link
Member

This issue may result from a background work that doesn't end. Detox will not execute commands while the app isn't idle.
Do you have long polling network requests? Or repeating setTimeouts?

@LeoNatan created a method that will inform the user on such background tasks when failing to execute, we will add it soon. Hopefully it will help debugging these kind of issues a breeze.

@iwater
Copy link
Author

iwater commented May 21, 2017

yes, there is a long running background task for db sync

@LeoNatan
Copy link
Contributor

LeoNatan commented Jun 6, 2017

If you have a long running task, it may be interfering with our synchronisation mechanism. We plan to add support for granular control of what is taken into account when synchronising, as well as the aforementioned helper tool to guide you on why the tests was blocked.

@LeoNatan LeoNatan closed this as completed Jun 6, 2017
@rotemmiz
Copy link
Member

rotemmiz commented Jun 7, 2017

detox@5.1.0 can now report on the reason it waits for app. add --debug-synchronization [value] to your detox test command.

When an action/expectation takes a significant amount of time use this option to print device synchronization status. The status will be printed if the action takes more than [value]ms to complete

@LeoNatan
Copy link
Contributor

LeoNatan commented Jun 7, 2017

❤️

@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.
Projects
None yet
Development

No branches or pull requests

5 participants