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
Copy file name to clipboardExpand all lines: pest-v4-is-here-now-with-browser-testing.md
+36-15Lines changed: 36 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,8 @@
1
1
---
2
2
title: Pest v4 Is Here — Now with Browser Testing
3
-
description: Today, we’re thrilled to announce Pest v4 — our biggest release yet, featuring powerful new browser testing with parallel support and full Laravel integration.
3
+
description: Today, we're thrilled to announce Pest v4 — our biggest release yet, featuring powerful new browser testing with parallel support and full Laravel integration.
4
4
---
5
5
6
-
> Note: Pest v4 is not yet released. Details may change before the final launch.
7
-
8
6
> To get started with Pest v4's new features including browser testing, please refer to the upgrade guide: [Upgrade Guide →](/docs/upgrade-guide).
@@ -17,9 +15,13 @@ description: Today, we’re thrilled to announce Pest v4 — our biggest release
17
15
18
16
# Pest v4 Is Here — Now with Browser Testing
19
17
20
-
Today (August 21), we’re thrilled to announce the release of **Pest v4**, bringing the biggest testing upgrade yet: powerful **[Browser Testing](/docs/browser-testing)**. Pest’s new browser testing features let you run elegant, maintainable browser tests — with first-class support for Laravel’s testing API and the ability to run tests in parallel. For the first time, this is browser testing that feels as good as writing unit tests.
18
+
Today, we're thrilled to announce the release of **Pest v4**, bringing the biggest testing upgrade yet: powerful **[Browser Testing](/docs/browser-testing)**. Pest's new browser testing features let you run elegant, maintainable browser tests — with first-class support for Laravel's testing API and the ability to run tests in parallel. For the first time, this is browser testing that feels as good as writing unit tests.
19
+
20
+
Here is the creator of Pest, [Nuno Maduro](https://twitter.com/enunomaduro), demoing the new browser testing features in Pest v4 at Laracon US:
@@ -71,24 +74,26 @@ After, you may use the `visit()` function anywhere. Finally, running this test i
71
74
Smoke testing your application in real browsers has never been easier. With Pest v4, you can literally visit all your application pages, and ensure they don't throw any JavaScript errors, and they don't log any console errors.
72
75
73
76
```php
74
-
$pages = visit(['/', '/about', '/contact']);
77
+
$routes = ['/', '/about', '/contact'];
78
+
79
+
visit($routes)->assertNoSmoke();
75
80
76
-
$pages->assertNoJavascriptErrors()
77
-
->assertNoConsoleLogs();
81
+
// assertNoSmoke() is a shorthand for:
82
+
// - assertNoJavascriptErrors()
83
+
// - assertNoConsoleLogs()
78
84
```
79
85
80
86
## Visual Regression Testing
81
87
82
-
Want to ensure your pages look exactly as expected? Pest v4 introduces visual regression testing with the `assertScreenshotsMatches()` assertion. This allows you to take screenshots of your pages and compare them against baseline images, ensuring that your UI remains consistent across changes.
88
+
Want to ensure your pages look exactly as expected over time? Pest v4 introduces visual regression testing with the `assertScreenshotsMatches()` assertion. This allows you to take screenshots of your pages and compare them against baseline images, ensuring that your UI remains consistent across changes.
83
89
84
90
```php
85
91
$pages = visit(['/', '/about', '/contact']);
86
92
87
93
$pages->assertScreenshotsMatches();
88
94
```
89
95
90
-
[image here missing]
91
-
96
+

92
97
93
98
This is just a glimpse of what Browser Testing in Pest v4 can do. Find out more about the new features below, and check out the [Browser Testing documentation](/docs/browser-testing) for a complete guide on how to get started.
94
99
@@ -173,9 +178,25 @@ As an example, `pr31(f*ck)` means that the word "fuck" was found on line 31.
173
178
174
179
To learn more about the Profanity plugin and how to configure it, check out the [Profanity documentation](/docs/profanity).
175
180
181
+
### Skip Locally or On CI
182
+
183
+
Pest v4 introduces the ability to conditionally skip tests based on the environment. You can use `skipLocally()` to skip tests when running locally, or `skipOnCi` to skip tests when running on a CI server.
184
+
185
+
```php
186
+
it('does not run locally', function () {
187
+
// This test will be skipped when running locally
188
+
})->skipLocally();
189
+
190
+
it('does not run on CI', function () {
191
+
// This test will be skipped when running on a CI server
192
+
})->skipOnCi();
193
+
```
194
+
176
195
### Miscellaneous Improvements
177
196
178
197
- You may now use `skipLocally()` or `skipOnCi` to conditionally skip tests based on the environment.
198
+
- The `not->toHaveSuspiciousCharacters()` arch expectation has been added to help you identify potential suspicious characters in your code. This arch expectation is now enabled by default on the `php` arch preset.
199
+
- The expectation `toBeSlug` has been added to help you validate that a string is a valid slug.
Copy file name to clipboardExpand all lines: upgrade-guide.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: Upgrade Guide
3
-
description: Upgrading To 3.x From 2.x
3
+
description: Upgrading To 4.x From 3.x
4
4
---
5
5
6
6
## Upgrading To 4.x From 3.x
@@ -33,6 +33,12 @@ All other Pest maintained plugins should be updated to version `^4.0` in your ap
33
33
34
34
Pest 4 is built on top of PHPUnit 12. This means that any notable changes made to PHPUnit 12 might have an impact on your test suite. To examine all the changes introduced in PHPUnit 12, please consult the [PHPUnit 12 changelog](https://github.com/sebastianbergmann/phpunit/blob/12.0.0/ChangeLog-12.0.md).
35
35
36
+
### Watch & Faker Plugin Deprecations
37
+
38
+
> Likelihood Of Impact: Low
39
+
40
+
The `pestphp/pest-plugin-watch` and `pestphp/pest-plugin-faker` plugins have been archived and are no longer maintained. The functionality provided by these plugins was not widely used, and therefore, they have been removed from Pest 4.
0 commit comments