output:
Chunk ID: 90b032
Wall time: 0.7354 seconds
Process exited with code 0
Original token count: 3457
Output:
 - P\Tests\Browser\Admin\AnalyticsTest::__pest_evaluable_shows_the_analytics_dashboard
 - P\Tests\Browser\Admin\AnalyticsTest::__pest_evaluable_shows_sales_data
 - P\Tests\Browser\Admin\AnalyticsTest::__pest_evaluable_shows_conversion_funnel_data
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_can_log_in_as_admin
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_shows_error_for_invalid_credentials
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_shows_error_for_empty_email
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_shows_error_for_empty_password
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_redirects_unauthenticated_users_to_login_from_dashboard
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_redirects_unauthenticated_users_to_login_from_products
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_can_log_out
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_can_navigate_through_admin_sidebar_sections
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_can_navigate_to_analytics_from_sidebar
 - P\Tests\Browser\Admin\AuthenticationTest::__pest_evaluable_can_navigate_to_themes_from_sidebar
 - P\Tests\Browser\Admin\CollectionManagementTest::__pest_evaluable_shows_the_collection_list_with_seeded_collections
 - P\Tests\Browser\Admin\CollectionManagementTest::__pest_evaluable_can_create_a_new_collection
 - P\Tests\Browser\Admin\CollectionManagementTest::__pest_evaluable_can_edit_a_collection
 - P\Tests\Browser\Admin\CustomerManagementTest::__pest_evaluable_shows_the_customer_list
 - P\Tests\Browser\Admin\CustomerManagementTest::__pest_evaluable_shows_customer_detail_with_order_history
 - P\Tests\Browser\Admin\CustomerManagementTest::__pest_evaluable_shows_customer_addresses
 - P\Tests\Browser\Admin\DiscountManagementTest::__pest_evaluable_shows_seeded_discount_codes
 - P\Tests\Browser\Admin\DiscountManagementTest::__pest_evaluable_can_create_a_new_percentage_discount_code
 - P\Tests\Browser\Admin\DiscountManagementTest::__pest_evaluable_can_create_a_fixed_amount_discount_code
 - P\Tests\Browser\Admin\DiscountManagementTest::__pest_evaluable_can_create_a_free_shipping_discount_code
 - P\Tests\Browser\Admin\DiscountManagementTest::__pest_evaluable_can_edit_a_discount
 - P\Tests\Browser\Admin\DiscountManagementTest::__pest_evaluable_shows_discount_status_indicators
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_shows_the_order_list_with_seeded_orders
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_can_filter_orders_by_status
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_shows_order_detail_with_line_items_and_totals
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_shows_order_timeline_events
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_can_create_a_fulfillment
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_can_process_a_refund
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_shows_customer_information_in_order_detail
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_can_confirm_bank_transfer_payment
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_shows_fulfillment_guard_for_unpaid_order
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_can_mark_fulfillment_as_shipped
 - P\Tests\Browser\Admin\OrderManagementTest::__pest_evaluable_can_mark_fulfillment_as_delivered
 - P\Tests\Browser\Admin\PageManagementTest::__pest_evaluable_shows_the_pages_list
 - P\Tests\Browser\Admin\PageManagementTest::__pest_evaluable_can_create_a_new_page
 - P\Tests\Browser\Admin\PageManagementTest::__pest_evaluable_can_edit_an_existing_page
 - P\Tests\Browser\Admin\ProductManagementTest::__pest_evaluable_shows_the_product_list_with_seeded_products
 - P\Tests\Browser\Admin\ProductManagementTest::__pest_evaluable_can_create_a_new_product
 - P\Tests\Browser\Admin\ProductManagementTest::__pest_evaluable_can_edit_an_existing_product_title
 - P\Tests\Browser\Admin\ProductManagementTest::__pest_evaluable_can_archive_a_product
 - P\Tests\Browser\Admin\ProductManagementTest::__pest_evaluable_shows_draft_products_only_in_admin_and_not_storefront
 - P\Tests\Browser\Admin\ProductManagementTest::__pest_evaluable_can_search_products_in_admin
 - P\Tests\Browser\Admin\ProductManagementTest::__pest_evaluable_can_filter_products_by_status_in_admin
 - P\Tests\Browser\Admin\SettingsTest::__pest_evaluable_can_view_store_settings
 - P\Tests\Browser\Admin\SettingsTest::__pest_evaluable_can_update_store_name
 - P\Tests\Browser\Admin\SettingsTest::__pest_evaluable_can_view_shipping_zones
 - P\Tests\Browser\Admin\SettingsTest::__pest_evaluable_can_add_a_new_shipping_rate_to_an_existing_zone
 - P\Tests\Browser\Admin\SettingsTest::__pest_evaluable_can_view_tax_settings
 - P\Tests\Browser\Admin\SettingsTest::__pest_evaluable_can_update_tax_inclusion_setting
 - P\Tests\Browser\Admin\SettingsTest::__pest_evaluable_can_view_domain_settings
 - P\Tests\Browser\SmokeTest::__pest_evaluable_storefront_core_pages_render_without_javascript_errors
 - P\Tests\Browser\SmokeTest::__pest_evaluable_admin_core_pages_render_for_an_authenticated_store_user
 - P\Tests\Browser\SmokeTest::__pest_evaluable_storefront_account_auth_pages_render_without_javascript_errors
 - P\Tests\Browser\SmokeTest::__pest_evaluable_storefront_home_renders_on_a_mobile_viewport
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_home_page_has_no_javascript_errors_or_console_warnings
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_home_page_has_proper_heading_hierarchy
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_product_page_has_proper_aria_labels_for_variant_selectors
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_product_page_images_or_placeholders_have_accessible_text
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_customer_login_form_has_accessible_labels
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_admin_login_form_has_accessible_labels
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_checkout_form_has_accessible_labels
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_checkout_validation_errors_are_accessible
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_can_navigate_storefront_with_keyboard_only
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_cart_page_has_no_console_errors_or_warnings
 - P\Tests\Browser\Storefront\AccessibilityTest::__pest_evaluable_search_page_has_proper_form_labels
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_featured_products_on_home_page
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_collection_with_product_grid
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_can_navigate_from_collection_to_product
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_product_detail_with_variant_options
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_size_and_color_option_values
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_sale_and_compare_at_pricing_for_sale_product
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_search_results_for_valid_query
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_no_results_message_for_invalid_query
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_does_not_show_draft_products_on_storefront_collections
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_does_not_show_draft_products_in_search_results
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_out_of_stock_messaging_for_deny_policy_product
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_backorder_messaging_for_continue_policy_product
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_new_arrivals_collection
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_shows_static_about_page
 - P\Tests\Browser\Storefront\BrowsingTest::__pest_evaluable_navigates_between_pages_using_the_main_navigation
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_add_product_to_cart
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_view_cart_with_added_item
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_update_quantity_in_cart
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_remove_item_from_cart
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_add_multiple_different_products
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_apply_valid_discount_code_welcome_ten
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_shows_error_for_invalid_discount_code
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_shows_error_for_expired_discount_code
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_shows_error_for_maxed_out_discount_code
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_apply_free_shipping_discount
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_can_apply_flat_five_discount_for_fixed_amount_off
 - P\Tests\Browser\Storefront\CartTest::__pest_evaluable_shows_subtotal_and_total_in_cart
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_completes_full_checkout_with_credit_card
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_shows_shipping_methods_based_on_german_address
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_shows_international_shipping_methods_for_non_german_address
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_applies_discount_during_checkout
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_validates_required_contact_email
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_validates_required_shipping_address_fields
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_validates_invalid_postal_code_format
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_prevents_checkout_with_empty_cart
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_completes_checkout_with_paypal
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_completes_checkout_with_bank_transfer
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_shows_error_for_declined_credit_card
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_shows_error_for_insufficient_funds
 - P\Tests\Browser\Storefront\CheckoutTest::__pest_evaluable_switches_between_payment_method_forms
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_can_register_a_new_customer
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_shows_validation_errors_for_duplicate_email_registration
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_shows_validation_errors_for_mismatched_passwords
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_can_log_in_as_existing_customer
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_shows_error_for_invalid_customer_credentials
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_redirects_unauthenticated_customers_to_login
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_shows_order_history_for_logged_in_customer
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_shows_order_detail_for_customer_order
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_can_view_addresses
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_can_add_a_new_address
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_can_edit_an_existing_address
 - P\Tests\Browser\Storefront\CustomerAccountTest::__pest_evaluable_can_log_out
 - P\Tests\Browser\Storefront\InventoryTest::__pest_evaluable_blocks_add_to_cart_for_out_of_stock_deny_policy_product
 - P\Tests\Browser\Storefront\InventoryTest::__pest_evaluable_allows_add_to_cart_for_out_of_stock_continue_policy_product
 - P\Tests\Browser\Storefront\InventoryTest::__pest_evaluable_shows_correct_stock_status_for_in_stock_product
 - P\Tests\Browser\Storefront\InventoryTest::__pest_evaluable_prevents_adding_more_than_available_stock_for_deny_policy_product
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_mobile_home_shows_hamburger_navigation_without_horizontal_overflow
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_mobile_product_detail_is_stacked_and_keeps_purchase_controls_usable
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_mobile_shoppers_can_add_a_product_to_the_cart
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_mobile_cart_keeps_checkout_available
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_mobile_checkout_reaches_shipping_methods_after_address_entry
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_tablet_admin_login_works_at_responsive_width
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_tablet_admin_sidebar_navigation_reaches_products_and_orders
 - P\Tests\Browser\Storefront\ResponsiveTest::__pest_evaluable_mobile_collection_keeps_filters_accessible
 - P\Tests\Browser\Storefront\TenantIsolationTest::__pest_evaluable_storefront_only_shows_current_store_products
 - P\Tests\Browser\Storefront\TenantIsolationTest::__pest_evaluable_storefront_collections_only_contain_current_store_products
 - P\Tests\Browser\Storefront\TenantIsolationTest::__pest_evaluable_admin_cannot_see_other_store_products_or_orders
 - P\Tests\Browser\Storefront\TenantIsolationTest::__pest_evaluable_search_only_returns_current_store_products
 - P\Tests\Browser\Storefront\TenantIsolationTest::__pest_evaluable_customer_accounts_are_scoped_to_their_store.


