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
It seems like the behavior of ->waitForTextIn() was changed/broken in version 7.11.2.
We have a test case where a button is clicked, the button changes, and is then changed back again after three seconds. The relevant parts look something like this:
The waitForTextIn() method asserts that a text can be seen in a selector, and is expected to try repeatedly until it sees the text, or the specified number of seconds have passed.
return$this->waitUsing($seconds, 100, function () use ($selector, $text) {
return$this->assertSeeIn($selector, $text);
}, $message);
Same problem here. I have tracked it down a bit further.
This PR (#1062) replaced the previous waiting script with php-webdriver's WebDriverWait. The until method in that class, which is responsible for doing the waiting, only keeps waiting if it catches a NoSuchElementException error during the check (see line 61 in that class).
However, Dusk's waitForTextIn method calls $this->assertSeeIn(...) as a check, which throws PHPUnit\Framework\ExpectationFailedException as it fails, which in turn does not get caught by WebDriverWait. This means that it does not keep looping to check again after some time, it just throws the exception right away after the first failed check.
For anyone affected: you can temporarily force your dusk version to v7.11.1 in composer.json, until a fix is available:
Upon reviewing this bug, waitForTextIn() is the only method that doesn't return bool using waitUsing() but instead make an assertion. Will fix this soon.
Dusk Version
7.11.2
Laravel Version
10.28.0
PHP Version
8.2
PHPUnit Version
10.4.1
Database Driver & Version
sqlite
Description
It seems like the behavior of
->waitForTextIn()
was changed/broken in version7.11.2
.We have a test case where a button is clicked, the button changes, and is then changed back again after three seconds. The relevant parts look something like this:
The
waitForTextIn()
method asserts that a text can be seen in a selector, and is expected to try repeatedly until it sees the text, or the specified number of seconds have passed.When the assertion fails, an exception is thrown, but in the old code, all exceptions were caught:
ae5a90c#diff-61e17fcc4f9de0e83ca12934a78df293a652555e735631e83c53c37977b930b2L404
If I read it correctly, this is no longer the case. When the first assertion fails, the test fails.
Please let me know if I can provide any more information.
Steps To Reproduce
Use
->waitForTextIn(...);
in a test that expects at least two iterations before it succeeds.The text was updated successfully, but these errors were encountered: