From d6d029d5979952e8ba79d0b6c1d61213046dbd6a Mon Sep 17 00:00:00 2001 From: Katie Smith <108671517+ktsm-th@users.noreply.github.com> Date: Fri, 6 Jun 2025 11:42:59 +0100 Subject: [PATCH 1/4] Add assertCount to dusk.md --- dusk.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dusk.md b/dusk.md index cc0cb689cd..f6a507e8b9 100644 --- a/dusk.md +++ b/dusk.md @@ -1414,6 +1414,7 @@ Dusk provides a variety of assertions that you may make against your application [assertDontSeeIn](#assert-dont-see-in) [assertSeeAnythingIn](#assert-see-anything-in) [assertSeeNothingIn](#assert-see-nothing-in) +[assertCount](#assert-count) [assertScript](#assert-script) [assertSourceHas](#assert-source-has) [assertSourceMissing](#assert-source-missing) @@ -1757,6 +1758,15 @@ Assert that no text is present within the selector: $browser->assertSeeNothingIn($selector); ``` + +#### assertCount + +Assert that the given element is present a given number of times: + +```php +$browser->assertCount($selector, $count); +``` + #### assertScript From 19f71ce45a623a226fda74c8d13df96ef64912c6 Mon Sep 17 00:00:00 2001 From: Katie Smith <108671517+ktsm-th@users.noreply.github.com> Date: Fri, 6 Jun 2025 15:29:42 +0100 Subject: [PATCH 2/4] add component() to dusk.md --- dusk.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dusk.md b/dusk.md index f6a507e8b9..aa42a219c6 100644 --- a/dusk.md +++ b/dusk.md @@ -2515,6 +2515,14 @@ class ExampleTest extends DuskTestCase } ``` +The `component()` method returns a browser instance scoped to a component. It works identically to `with()`, only it doesn't require a closure. + +``` +$datePicker = $browser->component(new DatePickerComponent); +$datePicker->selectDate(2019, 1, 30); +$datePicker->assertSee('January'); +``` + ## Continuous Integration From fdfea4f7b5af98184db9a473c69d9dbd4f0da668 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 6 Jun 2025 12:45:11 -0500 Subject: [PATCH 3/4] Update dusk.md --- dusk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dusk.md b/dusk.md index aa42a219c6..91207f4df7 100644 --- a/dusk.md +++ b/dusk.md @@ -1761,7 +1761,7 @@ $browser->assertSeeNothingIn($selector); #### assertCount -Assert that the given element is present a given number of times: +Assert that elements matching the given selector appear the specified number of times: ```php $browser->assertCount($selector, $count); From cc21a4992bde3e518a720dc21f76ca660d8898c6 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Fri, 6 Jun 2025 12:46:58 -0500 Subject: [PATCH 4/4] Update dusk.md --- dusk.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dusk.md b/dusk.md index 91207f4df7..053e4a5f8c 100644 --- a/dusk.md +++ b/dusk.md @@ -2515,11 +2515,13 @@ class ExampleTest extends DuskTestCase } ``` -The `component()` method returns a browser instance scoped to a component. It works identically to `with()`, only it doesn't require a closure. +The `component` method may be used to retrieve a browser instance scoped to the given component: -``` +```php $datePicker = $browser->component(new DatePickerComponent); + $datePicker->selectDate(2019, 1, 30); + $datePicker->assertSee('January'); ```