message: The audit found the only count mismatch left: `tests/Browser/SmokeTest.php` batches Suite 1 into 4 tests while Spec 08 defines 10 smoke tests. I’m going to split Suite 1 to the spec’s 10-test shape while preserving the broader critical-page batch in test 1.10.

phase: commentary


type: message

role: assistant

text: The audit found the only count mismatch left: `tests/Browser/SmokeTest.php` batches Suite 1 into 4 tests while Spec 08 defines 10 smoke tests. I’m going to split Suite 1 to the spec’s 10-test shape while preserving the broader critical-page batch in test 1.10.


packages: pestphp/pest laravel/framework

queries: browser testing visit multiple pages assert no javascript errors

queries: pest browser testing host visit navigation

queries: laravel browser testing authenticated session


server: laravel-boost

tool: search-docs

type: text

text:
# Search Results

## Browser Testing
Browser Testing | pestphp/pest@4.x | Source: https://github.com/pestphp/docs/blob/4.x/browser-testing.md

---
title: Browser Testing
description:
---

# Browser Testing

Browser testing is an essential part of modern web development, allowing you to ensure that your application works correctly across different browsers and devices. Pest provides a simple and elegant way to write browser tests. Here is an example of how to write a browser test using Pest:

```php
it('may welcome the user', function () {
    $page = visit('/');

    $page->assertSee('Welcome');
});
```

This is a basic example of a browser test that checks if the homepage contains the text "Welcome". However, Pest's browser testing capabilities go beyond this simple example. You can use various methods to interact with the page, such as clicking buttons, filling out forms, and navigating between pages.

Here is an example of a more complex browser test, on Laravel, that checks if a user can sign in:

```php
it('may sign in the user', function () {
    Event::fake();

    User::factory()->create([ // assumes RefreshDatabase trait is used on Pest.php...
        'email' => 'nuno@laravel.com',
        'password' => 'password',
    ]);

    $page = visit('/')->on()->mobile()->firefox();

    $page->click('Sign In')
         ->assertUrlIs('/login')
         ->assertSee('Sign In to Your Account')
         ->fill('email', 'nuno@laravel.com')
         ->fill('password', 'password')
         ->click('Submit')
         ->assertSee('Dashboard');

    $this->assertAuthenticated();

    Event::assertDispatched(UserLoggedIn::class);
});
```

Note that, you are leveraging the full power of Laravel's testing capabilities, such as refresh database, event faking, and authentication assertions, while also actually doing browser testing.

## Getting Started

To get started with browser testing in Pest, you need to install the Pest Browser plugin. You can do this by running the following command:

```bash
composer require pestphp/pest-plugin-browser --dev

npm install playwright@latest
npx playwright install
```

Finally, add `tests/Browser/Screenshots` to your `.gitignore` file to avoid committing screenshots taken during browser tests.

### Running Browser Tests

Running browser tests is similar to running regular Pest tests:

```bash
./vendor/bin/pest
```

We recommend running tests in parallel using the `--parallel` option to speed up the execution:

```bash
./vendor/bin/pest --parallel
```

For debugging purposes, you can run the tests in a headed mode and pause the execution at the end of the failed test run:

```bash
./vendor/bin/pest --debug
```

### Navigation

The `visit()` method is used to navigate to a specific URL in your browser test. It provides various methods to interact with the page:

```php
test('example', function () {
    $page = visit('/');

    $page->assertSee('Welcome');
});
```

### Using Other Browsers

By default, the `visit()` method uses Chrome as the browser. However, if you want to use a different browser, you can specify it using the `--browser` option when running the tests:

```bash
./vendor/bin/pest --browser firefox
./vendor/bin/pest --browser safari
```

If you wish to use a different browser by default without specifying it in the command line, you can set it in your `Pest.php` configuration file:

```php
pest()->browser()->inFirefox();
pest()->browser()->inSafari();
```

### Using Other Devices

The `visit()` method uses a desktop viewport. However, you can specify a mobile viewport using the `onMobile()` method. For example:

```php
$page = visit('/')->on()->mobile();
```

If you wish to use a specific device, you can use the `on()` method and chain it with the `macbook14`, `iPhone14Pro`, etc:

```php
$page = visit('/')->on()->iPhone14Pro();
```

### Using Dark Mode

Pest enforces a light color scheme by default. However, you can specify a dark color scheme using the `inDarkMode()` method:

```php
$page = visit('/')->inDarkMode();
```

### Visiting Multiple Pages

You can visit multiple pages simultaneously by passing an array of URLs to the `visit()` method. This is useful for testing scenarios where you need to interact with multiple pages at once:

```php
$pages = visit(['/', '/about']);

$pages->assertNoSmoke()
    ->assertNoAccessibilityIssues()
    ->assertNoConsoleLogs()
    ->assertNoJavaScriptErrors();

[$homePage, $aboutPage] = $pages;

$homePage->assertSee('Welcome to our website');
$aboutPage->assertSee('About Us');
```

### Navigation

After visiting a page, you can navigate to other pages using the `navigate()` method. This method allows you to navigate to a different URL while keeping the current browser context:

```php
$page = visit('/');

$page->navigate('/about')
     ->assertSee('About Us');
```

### Locating Elements

You can locate elements in the DOM using text or CSS selectors. Pest provides a simple syntax for locating elements:

```php
// Clicks the first link with the text "Login"
$page->click('Login');

// Clicks the first element with the class "btn-primary"
$page->click('.btn-primary');

// Clicks the element with the data-test attribute "login"
$page->click('@login');

// Clicks the element with the ID "submit-button"
$page->click('#submit-button');

// etc...
```

### Configuring Timeouts

Sometimes, elements may take time to appear on the page. By default, Pest waits for `5` seconds before timing out. You can configure the default timeout for browser tests in your `Pest.php` configuration file:

```php
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`

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:

```php
pest()->browser()->userAgent('CustomUserAgent');
```

### Configuring Host

By default, the server will bind to `127.0.0.1` for all browser tests.

You may wish to override the host for subdomain applications. You can configure this in the `Pest.php` configuration file:

```php
pest()->browser()->withHost('some-subdomain.localhost');
```

### 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:

```php
$page = visit('/')
     ->geolocation(39.399872, -8.224454);
```

### Configuring Locale

You can set the locale for your test requests using the `withLocale` method. This is particularly useful for testing multilingual applications.

```php
$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.

```php
$page = visit('/')->withTimezone('America/New_York');

$page->assertSee('EST');
```

### Configuring UserAgent

You can set the User-Agent header for your test requests using the `withUserAgent` method. This is useful for testing how your application responds to different types of clients, such as mobile browsers or bots.

```php
$page = visit('/')->withUserAgent('Googlebot');

$page->assertSee('Welcome, bot!');
```

### Configuring Host

You can set the host for your test server using the `withHost` method. This is useful for testing subdomains or where different hosts serve different content.

```php
$page = visit('/dashboard')->withHost('some-subdomain.localhost');

$page->assertSee('Welcome to Some Subdomain');
```

## Table of Contents

### Available Assertions

[assertTitle](#assert-title)
[assertTitleContains](#assert-title-contains)
[assertSee](#assert-see)
[assertDontSee](#assert-dont-see)
[assertSeeIn](#assert-see-in)
[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)
[assertSeeLink](#assert-see-link)
[assertDontSeeLink](#assert-dont-see-link)
[assertChecked](#assert-checked)
[assertNotChecked](#assert-not-checked)
[assertIndeterminate](#assert-indeterminate)
[assertRadioSelected](#assert-radio-selected)
[assertRadioNotSelected](#assert-radio-not-selected)
[assertSelected](#assert-selected)
[assertNotSelected](#assert-not-selected)
[assertValue](#assert-value)
[assertValueIsNot](#assert-value-is-not)
[assertAttribute](#assert-attribute)
[assertAttributeMissing](#assert-attribute-missing)
[assertAttributeContains](#assert-attribute-contains)
[assertAttributeDoesntContain](#assert-attribute-doesnt-contain)
[assertAriaAttribute](#assert-aria-attribute)
[assertDataAttribute](#assert-data-attribute)
[assertVisible](#assert-visible)
[assertPresent](#assert-present)
[assertNotPresent](#assert-not-present)
[assertMissing](#assert-missing)
[assertEnabled](#assert-enabled)
[assertDisabled](#assert-disabled)
[assertButtonEnabled](#assert-button-enabled)
[assertButtonDisabled](#assert-button-disabled)
[assertUrlIs](#assert-url-is)
[assertSchemeIs](#assert-scheme-is)
[assertSchemeIsNot](#assert-scheme-is-not)
[assertHostIs](#assert-host-is)
[assertHostIsNot](#assert-host-is-not)
[assertPortIs](#assert-port-is)
[assertPortIsNot](#assert-port-is-not)
[assertPathBeginsWith](#assert-path-begins-with)
[assertPathEndsWith](#assert-path-ends-with)
[assertPathContains](#assert-path-contains)
[assertPathIs](#assert-path-is)
[assertPathIsNot](#assert-path-is-not)
[assertQueryStringHas](#assert-query-string-has)
[assertQueryStringMissing](#assert-query-string-missing)
[assertFragmentIs](#assert-fragment-is)
[assertFragmentBeginsWith](#assert-fragment-begins-with)
[assertFragmentIsNot](#assert-fragment-is-not)
[assertNoSmoke](#assert-no-smoke)
[assertNoConsoleLogs](#assert-no-console-logs)
[assertNoJavaScriptErrors](#assert-no-javascript-errors)
[assertNoAccessibilityIssues](#assert-no-accessibility-issues)
[assertScreenshotMatches](#assert-screenshot-matches)

### Element Interactions

[click](#click)
[text](#text)
[attribute](#attribute)
[keys](#keys)
[withKeyDown](#withKeyDown)
[type](#type)
[typeSlowly](#type-slowly)
[select](#select)
[append](#append)
[clear](#clear)
[radio](#radio)
[check](#check)
[uncheck](#uncheck)
[attach](#attach)
[press](#press)
[pressAndWaitFor](#press-and-wait-for)
[drag](#drag)
[hover](#hover)
[submit](#submit)
[value](#value)
[withinIframe](#within-iframe)
[resize](#resize)
[script](#script)
[content](#content)
[url](#url)
[wait](#wait)
[waitForKey](#wait-for-key)

### Debugging tests

[debug](#debug)
[screenshot](#screenshot)
[screenshotElement](#screenshot-element)
[tinker](#tinker)
[headed](#headed)

## Element Assertions

---

## Dusk Browser Basics Authentication
Dusk | laravel/framework@12.x | Source: https://github.com/laravel/docs/blob/12.x/dusk.md

### Authentication

Often, you will be testing pages that require authentication. You can use Dusk's `loginAs` method in order to avoid interacting with your application's login screen during every test. The `loginAs` method accepts a primary key associated with your authenticatable model or an authenticatable model instance:

```php
use App\Models\User;
use Laravel\Dusk\Browser;

