Skip to content

Commit

Permalink
Document clickAndWaitForReload() (#7547)
Browse files Browse the repository at this point in the history
* Document `clickAndWaitForReload()`

* Update dusk.md

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
u01jmg3 and taylorotwell authored Jan 4, 2022
1 parent 7894881 commit 9994ea5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dusk.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,8 +815,15 @@ You may also wait for a [named route's](/docs/{{version}}/routing#named-routes)

If you need to make assertions after a page has been reloaded, use the `waitForReload` method:

$browser->click('.some-action')
->waitForReload()
use Laravel\Dusk\Browser;

$browser->waitForReload(function (Browser $browser) {
$browser->assertSee('something');
});

Since the need to wait for the page to reload typically occurs after clicking a button, you may use the `clickAndWaitForReload` method for convenience:

$browser->clickAndWaitForReload('.selector')
->assertSee('something');

<a name="waiting-on-javascript-expressions"></a>
Expand Down

0 comments on commit 9994ea5

Please sign in to comment.