You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Laravel Dusk already provides whenAvailable(). However, I need to support (conditional) modals which may or may not appear depending on the data I have loaded in my app. For this reason, it would be useful to have ifAvailable() which behaves similar to whenAvailable() with one key difference. If the given selector does not become available after a specified amount of time, Dusk proceeds without throwing an error. If the selector does become available then ifAvailable() behaves just like whenAvailable() and calls the given callback.
Would this be helpful to have in the core of Laravel Dusk?
One caveat is it would mean having two new internal methods.
Crucially this method uses find() (rather than findOrFail()) and returns $this if the selector cannot be found. It also has no timeout logic as this is no longer relevant.
The second I've called withOrContinue() that is called in place of ->with.
All it does is return $this if the selector cannot be found otherwise it calls the existing with() method.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel Dusk already provides
whenAvailable()
. However, I need to support (conditional) modals which may or may not appear depending on the data I have loaded in my app. For this reason, it would be useful to haveifAvailable()
which behaves similar towhenAvailable()
with one key difference. If the given selector does not become available after a specified amount of time, Dusk proceeds without throwing an error. If the selector does become available thenifAvailable()
behaves just likewhenAvailable()
and calls the given callback.Would this be helpful to have in the core of Laravel Dusk?
One caveat is it would mean having two new internal methods.
waitForOrContinue()
that is called in place of->waitFor
.find()
(rather thanfindOrFail()
) and returns$this
if the selector cannot be found. It also has no timeout logic as this is no longer relevant.withOrContinue()
that is called in place of->with
.$this
if the selector cannot be found otherwise it calls the existingwith()
method.Attempted PR: laravel/dusk#933
Beta Was this translation helpful? Give feedback.
All reactions