$this->browse(function (Browser $browser) {
    $browser->loginAs(User::find(1))
        ->visit('/home');
});
```

> [!WARNING]
> After using the `loginAs` method, the user session will be maintained for all tests within the file.

---

## Pest V4 Is Here Now With Browser Testing
Pest V4 Is Here Now With Browser Testing | pestphp/pest@4.x | Source: https://github.com/pestphp/docs/blob/4.x/pest-v4-is-here-now-with-browser-testing.md

---
title: Pest v4 Is Here — Now with Browser Testing
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.
---

> To get started with Pest v4's new features including browser testing, please refer to the upgrade guide: [Upgrade Guide →](/docs/upgrade-guide).

- [Browser Testing](#content-pest-v4-is-here-now-with-browser-testing)
- [Smoke Testing](#content-smoke-testing)
- [Visual Regression Testing](#content-visual-regression-testing)
- [Test Sharding](#content-test-sharding)
- [Type Coverage Is Much Faster](#content-type-coverage-is-much-faster)
- [Profanity Checking](#content-profanity-checking)
- [On Top of PHPUnit 12](#content-on-top-of-phpunit-12)

# Pest v4 Is Here — Now with Browser Testing

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.

Here is the creator of Pest, [Nuno Maduro](https://twitter.com/enunomaduro), demoing the new browser testing features in Pest v4 at Laracon US:

[![Pest v4](/assets/pest4_play.png)](https://youtu.be/f5gAgwwwwOI?si=LtPpySZe3tf8qMjz&t=52)

Here is an example of Browser Testing using [Laravel](https://laravel.com):

```php
it('may reset the password', function () {
    // access any laravel testing helpers...
    Notification::fake();

    // access to the database — using the RefreshDatabase trait (even sqlite in memory...)
    $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')
         ->click('Forgot Password?')
         ->type('email', 'nuno@laravel.com')
         ->press('Send Reset Link')
         ->assertSee('We have emailed your password reset link!')
         ->assertNoJavascriptErrors(); // or ->assertNoConsoleLogs()

    Notification::assertSent(ResetPassword::class);
});
```

With Pest v4's browser testing, you can:
- Seamlessly use **Laravel features** like `Event::fake()`, `assertAuthenticated()`, and model factories
- Use `RefreshDatabase`, even with SQLite in-memory databases, 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.)
- Run **parallel browser tests** for dramatically faster suites
- Take **screenshots** or pause tests for debugging
- …all with the elegance of Pest syntax
- **Playwright-based** — modern, fast, and reliable

To get started with browser testing in Pest, you need to install the Pest Browser Plugin:

```bash
composer require pestphp/pest-plugin-browser --dev

npm install playwright@latest
npx playwright install
```

After, you may use the `visit()` function anywhere. Finally, running this test is as simple as executing `./vendor/bin/pest` in your terminal. Pest will handle the rest, launching a browser, navigating to the page, and performing the actions you specified.

## Smoke Testing

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.

```php
$routes = ['/', '/about', '/contact'];

visit($routes)->assertNoSmoke();

// assertNoSmoke() is a shorthand for:
// - assertNoJavascriptErrors()
// - assertNoConsoleLogs()
```

## Visual Regression Testing

Want to ensure your pages look exactly as expected over time? Pest v4 introduces visual regression testing with the `assertScreenshotMatches()` assertion. This allows you to take screenshots of your pages and compare them against baseline images, ensuring that your UI remains consistent across changes.

```php
$pages = visit(['/', '/about', '/contact']);

$pages->assertScreenshotMatches();
```

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.

## Test Sharding

Pest v4 introduces **Test Sharding**, allowing you to split your test suite into smaller, manageable chunks. This is particularly useful for large applications (or when running browser tests) where running all tests at once can be time-consuming.

This feature is particularly useful on CI platforms, where on things like GitHub actions you can no longer scale vertical, but rather horizontally. This means you can run your tests in parallel across multiple machines, significantly speeding up your test suite execution.

To get started with Test Sharding, you can use the `--shard` option when running Pest:

```bash
# GitHub Workflow One
./vendor/bin/pest --shard=1/4

# GitHub Workflow Two
./vendor/bin/pest --shard=2/4

# GitHub Workflow Three
./vendor/bin/pest --shard=3/4

# GitHub Workflow Four
./vendor/bin/pest --shard=4/4
```

You may combine this with the `--parallel` option to run your tests in parallel, and this way trully maximize your test suite execution speed:

```bash
./vendor/bin/pest --shard=1/4 --parallel
```

Finally, to easily set up sharding your CI configuration, you just have to ensure each job in your CI configuration runs a different shard of your test suite. For example, in GitHub Actions, you can use the `matrix` strategy to define multiple jobs that run different shards:

```yaml
strategy:
  matrix:
    shard: [1, 2, 3, 4]

name: Tests (Shard ${{ matrix.shard }}/4)

steps:
  - name: Run tests
    run: pest --parallel --shard ${{ matrix.shard }}/4
```

## Type Coverage Is Much Faster

Remember the days when you had to wait for your type coverage to run? Not anymore! Pest v4 introduces a new type coverage engine that is significantly faster than previous versions.

Type coverage is 2x faster on the first run and instant on subsequent runs. This means you can quickly check your type coverage without waiting for long periods, making your development workflow much more efficient.

In addition, Type Coverage now supports **Sharding**. This means you can run type coverage with the `--shard` option, just like you do with your tests.

## Profanity Checking

Pest v4 introduces a new feature that allows you to check for profanity in your test code. This is particularly useful for maintaining a clean and professional codebase, especially in collaborative environments.

You can enable profanity checking by adding the `--profanity` option when running Pest:

```bash
./vendor/bin/pest --profanity
```

To start using Pest's Profanity plugin, you need to require the plugin via Composer.

```bash
composer require pestphp/pest-plugin-profanity --dev
```

After requiring the plugin, you may utilize the `--profanity` option to generate a report of your profanity.

```bash
./vendor/bin/pest --profanity
```

If any of your files contain profanity, they will be highlighted in red and displayed using their respective line
numbers and the profane word(s) that have been found.

As an example, `pr31(f*ck)` means that the word "fuck" was found on line 31.

To learn more about the Profanity plugin and how to configure it, check out the [Profanity documentation](/docs/profanity).

### Skip Locally or On CI

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.

```php
it('does not run locally', function () {
    // This test will be skipped when running locally
})->skipLocally();

