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

Wallaby is too fast for React to do it's changes. Aside from timer.sleep, any suggestions? #337

Closed
sergiotapia opened this issue Dec 29, 2017 · 4 comments

Comments

@sergiotapia
Copy link

sergiotapia commented Dec 29, 2017

I have a form that shows up when someone clicks a button. This also hides the invocation button.

This is done using simple setState's to show/hide visible elements.


The test fails saying it cannot find the form, after the button click. However if I add the button click call multiple times, it then says it cannot find the button (so it's changing to the form).

If I add a timer.sleep, the test works as intended, but I'd rather not go down that route.

This form display is purely React, not an ajax request. I'm not sure how to tell Wallaby to relax for a little bit hehe.

Any suggestions on how to solve this problem?

@keathley
Copy link
Member

Can you post the test? Most operations should block until the query is valid or the test times out.

@keathley
Copy link
Member

keathley commented Jan 4, 2018

@sergiotapia were you able to resolve this?

@keathley
Copy link
Member

keathley commented Jan 8, 2018

@sergiotapia I'm going to go ahead and close this for now. If you are still experiencing issues feel free to re-open this. If you could also provide an example test case that would help in the debugging a great deal 👍.

@keathley keathley closed this as completed Jan 8, 2018
@stratigos
Copy link
Contributor

I have this same problem with LiveView (0.20.14). Especially when I have forms with a fair amount of state management that load as LiveComponents within another LiveView (e.g., the UIs the Phoenix generators create).

Doing something like: load page, click button to load form, enter data in input field... will often fail as the form is still loading when wallaby claims it cant find an input field (i use screenshots to show that the form is still fading into view at the time of fail).

So far im using xpath queries as a bandaid as they seem to slow things down enough, but it fills my tests with noise and also isnt a proper solution.

Elixir is just way too fast! ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants