From d2fa22fe5d66dd9e71680abfdb8f8cc02538bab2 Mon Sep 17 00:00:00 2001 From: u01jmg3 Date: Mon, 3 Jan 2022 19:34:40 +0000 Subject: [PATCH 1/2] Document `clickAndWaitForReload()` --- dusk.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/dusk.md b/dusk.md index a92b19c2356..c7efd67d62c 100644 --- a/dusk.md +++ b/dusk.md @@ -813,10 +813,9 @@ You may also wait for a [named route's](/docs/{{version}}/routing#named-routes) #### Waiting for Page Reloads -If you need to make assertions after a page has been reloaded, use the `waitForReload` method: +If you need to make assertions after a page has been reloaded, use the `clickAndWaitForReload` method: - $browser->click('.some-action') - ->waitForReload() + $browser->clickAndWaitForReload('.some-action') ->assertSee('something'); From 2f6a3715d312b959b52cfdeaf22f5332a77ca4e5 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 4 Jan 2022 08:30:47 -0600 Subject: [PATCH 2/2] Update dusk.md --- dusk.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dusk.md b/dusk.md index c7efd67d62c..d4d51c20e00 100644 --- a/dusk.md +++ b/dusk.md @@ -813,9 +813,17 @@ You may also wait for a [named route's](/docs/{{version}}/routing#named-routes) #### Waiting for Page Reloads -If you need to make assertions after a page has been reloaded, use the `clickAndWaitForReload` method: +If you need to make assertions after a page has been reloaded, use the `waitForReload` method: - $browser->clickAndWaitForReload('.some-action') + 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');