it('does not run on CI', function () {
    // This test will be skipped when running on a CI server
})->skipOnCi();
```

### Miscellaneous Improvements

- You may now use `skipLocally()` or `skipOnCi` to conditionally skip tests based on the environment.
- 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. This expectation requires the `intl` PHP extension.
- The expectation `toBeSlug` has been added to help you validate that a string is a valid slug.

### On Top of PHPUnit 12

Pest v4 is built on top of PHPUnit 12, which means you get all the latest features and improvements from PHPUnit. As such, be sure to check out the [PHPUnit 12 release announcement](https://phpunit.de/announcements/phpunit-12.html).

### Thanks To You, Pest v4 Is Here!

There's never been a better time to dive into testing and start using Pest. If you're ready to get started with Pest v4 right away, check out our [installation guide](/docs/installation) for step-by-step instructions. And if you're currently using an earlier version of Pest, we've got you covered with detailed upgrade instructions in our [upgrade guide](/docs/upgrade-guide).

Thank you for your continued support and feedback. We can't wait to see what you build with Pest v4!

---

Thank you for reading about Pest v4's new features! Want to get started with Pest? You can find the installation guide in the next section of the documentation: [Installation →](/docs/installation)

_[Truncated]_


output:
Wall time: 3.4171 seconds
Output:
[{"type":"text","text":"# Search Results\n\n## Browser Testing\nBrowser Testing | pestphp/pest@4.x | Source: https://github.com/pestphp/docs/blob/4.x/browser-testing.md\n\n---\ntitle: Browser Testing\ndescription:\n---\n\n# Browser Testing\n\nBrowser testing is an essential part of modern web development, allowing you to ensure that your application works correctly across different browsers and devices. Pest provides a simple and elegant way to write browser tests. Here is an example of how to write a browser test using Pest:\n\n```php\nit('may welcome the user', function () {\n    $page = visit('/');\n\n    $page->assertSee('Welcome');\n});\n```\n\nThis is a basic example of a browser test that checks if the homepage contains the text \"Welcome\". However, Pest's browser testing capabilities go beyond this simple example. You can use various methods to interact with the page, such as clicking buttons, filling out forms, and navigating between pages.\n\nHere is an example of a more complex browser test, on Laravel, that checks if a user can sign in:\n\n```php\nit('may sign in the user', function () {\n    Event::fake();\n\n    User::factory()->create([ // assumes RefreshDatabase trait is used on Pest.php...\n        'email' => 'nuno@laravel.com',\n        'password' => 'password',\n    ]);\n\n    $page = visit('/')->on()->mobile()->firefox();\n\n    $page->click('Sign In')\n         ->assertUrlIs('/login')\n         ->assertSee('Sign In to Your Account')\n         ->fill('email', 'nuno@laravel.com')\n         ->fill('password', 'password')\n         ->click('Submit')\n         ->assertSee('Dashboard');\n\n    $this->assertAuthenticated();\n\n    Event::assertDispatched(UserLoggedIn::class);\n});\n```\n\nNote that, you are leveraging the full power of Laravel's testing capabilities, such as refresh database, event faking, and authentication assertions, while also actually doing browser testing.\n\n## Getting Started\n\nTo get started with browser testing in Pest, you need to install the Pest Browser plugin. You can do this by running the following command:\n\n```bash\ncomposer require pestphp/pest-plugin-browser --dev\n\nnpm install playwright@latest\nnpx playwright install\n```\n\nFinally, add `tests/Browser/Screenshots` to your `.gitignore` file to avoid committing screenshots taken during browser tests.\n\n### Running Browser Tests\n\nRunning browser tests is similar to running regular Pest tests:\n\n```bash\n./vendor/bin/pest\n```\n\nWe recommend running tests in parallel using the `--parallel` option to speed up the execution:\n\n```bash\n./vendor/bin/pest --parallel\n```\n\nFor debugging purposes, you can run the tests in a headed mode and pause the execution at the end of the failed test run:\n\n```bash\n./vendor/bin/pest --debug\n```\n\n### Navigation\n\nThe `visit()` method is used to navigate to a specific URL in your browser test. It provides various methods to interact with the page:\n\n```php\ntest('example', function () {\n    $page = visit('/');\n\n    $page->assertSee('Welcome');\n});\n```\n\n### Using Other Browsers\n\nBy default, the `visit()` method uses Chrome as the browser. However, if you want to use a different browser, you can specify it using the `--browser` option when running the tests:\n\n```bash\n./vendor/bin/pest --browser firefox\n./vendor/bin/pest --browser safari\n```\n\nIf you wish to use a different browser by default without specifying it in the command line, you can set it in your `Pest.php` configuration file:\n\n```php\npest()->browser()->inFirefox();\npest()->browser()->inSafari();\n```\n\n### Using Other Devices\n\nThe `visit()` method uses a desktop viewport. However, you can specify a mobile viewport using the `onMobile()` method. For example:\n\n```php\n$page = visit('/')->on()->mobile();\n```\n\nIf you wish to use a specific device, you can use the `on()` method and chain it with the `macbook14`, `iPhone14Pro`, etc:\n\n```php\n$page = visit('/')->on()->iPhone14Pro();\n```\n\n### Using Dark Mode\n\nPest enforces a light color scheme by default. However, you can specify a dark color scheme using the `inDarkMode()` method:\n\n```php\n$page = visit('/')->inDarkMode();\n```\n\n### Visiting Multiple Pages\n\nYou can visit multiple pages simultaneously by passing an array of URLs to the `visit()` method. This is useful for testing scenarios where you need to interact with multiple pages at once:\n\n```php\n$pages = visit(['/', '/about']);\n\n$pages->assertNoSmoke()\n    ->assertNoAccessibilityIssues()\n    ->assertNoConsoleLogs()\n    ->assertNoJavaScriptErrors();\n\n[$homePage, $aboutPage] = $pages;\n\n$homePage->assertSee('Welcome to our website');\n$aboutPage->assertSee('About Us');\n```\n\n### Navigation\n\nAfter visiting a page, you can navigate to other pages using the `navigate()` method. This method allows you to navigate to a different URL while keeping the current browser context:\n\n```php\n$page = visit('/');\n\n$page->navigate('/about')\n     ->assertSee('About Us');\n```\n\n### Locating Elements\n\nYou can locate elements in the DOM using text or CSS selectors. Pest provides a simple syntax for locating elements:\n\n```php\n// Clicks the first link with the text \"Login\"\n$page->click('Login');\n\n// Clicks the first element with the class \"btn-primary\"\n$page->click('.btn-primary');\n\n// Clicks the element with the data-test attribute \"login\"\n$page->click('@login');\n\n// Clicks the element with the ID \"submit-button\"\n$page->click('#submit-button');\n\n// etc...\n```\n\n### Configuring Timeouts\n\nSometimes, elements may take time to appear on the page. By default, Pest waits for `5` seconds before timing out. You can configure the default timeout for browser tests in your `Pest.php` configuration file:\n\n```php\npest()->browser()->timeout(10000);\n```\n\n### Configuring User Agent\n\nBy 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` \n\nYou 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:\n\n```php\npest()->browser()->userAgent('CustomUserAgent');\n```\n\n### Configuring Host\n\nBy default, the server will bind to `127.0.0.1` for all browser tests.\n\nYou may wish to override the host for subdomain applications. You can configure this in the `Pest.php` configuration file:\n\n```php\npest()->browser()->withHost('some-subdomain.localhost');\n```\n\n### Geolocation\n\nSometimes, 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:\n\n```php\n$page = visit('/')\n     ->geolocation(39.399872, -8.224454);\n```\n\n### Configuring Locale\n\nYou can set the locale for your test requests using the `withLocale` method. This is particularly useful for testing multilingual applications.\n\n```php\n$page = visit('/')->withLocale('fr-FR');\n\n$page->assertSee('Bienvenue');\n```\n### Configuring Timezone\n\nYou 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.\n\n```php\n$page = visit('/')->withTimezone('America/New_York');\n\n$page->assertSee('EST');\n```\n\n### Configuring UserAgent\n\nYou can set the User-Agent header for your test requests using the `withUserAgent` method. This is useful for testing how your application responds to different types of clients, such as mobile browsers or bots.\n\n```php\n$page = visit('/')->withUserAgent('Googlebot');\n\n$page->assertSee('Welcome, bot!');\n```\n\n### Configuring Host\n\nYou can set the host for your test server using the `withHost` method. This is useful for testing subdomains or where different hosts serve different content.\n\n```php\n$page = visit('/dashboard')->withHost('some-subdomain.localhost');\n\n$page->assertSee('Welcome to Some Subdomain');\n```\n\n## Table of Contents\n\n### Available Assertions\n\n
\n\n[assertTitle](#assert-title)\n[assertTitleContains](#assert-title-contains)\n[assertSee](#assert-see)\n[assertDontSee](#assert-dont-see)\n[assertSeeIn](#assert-see-in)\n[assertDontSeeIn](#assert-dont-see-in)\n[assertSeeAnythingIn](#assert-see-anything-in)\n[assertSeeNothingIn](#assert-see-nothing-in)\n[assertCount](#assert-count)\n[assertScript](#assert-script)\n[assertSourceHas](#assert-source-has)\n[assertSourceMissing](#assert-source-missing)\n[assertSeeLink](#assert-see-link)\n[assertDontSeeLink](#assert-dont-see-link)\n[assertChecked](#assert-checked)\n[assertNotChecked](#assert-not-checked)\n[assertIndeterminate](#assert-indeterminate)\n[assertRadioSelected](#assert-radio-selected)\n[assertRadioNotSelected](#assert-radio-not-selected)\n[assertSelected](#assert-selected)\n[assertNotSelected](#assert-not-selected)\n[assertValue](#assert-value)\n[assertValueIsNot](#assert-value-is-not)\n[assertAttribute](#assert-attribute)\n[assertAttributeMissing](#assert-attribute-missing)\n[assertAttributeContains](#assert-attribute-contains)\n[assertAttributeDoesntContain](#assert-attribute-doesnt-contain)\n[assertAriaAttribute](#assert-aria-attribute)\n[assertDataAttribute](#assert-data-attribute)\n[assertVisible](#assert-visible)\n[assertPresent](#assert-present)\n[assertNotPresent](#assert-not-present)\n[assertMissing](#assert-missing)\n[assertEnabled](#assert-enabled)\n[assertDisabled](#assert-disabled)\n[assertButtonEnabled](#assert-button-enabled)\n[assertButtonDisabled](#assert-button-disabled)\n[assertUrlIs](#assert-url-is)\n[assertSchemeIs](#assert-scheme-is)\n[assertSchemeIsNot](#assert-scheme-is-not)\n[assertHostIs](#assert-host-is)\n[assertHostIsNot](#assert-host-is-not)\n[assertPortIs](#assert-port-is)\n[assertPortIsNot](#assert-port-is-not)\n[assertPathBeginsWith](#assert-path-begins-with)\n[assertPathEndsWith](#assert-path-ends-with)\n[assertPathContains](#assert-path-contains)\n[assertPathIs](#assert-path-is)\n[assertPathIsNot](#assert-path-is-not)\n[assertQueryStringHas](#assert-query-string-has)\n[assertQueryStringMissing](#assert-query-string-missing)\n[assertFragmentIs](#assert-fragment-is)\n[assertFragmentBeginsWith](#assert-fragment-begins-with)\n[assertFragmentIsNot](#assert-fragment-is-not)\n[assertNoSmoke](#assert-no-smoke)\n[assertNoConsoleLogs](#assert-no-console-logs)\n[assertNoJavaScriptErrors](#assert-no-javascript-errors)\n[assertNoAccessibilityIssues](#assert-no-accessibility-issues)\n[assertScreenshotMatches](#assert-screenshot-matches)\n\n
\n\n### Element Interactions\n\n
\n\n[click](#click)\n[text](#text)\n[attribute](#attribute)\n[keys](#keys)\n[withKeyDown](#withKeyDown)\n[type](#type)\n[typeSlowly](#type-slowly)\n[select](#select)\n[append](#append)\n[clear](#clear)\n[radio](#radio)\n[check](#check)\n[uncheck](#uncheck)\n[attach](#attach)\n[press](#press)\n[pressAndWaitFor](#press-and-wait-for)\n[drag](#drag)\n[hover](#hover)\n[submit](#submit)\n[value](#value)\n[withinIframe](#within-iframe)\n[resize](#resize)\n[script](#script)\n[content](#content)\n[url](#url)\n[wait](#wait)\n[waitForKey](#wait-for-key)\n\n
\n\n### Debugging tests\n\n
\n\n[debug](#debug)\n[screenshot](#screenshot)\n[screenshotElement](#screenshot-element)\n[tinker](#tinker)\n[headed](#headed)\n\n
\n\n## Element Assertions\n\n---\n\n## Dusk Browser Basics Authentication\nDusk | laravel/framework@12.x | Source: https://github.com/laravel/docs/blob/12.x/dusk.md\n\n\n### Authentication\n\nOften, you will be testing pages that require authentication. You can use Dusk's `loginAs` method in order to avoid interacting with your application's login screen during every test. The `loginAs` method accepts a primary key associated with your authenticatable model or an authenticatable model instance:\n\n```php\nuse App\\Models\\User;\nuse Laravel\\Dusk\\Browser;\n\n$this->browse(function (Browser $browser) {\n    $browser->loginAs(User::find(1))\n        ->visit('/home');\n});\n```\n\n> [!WARNING]\n> After using the `loginAs` method, the user session will be maintained for all tests within the file.\n\n---\n\n## Pest V4 Is Here Now With Browser Testing\nPest V4 Is Here Now With Browser Testing | pestphp/pest@4.x | Source: https://github.com/pestphp/docs/blob/4.x/pest-v4-is-here-now-with-browser-testing.md\n\n---\ntitle: Pest v4 Is Here — Now with Browser Testing\ndescription: Today, we're thrilled to announce Pest v4 — our biggest release yet, featuring powerful new browser testing with parallel support and full Laravel integration.\n---\n\n> To get started with Pest v4's new features including browser testing, please refer to the upgrade guide: [Upgrade Guide →](/docs/upgrade-guide).\n\n- [Browser Testing](#content-pest-v4-is-here-now-with-browser-testing)\n- [Smoke Testing](#content-smoke-testing)\n- [Visual Regression Testing](#content-visual-regression-testing)\n- [Test Sharding](#content-test-sharding)\n- [Type Coverage Is Much Faster](#content-type-coverage-is-much-faster)\n- [Profanity Checking](#content-profanity-checking)\n- [On Top of PHPUnit 12](#content-on-top-of-phpunit-12)\n\n# Pest v4 Is Here — Now with Browser Testing\n\nToday, 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.\n\nHere is the creator of Pest, [Nuno Maduro](https://twitter.com/enunomaduro), demoing the new browser testing features in Pest v4 at Laracon US:\n\n[![Pest v4](/assets/pest4_play.png)](https://youtu.be/f5gAgwwwwOI?si=LtPpySZe3tf8qMjz&t=52)\n\nHere is an example of Browser Testing using [Laravel](https://laravel.com):\n\n```php\nit('may reset the password', function () {\n    // access any laravel testing helpers...\n    Notification::fake();\n\n    // access to the database — using the RefreshDatabase trait (even sqlite in memory...)\n    $this->actingAs(User::factory()->create());\n\n    $page = visit('/sign-in') // visit on a real browser...\n        ->on()->mobile() // or ->desktop(), ->tablet(), etc...\n        ->inDarkMode(); // or ->inLightMode()\n\n    $page->assertSee('Sign In')\n         ->click('Forgot Password?')\n         ->type('email', 'nuno@laravel.com')\n         ->press('Send Reset Link')\n         ->assertSee('We have emailed your password reset link!')\n         ->assertNoJavascriptErrors(); // or ->assertNoConsoleLogs()\n\n    Notification::assertSent(ResetPassword::class);\n});\n```\n\nWith Pest v4's browser testing, you can:\n- Seamlessly use **Laravel features** like `Event::fake()`, `assertAuthenticated()`, and model factories\n- Use `RefreshDatabase`, even with SQLite in-memory databases, to ensure a clean state for each test\n- Test on **multiple browsers** (Chrome, Firefox, Safari)\n- Test on **different devices** and viewports (like iPhone 14 Pro, tablets, or custom breakpoints)\n- Switch **color schemes** (light/dark mode)\n- Interact with the page (click, type, scroll, select, submit, drag-and-drop, touch gestures, etc.)\n- Run **parallel browser tests** for dramatically faster suites\n- Take **screenshots** or pause tests for debugging\n- …all with the elegance of Pest syntax\n- **Playwright-based** — modern, fast, and reliable\n\nTo get started with browser testing in Pest, you need to install the Pest Browser Plugin:\n\n```bash\ncomposer require pestphp/pest-plugin-browser --dev\n\nnpm install playwright@latest\nnpx playwright install\n```\n\nAfter, you may use the `visit()` function anywhere. Finally, running this test is as simple as executing `./vendor/bin/pest` in your terminal. Pest will handle the rest, launching a browser, navigating to the page, and performing the actions you specified.\n\n## Smoke Testing\n\nSmoke 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.\n\n```php\n$routes = ['/', '/about', '/contact'];\n\nvisit($routes)->assertNoSmoke();\n\n// assertNoSmoke() is a shorthand for:\n// - assertNoJavascriptErrors()\n// - assertNoConsoleLogs()\n```\n\n## Visual Regression Testing\n\nWant to ensure your pages look exactly as expected over time? Pest v4 introduces visual regression testing with the `assertScreenshotMatches()` assertion. This allows you to take screenshots of your pages and compare them against baseline images, ensuring that your UI remains consistent across changes.\n\n```php\n$pages = visit(['/', '/about', '/contact']);\n\n$pages->assertScreenshotMatches();\n```\n\nThis 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.\n\n## Test Sharding\n\nPest v4 introduces **Test Sharding**, allowing you to split your test suite into smaller, manageable chunks. This is particularly useful for large applications (or when running browser tests) where running all tests at once can be time-consuming.\n\nThis feature is particularly useful on CI platforms, where on things like GitHub actions you can no longer scale vertical, but rather horizontally. This means you can run your tests in parallel across multiple machines, significantly speeding up your test suite execution.\n\nTo get started with Test Sharding, you can use the `--shard` option when running Pest:\n\n```bash\n# GitHub Workflow One\n./vendor/bin/pest --shard=1/4\n\n# GitHub Workflow Two\n./vendor/bin/pest --shard=2/4\n\n# GitHub Workflow Three\n./vendor/bin/pest --shard=3/4\n\n# GitHub Workflow Four\n./vendor/bin/pest --shard=4/4\n```\n\nYou may combine this with the `--parallel` option to run your tests in parallel, and this way trully maximize your test suite execution speed:\n\n```bash\n./vendor/bin/pest --shard=1/4 --parallel\n```\n\nFinally, to easily set up sharding your CI configuration, you just have to ensure each job in your CI configuration runs a different shard of your test suite. For example, in GitHub Actions, you can use the `matrix` strategy to define multiple jobs that run different shards:\n\n```yaml\nstrategy:\n  matrix:\n    shard: [1, 2, 3, 4]\n\nname: Tests (Shard ${{ matrix.shard }}/4)\n\nsteps:\n  - name: Run tests\n    run: pest --parallel --shard ${{ matrix.shard }}/4\n```\n\n## Type Coverage Is Much Faster\n\nRemember the days when you had to wait for your type coverage to run? Not anymore! Pest v4 introduces a new type coverage engine that is significantly faster than previous versions.\n\nType coverage is 2x faster on the first run and instant on subsequent runs. This means you can quickly check your type coverage without waiting for long periods, making your development workflow much more efficient.\n\nIn addition, Type Coverage now supports **Sharding**. This means you can run type coverage with the `--shard` option, just like you do with your tests.\n\n## Profanity Checking\n\nPest v4 introduces a new feature that allows you to check for profanity in your test code. This is particularly useful for maintaining a clean and professional codebase, especially in collaborative environments.\n\nYou can enable profanity checking by adding the `--profanity` option when running Pest:\n\n```bash\n./vendor/bin/pest --profanity\n```\n\nTo start using Pest's Profanity plugin, you need to require the plugin via Composer.\n\n```bash\ncomposer require pestphp/pest-plugin-profanity --dev\n```\n\nAfter requiring the plugin, you may utilize the `--profanity` option to generate a report of your profanity.\n\n```bash\n./vendor/bin/pest --profanity\n```\n\n\n\nIf any of your files contain profanity, they will be highlighted in red and displayed using their respective line\nnumbers and the profane word(s) that have been found.\n\nAs an example, `pr31(f*ck)` means that the word \"fuck\" was found on line 31.\n\nTo learn more about the Profanity plugin and how to configure it, check out the [Profanity documentation](/docs/profanity).\n\n### Skip Locally or On CI\n\nPest 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.\n\n```php\nit('does not run locally', function () {\n    // This test will be skipped when running locally\n})->skipLocally();\n\nit('does not run on CI', function () {\n    // This test will be skipped when running on a CI server\n})->skipOnCi();\n```\n\n### Miscellaneous Improvements\n\n- You may now use `skipLocally()` or `skipOnCi` to conditionally skip tests based on the environment.\n- 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. This expectation requires the `intl` PHP extension.\n- The expectation `toBeSlug` has been added to help you validate that a string is a valid slug.\n\n### On Top of PHPUnit 12\n\nPest v4 is built on top of PHPUnit 12, which means you get all the latest features and improvements from PHPUnit. As such, be sure to check out the [PHPUnit 12 release announcement](https://phpunit.de/announcements/phpunit-12.html).\n\n### Thanks To You, Pest v4 Is Here!\n\nThere's never been a better time to dive into testing and start using Pest. If you're ready to get started with Pest v4 right away, check out our [installation guide](/docs/installation) for step-by-step instructions. And if you're currently using an earlier version of Pest, we've got you covered with detailed upgrade instructions in our [upgrade guide](/docs/upgrade-guide).\n\nThank you for your continued support and feedback. We can't wait to see what you build with Pest v4!\n\n---\n\nThank you for reading about Pest v4's new features! Want to get started with Pest? You can find the installation guide in the next section of the documentation: [Installation →](/docs/installation)\n\n\n\n_[Truncated]_"}]


cmd: sed -n '1,90p' tests/Browser/Admin/AuthenticationTest.php && rg -n "Admin" resources/views/livewire/admin/auth resources/views -S | head -n 40


command: sed -n '1,90p' tests/Browser/Admin/AuthenticationTest.php && rg -n "Admin" resources/views/livewire/admin/auth resources/views -S | head -n 40

AuthenticationTest.php

type: read

type: search

cmd: rg -n Admin resources/views/livewire/admin/auth resources/views -S

query: Admin

path: auth

aggregated_output:
<?php

use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

beforeEach(function (): void {
    $this->seed(DatabaseSeeder::class);
});

function adminAuthenticationHost(): array
{
    return ['host' => 'shop.test'];
}

function adminAuthenticationLogin(): mixed
{
    return visit('/admin/login', adminAuthenticationHost())
        ->fill('input[type=email]', 'admin@acme.test')
        ->fill('input[type=password]', 'password')
        ->click('@admin-login-button')
        ->wait(1)
        ->assertPathIs('/admin')
        ->assertSee('Dashboard')
        ->assertNoJavaScriptErrors();
}

function adminAuthenticationSubmitWithoutBrowserRequired(string $email, string $password): mixed
{
    $page = visit('/admin/login', adminAuthenticationHost());

    $page->script('() => document.querySelectorAll("[required]").forEach((element) => element.removeAttribute("required"))');

    if ($email !== '') {
        $page->fill('input[type=email]', $email);
    }

    if ($password !== '') {
        $page->fill('input[type=password]', $password);
    }

    return $page->click('@admin-login-button')->wait(1);
}

test('can log in as admin', function (): void {
    adminAuthenticationLogin();
});

test('shows error for invalid credentials', function (): void {
    visit('/admin/login', adminAuthenticationHost())
        ->fill('input[type=email]', 'admin@acme.test')
        ->fill('input[type=password]', 'wrongpassword')
        ->click('@admin-login-button')
        ->wait(1)
        ->assertPathIs('/admin/login')
        ->assertSee('Invalid credentials')
        ->assertNoJavaScriptErrors();
});

test('shows error for empty email', function (): void {
    adminAuthenticationSubmitWithoutBrowserRequired('', 'password')
        ->assertPathIs('/admin/login')
        ->assertSee('email field is required')
        ->assertNoJavaScriptErrors();
});

test('shows error for empty password', function (): void {
    adminAuthenticationSubmitWithoutBrowserRequired('admin@acme.test', '')
        ->assertPathIs('/admin/login')
        ->assertSee('password field is required')
        ->assertNoJavaScriptErrors();
});

test('redirects unauthenticated users to login from dashboard', function (): void {
    visit('/admin', adminAuthenticationHost())
        ->wait(1)
        ->assertPathIs('/admin/login')
        ->assertSee('Sign in')
        ->assertNoJavaScriptErrors();
});

test('redirects unauthenticated users to login from products', function (): void {
    visit('/admin/products', adminAuthenticationHost())
        ->wait(1)
        ->assertPathIs('/admin/login')
        ->assertSee('Sign in')
        ->assertNoJavaScriptErrors();
});

resources/views/livewire/admin/settings/notifications.blade.php:55:                    <flux:heading size="lg">Admin alerts</flux:heading>
resources/views/livewire/admin/settings/index.blade.php:100:                    <flux:select.option value="admin">Admin</flux:select.option>

status: completed


output:
Chunk ID: 2d2705
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 753
Output:
<?php

use Database\Seeders\DatabaseSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;

uses(RefreshDatabase::class);

beforeEach(function (): void {
    $this->seed(DatabaseSeeder::class);
});

function adminAuthenticationHost(): array
{
    return ['host' => 'shop.test'];
}

function adminAuthenticationLogin(): mixed
{
    return visit('/admin/login', adminAuthenticationHost())
        ->fill('input[type=email]', 'admin@acme.test')
        ->fill('input[type=password]', 'password')
        ->click('@admin-login-button')
        ->wait(1)
        ->assertPathIs('/admin')
        ->assertSee('Dashboard')
        ->assertNoJavaScriptErrors();
}

function adminAuthenticationSubmitWithoutBrowserRequired(string $email, string $password): mixed
{
    $page = visit('/admin/login', adminAuthenticationHost());

    $page->script('() => document.querySelectorAll("[required]").forEach((element) => element.removeAttribute("required"))');

    if ($email !== '') {
        $page->fill('input[type=email]', $email);
    }

    if ($password !== '') {
        $page->fill('input[type=password]', $password);
    }

    return $page->click('@admin-login-button')->wait(1);
}

test('can log in as admin', function (): void {
    adminAuthenticationLogin();
});

test('shows error for invalid credentials', function (): void {
    visit('/admin/login', adminAuthenticationHost())
        ->fill('input[type=email]', 'admin@acme.test')
        ->fill('input[type=password]', 'wrongpassword')
        ->click('@admin-login-button')
        ->wait(1)
        ->assertPathIs('/admin/login')
        ->assertSee('Invalid credentials')
        ->assertNoJavaScriptErrors();
});

test('shows error for empty email', function (): void {
    adminAuthenticationSubmitWithoutBrowserRequired('', 'password')
        ->assertPathIs('/admin/login')
        ->assertSee('email field is required')
        ->assertNoJavaScriptErrors();
});

test('shows error for empty password', function (): void {
    adminAuthenticationSubmitWithoutBrowserRequired('admin@acme.test', '')
        ->assertPathIs('/admin/login')
        ->assertSee('password field is required')
        ->assertNoJavaScriptErrors();
});

test('redirects unauthenticated users to login from dashboard', function (): void {
    visit('/admin', adminAuthenticationHost())
        ->wait(1)
        ->assertPathIs('/admin/login')
        ->assertSee('Sign in')
        ->assertNoJavaScriptErrors();
});

test('redirects unauthenticated users to login from products', function (): void {
    visit('/admin/products', adminAuthenticationHost())
        ->wait(1)
        ->assertPathIs('/admin/login')
        ->assertSee('Sign in')
        ->assertNoJavaScriptErrors();
});

resources/views/livewire/admin/settings/notifications.blade.php:55:                    <flux:heading size="lg">Admin alerts</flux:heading>
resources/views/livewire/admin/settings/index.blade.php:100:                    <flux:select.option value="admin">Admin</flux:select.option>


message: I’m rewriting only `tests/Browser/SmokeTest.php` into the 10 named smoke tests from Spec 08. The final batch test keeps the broader public/admin smoke coverage that was already useful.


text: I’m rewriting only `tests/Browser/SmokeTest.php` into the 10 named smoke tests from Spec 08. The final batch test keeps the broader public/admin smoke coverage that was already useful.


status: completed

input:
*** Begin Patch
*** Update File: tests/Browser/SmokeTest.php
@@
 function browserSmokeHost(): array
 {
     return ['host' => 'shop.test'];
 }

-test('storefront core pages render without javascript errors', function (): void {
-    $store = browserSmokeStore();
-    $product = Product::withoutGlobalScopes()
+function browserSmokeProduct(string $handle = 'classic-cotton-t-shirt'): Product
+{
+    $store = browserSmokeStore();
+
+    return Product::withoutGlobalScopes()
         ->where('store_id', $store->getKey())
-        ->where('status', 'active')
+        ->where('handle', $handle)
         ->firstOrFail();
-    $collection = ProductCollection::withoutGlobalScopes()
+}
+
+function browserSmokeCollection(string $handle = 'new-arrivals'): ProductCollection
+{
+    $store = browserSmokeStore();
+
+    return ProductCollection::withoutGlobalScopes()
         ->where('store_id', $store->getKey())
-        ->where('status', 'active')
+        ->where('handle', $handle)
         ->firstOrFail();
-    $page = Page::withoutGlobalScopes()
+}
+
+function browserSmokePage(string $handle = 'about'): Page
+{
+    $store = browserSmokeStore();
+
+    return Page::withoutGlobalScopes()
         ->where('store_id', $store->getKey())
-        ->where('status', 'published')
+        ->where('handle', $handle)
         ->firstOrFail();
+}
+
+test('loads the storefront home page', function (): void {
+    $store = browserSmokeStore();
+
+    visit('/', browserSmokeHost())
+        ->assertSee($store->name)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads a collection page', function (): void {
+    $collection = browserSmokeCollection();
+
+    visit("/collections/{$collection->handle}", browserSmokeHost())
+        ->assertSee($collection->title)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads a product page', function (): void {
+    $product = browserSmokeProduct();
+
+    visit("/products/{$product->handle}", browserSmokeHost())
+        ->assertSee($product->title)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the cart page', function (): void {
+    visit('/cart', browserSmokeHost())
+        ->assertSee('Cart')
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the customer login page', function (): void {
+    visit('/account/login', browserSmokeHost())
+        ->assertSee('Log in')
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the admin login page', function (): void {
+    visit('/admin/login', browserSmokeHost())
+        ->assertSee('Sign in')
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the about page', function (): void {
+    $page = browserSmokePage();
+
+    visit("/pages/{$page->handle}", browserSmokeHost())
+        ->assertSee($page->title)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the search page', function (): void {
+    visit('/search?q=shirt', browserSmokeHost())
+        ->assertSee('Search')
+        ->assertSee('Classic Cotton T-Shirt')
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads all collections listing', function (): void {
+    visit('/collections', browserSmokeHost())
+        ->assertSee('Collections')
+        ->assertSee('New Arrivals')
+        ->assertNoJavaScriptErrors();
+});
+
+test('has no errors on critical pages', function (): void {
+    $store = browserSmokeStore();
+    $product = browserSmokeProduct();
+    $collection = browserSmokeCollection();
+    $page = browserSmokePage();

     $pages = visit([
         '/',
         '/collections',
@@
         "/pages/{$page->handle}",
         '/cart',
+        '/account/login',
+        '/account/register',
+        '/forgot-password',
+        '/reset-password/test-token?email=customer@example.test',
+        '/account/forgot-password',
+        '/account/reset-password/test-token?email=customer@example.test',
+        '/admin/login',
     ], browserSmokeHost());

     $pages->assertNoJavaScriptErrors();

-    [$home, $collections, $collectionPage, $productPage, $search, $contentPage, $cart] = $pages;
+    [$home, $collections, $collectionPage, $productPage, $search, $contentPage, $cart, $login, $register, $forgotPassword, $resetPassword, $accountForgotPassword, $accountResetPassword, $adminLogin] = $pages;

     $home->assertSee($store->name);
     $collections->assertSee('Collections');
     $collectionPage->assertSee($collection->title);
     $productPage->assertSee($product->title);
     $search->assertSee('Search');
     $contentPage->assertSee($page->title);
     $cart->assertSee('Cart');
-});
-
-test('admin core pages render for an authenticated store user', function (): void {
-    $store = browserSmokeStore();
-    $user = User::query()->where('email', 'admin@acme.test')->firstOrFail();
-
-    $this->actingAs($user);
-    $this->withSession(['current_store_id' => $store->getKey()]);
+    $login->assertSee('Log in');
+    $register->assertSee('Create an account');
+    $forgotPassword->assertSee('Reset password');
+    $resetPassword->assertSee('New password');
+    $accountForgotPassword->assertSee('Reset password');
+    $accountResetPassword->assertSee('New password');
+    $adminLogin->assertSee('Sign in');

     $expected = [
         '/admin' => 'Dashboard',
@@
         '/admin/search/settings' => 'Search',
     ];

-    $pages = visit(array_keys($expected), browserSmokeHost());
+    $user = User::query()->where('email', 'admin@acme.test')->firstOrFail();
+
+    $this->actingAs($user);
+    $this->withSession(['current_store_id' => $store->getKey()]);
+
+    $adminPages = visit(array_keys($expected), browserSmokeHost());

-    $pages->assertNoJavaScriptErrors();
+    $adminPages->assertNoJavaScriptErrors();

-    foreach ($pages as $index => $page) {
-        $page->assertSee(array_values($expected)[$index]);
+    foreach ($adminPages as $index => $adminPage) {
+        $adminPage->assertSee(array_values($expected)[$index]);
     }
 });
-
-test('storefront account auth pages render without javascript errors', function (): void {
-    $pages = visit([
-        '/account/login',
-        '/account/register',
-        '/forgot-password',
-        '/reset-password/test-token?email=customer@example.test',
-        '/account/forgot-password',
-        '/account/reset-password/test-token?email=customer@example.test',
-    ], browserSmokeHost());
-
-    $pages->assertNoJavaScriptErrors();
-
-    [$login, $register, $forgotPassword, $resetPassword, $accountForgotPassword, $accountResetPassword] = $pages;
-
-    $login->assertSee('Log in');
-    $register->assertSee('Create an account');
-    $forgotPassword->assertSee('Reset password');
-    $resetPassword->assertSee('New password');
-    $accountForgotPassword->assertSee('Reset password');
-    $accountResetPassword->assertSee('New password');
-});
-
-test('storefront home renders on a mobile viewport', function (): void {
-    $store = browserSmokeStore();
-
-    visit('/', browserSmokeHost())
-        ->on()
-        ->mobile()
-        ->assertSee($store->name)
-        ->assertNoJavaScriptErrors();
-});
*** End Patch


stdout:
Success. Updated the following files:
M tests/Browser/SmokeTest.php

type: update

unified_diff:
@@ -26,17 +26,102 @@

-test('storefront core pages render without javascript errors', function (): void {
+function browserSmokeProduct(string $handle = 'classic-cotton-t-shirt'): Product
+{
     $store = browserSmokeStore();
-    $product = Product::withoutGlobalScopes()
+
+    return Product::withoutGlobalScopes()
         ->where('store_id', $store->getKey())
-        ->where('status', 'active')
+        ->where('handle', $handle)
         ->firstOrFail();
-    $collection = ProductCollection::withoutGlobalScopes()
+}
+
+function browserSmokeCollection(string $handle = 'new-arrivals'): ProductCollection
+{
+    $store = browserSmokeStore();
+
+    return ProductCollection::withoutGlobalScopes()
         ->where('store_id', $store->getKey())
-        ->where('status', 'active')
+        ->where('handle', $handle)
         ->firstOrFail();
-    $page = Page::withoutGlobalScopes()
+}
+
+function browserSmokePage(string $handle = 'about'): Page
+{
+    $store = browserSmokeStore();
+
+    return Page::withoutGlobalScopes()
         ->where('store_id', $store->getKey())
-        ->where('status', 'published')
+        ->where('handle', $handle)
         ->firstOrFail();
+}
+
+test('loads the storefront home page', function (): void {
+    $store = browserSmokeStore();
+
+    visit('/', browserSmokeHost())
+        ->assertSee($store->name)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads a collection page', function (): void {
+    $collection = browserSmokeCollection();
+
+    visit("/collections/{$collection->handle}", browserSmokeHost())
+        ->assertSee($collection->title)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads a product page', function (): void {
+    $product = browserSmokeProduct();
+
+    visit("/products/{$product->handle}", browserSmokeHost())
+        ->assertSee($product->title)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the cart page', function (): void {
+    visit('/cart', browserSmokeHost())
+        ->assertSee('Cart')
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the customer login page', function (): void {
+    visit('/account/login', browserSmokeHost())
+        ->assertSee('Log in')
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the admin login page', function (): void {
+    visit('/admin/login', browserSmokeHost())
+        ->assertSee('Sign in')
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the about page', function (): void {
+    $page = browserSmokePage();
+
+    visit("/pages/{$page->handle}", browserSmokeHost())
+        ->assertSee($page->title)
+        ->assertNoJavaScriptErrors();
+});
+
+test('loads the search page', function (): void {
+    visit('/search?q=shirt', browserSmokeHost())
+        ->assertSee('Search')
+        ->assertSee('Classic Cotton T-Shirt')
+        ->assertNoJavaScriptErrors();
+});

+test('loads all collections listing', function (): void {
+    visit('/collections', browserSmokeHost())
+        ->assertSee('Collections')
+        ->assertSee('New Arrivals')
+        ->assertNoJavaScriptErrors();
+});
+
+test('has no errors on critical pages', function (): void {
+    $store = browserSmokeStore();
+    $product = browserSmokeProduct();
+    $collection = browserSmokeCollection();
+    $page = browserSmokePage();
+
     $pages = visit([
@@ -49,2 +134,9 @@
         '/cart',
+        '/account/login',
+        '/account/register',
+        '/forgot-password',
+        '/reset-password/test-token?email=customer@example.test',
+        '/account/forgot-password',
+        '/account/reset-password/test-token?email=customer@example.test',
+        '/admin/login',
     ], browserSmokeHost());
@@ -53,3 +145,3 @@

-    [$home, $collections, $collectionPage, $productPage, $search, $contentPage, $cart] = $pages;
+    [$home, $collections, $collectionPage, $productPage, $search, $contentPage, $cart, $login, $register, $forgotPassword, $resetPassword, $accountForgotPassword, $accountResetPassword, $adminLogin] = $pages;

@@ -62,10 +154,9 @@
     $cart->assertSee('Cart');
-});
-
-test('admin core pages render for an authenticated store user', function (): void {
-    $store = browserSmokeStore();
-    $user = User::query()->where('email', 'admin@acme.test')->firstOrFail();
-
-    $this->actingAs($user);
-    $this->withSession(['current_store_id' => $store->getKey()]);
+    $login->assertSee('Log in');
+    $register->assertSee('Create an account');
+    $forgotPassword->assertSee('Reset password');
+    $resetPassword->assertSee('New password');
+    $accountForgotPassword->assertSee('Reset password');
+    $accountResetPassword->assertSee('New password');
+    $adminLogin->assertSee('Sign in');

@@ -92,42 +183,15 @@
     ];
-
-    $pages = visit(array_keys($expected), browserSmokeHost());

-    $pages->assertNoJavaScriptErrors();
-
-    foreach ($pages as $index => $page) {
-        $page->assertSee(array_values($expected)[$index]);
-    }
-});
-
-test('storefront account auth pages render without javascript errors', function (): void {
-    $pages = visit([
-        '/account/login',
-        '/account/register',
-        '/forgot-password',
-        '/reset-password/test-token?email=customer@example.test',
-        '/account/forgot-password',
-        '/account/reset-password/test-token?email=customer@example.test',
-    ], browserSmokeHost());
-
-    $pages->assertNoJavaScriptErrors();
+    $user = User::query()->where('email', 'admin@acme.test')->firstOrFail();

-    [$login, $register, $forgotPassword, $resetPassword, $accountForgotPassword, $accountResetPassword] = $pages;
+    $this->actingAs($user);
+    $this->withSession(['current_store_id' => $store->getKey()]);

-    $login->assertSee('Log in');
-    $register->assertSee('Create an account');
-    $forgotPassword->assertSee('Reset password');
-    $resetPassword->assertSee('New password');
-    $accountForgotPassword->assertSee('Reset password');
-    $accountResetPassword->assertSee('New password');
-});
+    $adminPages = visit(array_keys($expected), browserSmokeHost());

-test('storefront home renders on a mobile viewport', function (): void {
-    $store = browserSmokeStore();
+    $adminPages->assertNoJavaScriptErrors();

-    visit('/', browserSmokeHost())
-        ->on()
-        ->mobile()
-        ->assertSee($store->name)
-        ->assertNoJavaScriptErrors();
+    foreach ($adminPages as $index => $adminPage) {
+        $adminPage->assertSee(array_values($expected)[$index]);
+    }
 });


output: {"output":"Success. Updated the following files:\nM tests/Browser/SmokeTest.php\n","metadata":{"exit_code":0,"duration_seconds":0.0}}


step: Audit Spec 08 browser-suite coverage counts

step: Align Suite 1 smoke test file to the 10-test spec shape

step: Run focused and full verification for smoke alignment

step: Update progress and commit smoke alignment

status: pending

explanation: Suite 1 now has ten named smoke tests while retaining the broad critical-page batch inside test 1.10.


output: Plan updated


message: Suite 1 now has the spec’s 10 named smoke tests while retaining the broad batch. I’m formatting and running the smoke file first.


text: Suite 1 now has the spec’s 10 named smoke tests while retaining the broad batch. I’m formatting and running the smoke file first.


output:
Chunk ID: fa3a9a
Wall time: 4.0365 seconds
Process exited with code 0
Original token count: 5
Output:
{"result":"pass"}


command:
/bin/zsh
-lc
vendor/bin/pint --dirty --format agent

type: unknown

cmd: vendor/bin/pint --dirty --format agent

result: pass


cmd: php artisan test --compact tests/Browser/SmokeTest.php


output:
Chunk ID: fc843e
Wall time: 25.2799 seconds
Process exited with code 0
Original token count: 19
Output:

  ..........

  Tests:    10 passed (86 assertions)
  Duration: 24.84s


command: php artisan test --compact tests/Browser/SmokeTest.php

aggregated_output:
  ..........

  Tests:    10 passed (86 assertions)
  Duration: 24.84s


message: The aligned smoke suite passed: 10 tests, 86 assertions. I’m running the full browser directory to confirm the total now matches Spec 08’s 143 browser tests.


text: The aligned smoke suite passed: 10 tests, 86 assertions. I’m running the full browser directory to confirm the total now matches Spec 08’s 143 browser tests.


cmd: php artisan test --compact tests/Browser


output:
Chunk ID: da5753
Wall time: 30.0009 seconds
Process running with session ID 79433
Original token count: 2
Output:

  ...


output:
Chunk ID: ad306b
Wall time: 30.0018 seconds
Process running with session ID 79433
Original token count: 4
Output:
................


message: The full browser directory is running and has started cleanly. No failures so far.


text: The full browser directory is running and has started cleanly. No failures so far.


output:
Chunk ID: 54a8dc
Wall time: 30.0023 seconds
Process running with session ID 79433
Original token count: 2
Output:
......


output:
Chunk ID: 7b34d2
Wall time: 30.0012 seconds
Process running with session ID 79433
Original token count: 4
Output:
..............


message: The browser run is progressing through the middle suites with passing output only.


text: The browser run is progressing through the middle suites with passing output only.


output:
Chunk ID: 19f2a2
Wall time: 30.0042 seconds
Process running with session ID 79433
Original token count: 2
Output:
.......


output:
Chunk ID: eb2238
Wall time: 30.0018 seconds
Process running with session ID 79433
Original token count: 2
Output:
.......


message: Still active, still clean. I’m waiting on the same full-browser process.


text: Still active, still clean. I’m waiting on the same full-browser process.


output:
Chunk ID: e46f5e
Wall time: 30.0004 seconds
Process running with session ID 79433
Original token count: 6
Output:
.....................


output:
Chunk ID: 102823
Wall time: 30.0017 seconds
Process running with session ID 79433
Original token count: 5
Output:
..
  .............


message: The browser run has reached later files with no failures.


text: The browser run has reached later files with no failures.


output:
Chunk ID: c840d1
Wall time: 30.0012 seconds
Process running with session ID 79433
Original token count: 0
Output:


output:
Chunk ID: 8765ee
Wall time: 30.0016 seconds
Process running with session ID 79433
Original token count: 3
Output:
............


message: More passing dots came through after a quiet gap. The full browser directory is still healthy.


text: More passing dots came through after a quiet gap. The full browser directory is still healthy.


output:
Chunk ID: d97935
Wall time: 30.0004 seconds
Process running with session ID 79433
Original token count: 0
Output:


output:
Chunk ID: 449061
Wall time: 30.0010 seconds
Process running with session ID 79433
Original token count: 0
Output:


message: The process is quiet but alive. I’m waiting for the final browser summary.


text: The process is quiet but alive. I’m waiting for the final browser summary.


output:
Chunk ID: ab6c7a
Wall time: 30.0017 seconds
Process running with session ID 79433
Original token count: 4
Output:
.............


output:
Chunk ID: 3b274c
Wall time: 30.0012 seconds
Process running with session ID 79433
Original token count: 4
Output:
................


message: The full browser run is in the final stretch and still passing-only.


text: The full browser run is in the final stretch and still passing-only.


output:
Chunk ID: 0c3760
Wall time: 20.3095 seconds
Process exited with code 0
Original token count: 19
Output:
.............

  Tests:    143 passed (948 assertions)
  Duration: 520.54s


command: php artisan test --compact tests/Browser


message: The full browser directory now matches Spec 08’s total: 143 tests, 948 assertions. I’m running the complete suite with 512 MB memory one more time.


text: The full browser directory now matches Spec 08’s total: 143 tests, 948 assertions. I’m running the complete suite with 512 MB memory one more time.


cmd: php -d memory_limit=512M vendor/bin/pest --compact


output:
Chunk ID: b70a86
Wall time: 30.0009 seconds
Process running with session ID 67186
Original token count: 20
Output:

  ...........................................................................


output:
Chunk ID: 1bc1e3
Wall time: 30.0013 seconds
Process running with session ID 67186
Original token count: 46
Output:
.
  ............................................................................
  ............................................................................
  .....................


message: The full suite is running and has cleared the non-browser batches again. Waiting through the browser section.


text: The full suite is running and has cleared the non-browser batches again. Waiting through the browser section.


output:
Chunk ID: 58abff
Wall time: 30.0027 seconds
Process running with session ID 67186
Original token count: 4
Output:
.............


output:
Chunk ID: 334806
Wall time: 30.0015 seconds
Process running with session ID 67186
Original token count: 2
Output:
......


message: The complete suite is in the browser portion and still passing-only.


text: The complete suite is in the browser portion and still passing-only.


output:
Chunk ID: b80ddd
Wall time: 30.0012 seconds
Process running with session ID 67186
Original token count: 2
Output:
......


output:
Chunk ID: e7d038
Wall time: 30.0009 seconds
Process running with session ID 67186
Original token count: 4
Output:
..............


message: More browser tests passed; no failures. Continuing to wait.


text: More browser tests passed; no failures. Continuing to wait.


output:
Chunk ID: 2d0a69
Wall time: 30.0021 seconds
Process running with session ID 67186
Original token count: 2
Output:
.......


output:
Chunk ID: e47427
Wall time: 30.0010 seconds
Process running with session ID 67186
Original token count: 2
Output:
.......


message: The suite remains active with passing output only. I’m staying on the same process.


text: The suite remains active with passing output only. I’m staying on the same process.


output:
Chunk ID: 88de63
Wall time: 30.0019 seconds
Process running with session ID 67186
Original token count: 6
Output:
..
  ...................


output:
Chunk ID: 9e1cfe
Wall time: 30.0014 seconds
Process running with session ID 67186
Original token count: 4
Output:
...............


message: The full suite is several minutes in and continues cleanly.


text: The full suite is several minutes in and continues cleanly.


output:
Chunk ID: 87daab
Wall time: 30.0017 seconds
Process running with session ID 67186
Original token count: 0
Output:


output:
Chunk ID: f32e61
Wall time: 30.0016 seconds
Process running with session ID 67186
Original token count: 3
Output:
............


message: A quiet gap cleared; more passing output came through. Still no failures.


text: A quiet gap cleared; more passing output came through. Still no failures.


output:
Chunk ID: d9bea6
Wall time: 30.0016 seconds
Process running with session ID 67186
Original token count: 0
Output:


output:
Chunk ID: 8274f1
Wall time: 30.0019 seconds
Process running with session ID 67186
Original token count: 0
Output:


message: The process is quiet but alive in the later browser section. I’m continuing to wait for completion.


text: The process is quiet but alive in the later browser section. I’m continuing to wait for completion.


output:
Chunk ID: ac5356
Wall time: 30.0022 seconds
Process running with session ID 67186
Original token count: 4
Output:
.............


output:
Chunk ID: 617035
Wall time: 30.0019 seconds
Process running with session ID 67186
Original token count: 3
Output:
............


message: The full suite is in the final browser stretch, still passing-only.


text: The full suite is in the final browser stretch, still passing-only.


output:
Chunk ID: 1ec4a2
Wall time: 30.0012 seconds
Process running with session ID 67186
Original token count: 1
Output:
....


command: php -d memory_limit=512M vendor/bin/pest --compact


output:
Chunk ID: ab5f6b
Wall time: 0.0000 seconds
Process exited with code 0
Original token count: 20
Output:
.
  ............

  Tests:    392 passed (2388 assertions)
  Duration: 582.46s


message: The complete suite passed after the smoke alignment: 392 tests, 2388 assertions. I’m updating progress to mark the Spec 08 browser suite as covered with 143 browser tests, then I’ll commit this audit fix.


text: The complete suite passed after the smoke alignment: 392 tests, 2388 assertions. I’m updating progress to mark the Spec 08 browser suite as covered with 143 browser tests, then I’ll commit this audit fix.