From 3639935ffd7ef3ab9d9e54a4c27a53ca91e3345f Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Tue, 12 Aug 2025 20:44:48 +0100 Subject: [PATCH 1/6] Add Pest v4 guidelines From 45f310493c3af083ced5a657e9dd075a0a75fd62 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Tue, 12 Aug 2025 20:58:46 +0100 Subject: [PATCH 2/6] guidelines: pest/4: draft --- .ai/pest/4/core.blade.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .ai/pest/4/core.blade.php diff --git a/.ai/pest/4/core.blade.php b/.ai/pest/4/core.blade.php new file mode 100644 index 0000000..0f78d0f --- /dev/null +++ b/.ai/pest/4/core.blade.php @@ -0,0 +1,39 @@ +- Pest v4 is a huge upgrade offering: browser testing, smoke testing, visual regression testing, test sharding, faster type coverage, and profanity checking. +- Browser testing is incredibly powerful and useful for this project. +- Use the `search-docs` tool for detailed guidance on utilising these features. + +## Browser testing +- You can use Laravel features like `Event::fake()`, `assertAuthenticated()`, and model factories within browser tests, as well as `RefreshDatabase` (when needed) to ensure a clean state for each test. +- Test on multiple browsers (Chrome, Firefox, Safari). +- Test on different devices and viewports (like iPhone 14 Pro, tablets, or custom breakpoints). +- Switch color schemes (light/dark mode). +- Interact with the page (click, type, scroll, select, submit, drag-and-drop, touch gestures, etc.). +- Take screenshots or pause tests for debugging. + +@verbatim + +it('may reset the password', function () { + Notification::fake(); + $this->actingAs(User::factory()->create()); + + $page = visit('/sign-in') // visit on a real browser... + ->on()->mobile() // or ->desktop(), ->tablet(), etc... + ->inDarkMode(); // or ->inLightMode() + + $page->assertSee('Sign In') + ->assertNoJavascriptErrors() // or ->assertNoConsoleLogs() + ->click('Forgot Password?') + ->fill('email', 'nuno@laravel.com') + ->click('Send Reset Link') + ->assertSee('We have emailed your password reset link!') + + Notification::assertSent(ResetPassword::class); +}); + +@endverbatim +@verbatim + +$pages = visit(['/', '/about', '/contact']); +$pages->assertNoJavascriptErrors()->assertNoConsoleLogs(); + +@endverbatim From fde804053b007d5b9e3155edc1d13d017fa3a23a Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Tue, 12 Aug 2025 21:10:07 +0100 Subject: [PATCH 3/6] guidelines: pest/4: draft --- .ai/pest/4/core.blade.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.ai/pest/4/core.blade.php b/.ai/pest/4/core.blade.php index 0f78d0f..ff83080 100644 --- a/.ai/pest/4/core.blade.php +++ b/.ai/pest/4/core.blade.php @@ -1,5 +1,6 @@ - Pest v4 is a huge upgrade offering: browser testing, smoke testing, visual regression testing, test sharding, faster type coverage, and profanity checking. - Browser testing is incredibly powerful and useful for this project. +- Browser tests should live in `tests/Browser/`. - Use the `search-docs` tool for detailed guidance on utilising these features. ## Browser testing From 5f965973ff670c78e132d9d81c966707e3c05328 Mon Sep 17 00:00:00 2001 From: Ashley Hindle Date: Tue, 12 Aug 2025 22:03:50 +0100 Subject: [PATCH 4/6] guidelines: pest/4: add header --- .ai/pest/4/core.blade.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.ai/pest/4/core.blade.php b/.ai/pest/4/core.blade.php index ff83080..27c99f6 100644 --- a/.ai/pest/4/core.blade.php +++ b/.ai/pest/4/core.blade.php @@ -1,3 +1,5 @@ +## Pest 4 + - Pest v4 is a huge upgrade offering: browser testing, smoke testing, visual regression testing, test sharding, faster type coverage, and profanity checking. - Browser testing is incredibly powerful and useful for this project. - Browser tests should live in `tests/Browser/`. From 9bf4b05be66151941660d10513804a4419a4e3dc Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 13 Aug 2025 08:30:23 -0500 Subject: [PATCH 5/6] Update core.blade.php --- .ai/pest/4/core.blade.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/.ai/pest/4/core.blade.php b/.ai/pest/4/core.blade.php index 27c99f6..3c4518d 100644 --- a/.ai/pest/4/core.blade.php +++ b/.ai/pest/4/core.blade.php @@ -1,27 +1,27 @@ ## Pest 4 -- Pest v4 is a huge upgrade offering: browser testing, smoke testing, visual regression testing, test sharding, faster type coverage, and profanity checking. +- Pest v4 is a huge upgrade to Pest and offers: browser testing, smoke testing, visual regression testing, test sharding, and faster type coverage. - Browser testing is incredibly powerful and useful for this project. - Browser tests should live in `tests/Browser/`. -- Use the `search-docs` tool for detailed guidance on utilising these features. +- Use the `search-docs` tool for detailed guidance on utilizing these features. -## Browser testing -- You can use Laravel features like `Event::fake()`, `assertAuthenticated()`, and model factories within browser tests, as well as `RefreshDatabase` (when needed) to ensure a clean state for each test. -- Test on multiple browsers (Chrome, Firefox, Safari). -- Test on different devices and viewports (like iPhone 14 Pro, tablets, or custom breakpoints). -- Switch color schemes (light/dark mode). -- Interact with the page (click, type, scroll, select, submit, drag-and-drop, touch gestures, etc.). -- Take screenshots or pause tests for debugging. +### Browser Testing +- You can use Laravel features like `Event::fake()`, `assertAuthenticated()`, and model factories within Pest v4 browser tests, as well as `RefreshDatabase` (when needed) to ensure a clean state for each test. +- If requested, test on multiple browsers (Chrome, Firefox, Safari). +- If requested, test on different devices and viewports (like iPhone 14 Pro, tablets, or custom breakpoints). +- Switch color schemes (light/dark mode) when appropriate. +- Interact with the page (click, type, scroll, select, submit, drag-and-drop, touch gestures, etc.) when appropriate to complete the test. +- Take screenshots or pause tests for debugging when appropriate. +### Example Tests @verbatim - + it('may reset the password', function () { Notification::fake(); + $this->actingAs(User::factory()->create()); - $page = visit('/sign-in') // visit on a real browser... - ->on()->mobile() // or ->desktop(), ->tablet(), etc... - ->inDarkMode(); // or ->inLightMode() + $page = visit('/sign-in'); // Visit on a real browser... $page->assertSee('Sign In') ->assertNoJavascriptErrors() // or ->assertNoConsoleLogs() @@ -34,9 +34,11 @@ }); @endverbatim + @verbatim - + $pages = visit(['/', '/about', '/contact']); + $pages->assertNoJavascriptErrors()->assertNoConsoleLogs(); @endverbatim From ac546cd81b374164f98266b6ee44b42213f0c3f2 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 13 Aug 2025 08:30:49 -0500 Subject: [PATCH 6/6] Update core.blade.php --- .ai/pest/4/core.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ai/pest/4/core.blade.php b/.ai/pest/4/core.blade.php index 3c4518d..72d326e 100644 --- a/.ai/pest/4/core.blade.php +++ b/.ai/pest/4/core.blade.php @@ -7,10 +7,10 @@ ### Browser Testing - You can use Laravel features like `Event::fake()`, `assertAuthenticated()`, and model factories within Pest v4 browser tests, as well as `RefreshDatabase` (when needed) to ensure a clean state for each test. +- Interact with the page (click, type, scroll, select, submit, drag-and-drop, touch gestures, etc.) when appropriate to complete the test. - If requested, test on multiple browsers (Chrome, Firefox, Safari). - If requested, test on different devices and viewports (like iPhone 14 Pro, tablets, or custom breakpoints). - Switch color schemes (light/dark mode) when appropriate. -- Interact with the page (click, type, scroll, select, submit, drag-and-drop, touch gestures, etc.) when appropriate to complete the test. - Take screenshots or pause tests for debugging when appropriate. ### Example Tests