-
-
Notifications
You must be signed in to change notification settings - Fork 444
Description
What Happened
When using assertUrlIs() function on a browser page, the docs state you can use it as follows:
->assertUrlIs('/login');But you cannot use it like this because the regex is errorneously prepending the ^ character, this means the full URL must start with /login with nothing preceding it. This makes the test always fail for example:
Actual URL [http://127.0.0.1:48701/login] does not equal expected URL [/login].
Failed asserting that 'http://127.0.0.1:48701/login' matches PCRE pattern "/^\/login$/u".
For this to work currently, you have to use the full URL inside your test, which is obviously silly due to the fact that the port number may always change between runs.
Removing the ^ preceding character does fix this issue.
How to Reproduce
Install a fresh Laravel app, install Pest and Pest Browser Plugin, then add a test which asserts what the URL is (e.g. ->assertUrlIs('/login');), Make sure the test would pass (make your app render that URL correctly and visit that page)
Run the test and see that it fails.
Sample Repository
No response
Pest Version
4.3.1
PHP Version
8.4.16
Operation System
Linux
Notes
pestphp/pest-plugin-browser version v4.2.1