diff --git a/browser-testing.md b/browser-testing.md
index 7a72a47..13ae37e 100644
--- a/browser-testing.md
+++ b/browser-testing.md
@@ -188,7 +188,7 @@ pest()->browser()->timeout(10000);
### Configuring User Agent
-By default, the User Agent will default to the Browser you're running for tests such as: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/133.0.6943.16 Safari/537.36`
+By default, the User Agent will default to the Browser you're running for tests such as: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/133.0.6943.16 Safari/537.36`
You may wish to override the User Agent of the browser for all of your tests, you can configure this in the `Pest.php` configuration file:
@@ -198,7 +198,7 @@ pest()->browser()->userAgent('CustomUserAgent');
### Geolocation
-Sometimes, you need to define where the browser believes it is physically on the earth. This method takes a latitude and longitude and will set the `geolocation` permission in the browser and then make the coordinates available via Javascript's getCurrentPosition API:
+Sometimes, you need to define where the browser believes it is physically on the earth. This method takes a latitude and longitude and will set the `geolocation` permission in the browser and then make the coordinates available via Javascript's getCurrentPosition API:
```php
$page = visit('/')
@@ -214,6 +214,7 @@ $page = visit('/')->withLocale('fr-FR');
$page->assertSee('Bienvenue');
```
+
### Configuring Timezone
You can set the timezone for your test requests using the `withTimezone` method. This is useful for testing date and time displays in different time zones.
@@ -351,6 +352,7 @@ $page->assertSee('Welcome, bot!');
## Element Assertions
+
### assertTitle
The `assertTitle` method asserts that the page title matches the given text:
@@ -360,6 +362,7 @@ $page->assertTitle('Home Page');
```
+
### assertTitleContains
The `assertTitleContains` method asserts that the page title contains the given text:
@@ -369,6 +372,7 @@ $page->assertTitleContains('Home');
```
+
### assertSee
The `assertSee` method asserts that the given text is present on the page:
@@ -378,6 +382,7 @@ $page->assertSee('Welcome to our website');
```
+
### assertDontSee
The `assertDontSee` method asserts that the given text is not present on the page:
@@ -387,6 +392,7 @@ $page->assertDontSee('Error occurred');
```
+
### assertSeeIn
The `assertSeeIn` method asserts that the given text is present within the selector:
@@ -396,6 +402,7 @@ $page->assertSeeIn('.header', 'Welcome');
```
+
### assertDontSeeIn
The `assertDontSeeIn` method asserts that the given text is not present within the selector:
@@ -405,6 +412,7 @@ $page->assertDontSeeIn('.error-container', 'Error occurred');
```
+
### assertSeeAnythingIn
The `assertSeeAnythingIn` method asserts that any text is present within the selector:
@@ -414,6 +422,7 @@ $page->assertSeeAnythingIn('.content');
```
+
### assertSeeNothingIn
The `assertSeeNothingIn` method asserts that no text is present within the selector:
@@ -423,6 +432,7 @@ $page->assertSeeNothingIn('.empty-container');
```
+
### assertCount
The `assertCount` method asserts that a given element is present a given amount of times:
@@ -432,6 +442,7 @@ $page->assertCount('.item', 5);
```
+
### assertScript
The `assertScript` method asserts that the given JavaScript expression evaluates to the given value:
@@ -442,6 +453,7 @@ $page->assertScript('document.querySelector(".btn").disabled', true);
```
+
### assertSourceHas
The `assertSourceHas` method asserts that the given source code is present on the page:
@@ -451,6 +463,7 @@ $page->assertSourceHas('
');
```
+
### assertSeeLink
The `assertSeeLink` method asserts that the given link is present on the page:
@@ -469,6 +483,7 @@ $page->assertSeeLink('About Us');
```
+
### assertDontSeeLink
The `assertDontSeeLink` method asserts that the given link is not present on the page:
@@ -478,6 +493,7 @@ $page->assertDontSeeLink('Admin Panel');
```
+
### assertChecked
The `assertChecked` method asserts that the given checkbox is checked:
@@ -488,6 +504,7 @@ $page->assertChecked('color', 'blue'); // For checkbox with specific value
```
+
### assertNotChecked
The `assertNotChecked` method asserts that the given checkbox is not checked:
@@ -498,6 +515,7 @@ $page->assertNotChecked('color', 'red'); // For checkbox with specific value
```
+
### assertIndeterminate
The `assertIndeterminate` method asserts that the given checkbox is in an indeterminate state:
@@ -507,6 +525,7 @@ $page->assertIndeterminate('partial-selection');
```
+
### assertRadioSelected
The `assertRadioSelected` method asserts that the given radio field is selected:
@@ -516,6 +535,7 @@ $page->assertRadioSelected('size', 'large');
```
+
### assertRadioNotSelected
The `assertRadioNotSelected` method asserts that the given radio field is not selected:
@@ -525,6 +545,7 @@ $page->assertRadioNotSelected('size', 'small');
```
+
### assertSelected
The `assertSelected` method asserts that the given dropdown has the given value selected:
@@ -534,6 +555,7 @@ $page->assertSelected('country', 'US');
```
+
### assertNotSelected
The `assertNotSelected` method asserts that the given dropdown does not have the given value selected:
@@ -543,6 +565,7 @@ $page->assertNotSelected('country', 'UK');
```
+
### assertValue
The `assertValue` method asserts that the element matching the given selector has the given value:
@@ -552,6 +575,7 @@ $page->assertValue('input[name=email]', 'test@example.com');
```
+
### assertValueIsNot
The `assertValueIsNot` method asserts that the element matching the given selector does not have the given value:
@@ -561,6 +585,7 @@ $page->assertValueIsNot('input[name=email]', 'invalid@example.com');
```
+
### assertAttribute
The `assertAttribute` method asserts that the element matching the given selector has the given value in the provided attribute:
@@ -570,6 +595,7 @@ $page->assertAttribute('img', 'alt', 'Profile Picture');
```
+
### assertAttributeMissing
The `assertAttributeMissing` method asserts that the element matching the given selector is missing the provided attribute:
@@ -579,6 +605,7 @@ $page->assertAttributeMissing('button', 'disabled');
```
+
### assertAttributeContains
The `assertAttributeContains` method asserts that the element matching the given selector contains the given value in the provided attribute:
@@ -588,6 +615,7 @@ $page->assertAttributeContains('div', 'class', 'container');
```
+
### assertAttributeDoesntContain
The `assertAttributeDoesntContain` method asserts that the element matching the given selector does not contain the given value in the provided attribute:
@@ -597,6 +625,7 @@ $page->assertAttributeDoesntContain('div', 'class', 'hidden');
```
+
### assertAriaAttribute
The `assertAriaAttribute` method asserts that the element matching the given selector has the given value in the provided aria attribute:
@@ -606,6 +635,7 @@ $page->assertAriaAttribute('button', 'label', 'Close');
```
+
### assertDataAttribute
The `assertDataAttribute` method asserts that the element matching the given selector has the given value in the provided data attribute:
@@ -615,6 +645,7 @@ $page->assertDataAttribute('div', 'id', '123');
```
+
### assertVisible
The `assertVisible` method asserts that the element matching the given selector is visible:
@@ -624,6 +655,7 @@ $page->assertVisible('.alert');
```
+
### assertPresent
The `assertPresent` method asserts that the element matching the given selector is present in the DOM:
@@ -633,6 +665,7 @@ $page->assertPresent('form');
```
+
### assertNotPresent
The `assertNotPresent` method asserts that the element matching the given selector is not present in the DOM:
@@ -642,6 +675,7 @@ $page->assertNotPresent('.error-message');
```
+
### assertMissing
The `assertMissing` method asserts that the element matching the given selector is not visible:
@@ -651,6 +685,7 @@ $page->assertMissing('.hidden-element');
```
+
### assertEnabled
The `assertEnabled` method asserts that the given field is enabled:
@@ -660,6 +695,7 @@ $page->assertEnabled('email');
```
+
### assertDisabled
The `assertDisabled` method asserts that the given field is disabled:
@@ -669,6 +705,7 @@ $page->assertDisabled('submit');
```
+
### assertButtonEnabled
The `assertButtonEnabled` method asserts that the given button is enabled:
@@ -678,6 +715,7 @@ $page->assertButtonEnabled('Save');
```
+
### assertButtonDisabled
The `assertButtonDisabled` method asserts that the given button is disabled:
@@ -689,6 +727,7 @@ $page->assertButtonDisabled('Submit');
## URL Assertions
+
### assertUrlIs
The `assertUrlIs` method asserts that the current URL matches the given string:
@@ -698,6 +737,7 @@ $page->assertUrlIs('https://example.com/home');
```
+
### assertSchemeIs
The `assertSchemeIs` method asserts that the current URL scheme matches the given scheme:
@@ -707,6 +747,7 @@ $page->assertSchemeIs('https');
```
+
### assertSchemeIsNot
The `assertSchemeIsNot` method asserts that the current URL scheme does not match the given scheme:
@@ -716,6 +757,7 @@ $page->assertSchemeIsNot('http');
```
+
### assertHostIs
The `assertHostIs` method asserts that the current URL host matches the given host:
@@ -725,6 +767,7 @@ $page->assertHostIs('example.com');
```
+
### assertHostIsNot
The `assertHostIsNot` method asserts that the current URL host does not match the given host:
@@ -734,6 +777,7 @@ $page->assertHostIsNot('wrong-domain.com');
```
+
### assertPortIs
The `assertPortIs` method asserts that the current URL port matches the given port:
@@ -743,6 +787,7 @@ $page->assertPortIs('443');
```
+
### assertPortIsNot
The `assertPortIsNot` method asserts that the current URL port does not match the given port:
@@ -752,6 +797,7 @@ $page->assertPortIsNot('8080');
```
+
### assertPathBeginsWith
The `assertPathBeginsWith` method asserts that the current URL path begins with the given path:
@@ -761,6 +807,7 @@ $page->assertPathBeginsWith('/users');
```
+
### assertPathEndsWith
The `assertPathEndsWith` method asserts that the current URL path ends with the given path:
@@ -770,6 +817,7 @@ $page->assertPathEndsWith('/profile');
```
+
### assertPathContains
The `assertPathContains` method asserts that the current URL path contains the given path:
@@ -779,6 +827,7 @@ $page->assertPathContains('settings');
```
+
### assertPathIs
The `assertPathIs` method asserts that the current path matches the given path:
@@ -788,6 +837,7 @@ $page->assertPathIs('/dashboard');
```
+
### assertPathIsNot
The `assertPathIsNot` method asserts that the current path does not match the given path:
@@ -797,6 +847,7 @@ $page->assertPathIsNot('/login');
```
+
### assertQueryStringHas
The `assertQueryStringHas` method asserts that the given query string parameter is present and has a given value:
@@ -807,6 +858,7 @@ $page->assertQueryStringHas('page', '2');
```
+
### assertQueryStringMissing
The `assertQueryStringMissing` method asserts that the given query string parameter is missing:
@@ -816,6 +868,7 @@ $page->assertQueryStringMissing('page');
```
+
### assertFragmentIs
The `assertFragmentIs` method asserts that the URL's current hash fragment matches the given fragment:
@@ -825,6 +878,7 @@ $page->assertFragmentIs('section-2');
```
+
### assertFragmentBeginsWith
The `assertFragmentBeginsWith` method asserts that the URL's current hash fragment begins with the given fragment:
@@ -834,6 +888,7 @@ $page->assertFragmentBeginsWith('section');
```
+
### assertFragmentIsNot
The `assertFragmentIsNot` method asserts that the URL's current hash fragment does not match the given fragment:
@@ -845,6 +900,7 @@ $page->assertFragmentIsNot('wrong-section');
## Console Assertions
+
### assertNoSmoke
The `assertNoSmoke` method asserts there are no console logs or JavaScript errors on the page:
@@ -854,6 +910,7 @@ $page->assertNoSmoke();
```
+
### assertNoConsoleLogs
The `assertNoConsoleLogs` method asserts there are no console logs on the page:
@@ -863,6 +920,7 @@ $page->assertNoConsoleLogs();
```
+
### assertNoJavaScriptErrors
The `assertNoJavaScriptErrors` method asserts there are no JavaScript errors on the page:
@@ -872,6 +930,7 @@ $page->assertNoJavaScriptErrors();
```
+
### assertNoAccessibilityIssues
The `assertNoAccessibilityIssues` method asserts there are no "serious" accessibility issues on the page:
@@ -897,6 +956,7 @@ By default, the level is 1 (serious). You can change to one of the following lev
## Screenshot Assertions
+
### assertScreenshotMatches
The `assertScreenshotMatches` method asserts that the screenshot matches the expected image:
@@ -909,6 +969,7 @@ $page->assertScreenshotMatches(true, true); // Full page, show diff
## Element Interactions
+
### click
The `click` method clicks the link with the given text:
@@ -917,13 +978,8 @@ The `click` method clicks the link with the given text:
$page->click('Login');
```
-You may also pass options:
-
-```php
-$page->click('#button', options: ['clickCount' => 2]);
-```
-
+
### text
The `text` method gets the text of the element matching the given selector:
@@ -933,6 +989,7 @@ $text = $page->text('.header');
```
+
### attribute
The `attribute` method gets the given attribute from the element matching the given selector:
@@ -942,6 +999,7 @@ $alt = $page->attribute('img', 'alt');
```
+
### keys
The `keys` method sends the given keys to the element matching the given selector:
@@ -952,6 +1010,7 @@ $page->keys('input[name=password]', ['{Control}', 'a']); // Keyboard shortcuts
```
+
### withKeyDown
The `withKeyDown` method executes the given callback while a key is held down:
@@ -966,6 +1025,7 @@ $page->withKeyDown('Shift', function () use ($page): void {
> 'a' always types a lowercase “a” and 'A' always types an uppercase “A”, regardless of modifiers.
+
### type
The `type` method types the given value in the given field:
@@ -985,6 +1045,7 @@ $page->typeSlowly('email', 'test@example.com');
```
+
### select
The `select` method selects the given value in the given field:
@@ -995,6 +1056,7 @@ $page->select('interests', ['music', 'sports']); // Multiple select
```
+
### append
The `append` method types the given value in the given field without clearing it:
@@ -1004,6 +1066,7 @@ $page->append('description', ' Additional information.');
```
+
### clear
The `clear` method clears the given field:
@@ -1013,6 +1076,7 @@ $page->clear('search');
```
+
### radio
The `radio` method selects the given value of a radio button field:
@@ -1022,6 +1086,7 @@ $page->radio('size', 'large');
```
+
### check
The `check` method checks the given checkbox:
@@ -1032,6 +1097,7 @@ $page->check('color', 'blue'); // For checkbox with specific value
```
+
### uncheck
The `uncheck` method unchecks the given checkbox:
@@ -1042,6 +1108,7 @@ $page->uncheck('color', 'red'); // For checkbox with specific value
```
+
### attach
The `attach` method attaches the given file to the field:
@@ -1051,6 +1118,7 @@ $page->attach('avatar', '/path/to/image.jpg');
```
+
### press
The `press` method presses the button with the given text or name:
@@ -1060,6 +1128,7 @@ $page->press('Submit');
```
+
### pressAndWaitFor
The `pressAndWaitFor` method presses the button with the given text or name and waits for a specified amount of time:
@@ -1069,6 +1138,7 @@ $page->pressAndWaitFor('Submit', 2); // Wait for 2 seconds
```
+
### drag
The `drag` method drags an element to another element using selectors:
@@ -1078,6 +1148,7 @@ $page->drag('#item', '#target');
```
+
### hover
The `hover` method hovers over the given element:
@@ -1087,6 +1158,7 @@ $page->hover('#item');
```
+
### submit
The `submit` method submits the first form found on the page:
@@ -1096,6 +1168,7 @@ $page->submit();
```
+
### value
The `value` method gets the value of the element matching the given selector:
@@ -1130,6 +1203,7 @@ $page->resize(1280, 720);
```
+
### script
The `script` method executes a script in the context of the page:
@@ -1139,6 +1213,7 @@ $result = $page->script('document.title');
```
+
### content
The `content` method gets the page's content:
@@ -1148,6 +1223,7 @@ $html = $page->content();
```
+
### url
The `url` method gets the page's URL:
@@ -1157,6 +1233,7 @@ $currentUrl = $page->url();
```
+
### wait
The `wait` method pauses for the given number of seconds:
@@ -1166,6 +1243,7 @@ $page->wait(2); // Wait for 2 seconds
```
+
### waitForKey
The `waitForKey` method opens the current page URL in the default web browser and waits for a key press:
@@ -1189,7 +1267,6 @@ Optionally, you can also use the `debug()` method in your test. It will limit ex
$page->debug();
```
-
You can also take a screenshot of the current page using the `screenshot()` method. This is useful for visual debugging:
@@ -1235,15 +1312,15 @@ You may refer to Pest's [Continuous Integration](https://pestphp.com/docs/contin
However, if you are using GitHub Actions, you need to add the following steps to your workflow file:
```yaml
- - uses: actions/setup-node@v4
- with:
- node-version: lts/*
+- uses: actions/setup-node@v4
+ with:
+ node-version: lts/*
- - name: Install dependencies
- run: npm ci
+- name: Install dependencies
+ run: npm ci
- - name: Install Playwright Browsers
- run: npx playwright install --with-deps
+- name: Install Playwright Browsers
+ run: npx playwright install --with-deps
```
---