pestphp / pestphp/pest

[Bug]: net::ERR_CERT_AUTHORITY_INVALID in browser test

Open
#1,452 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
11.7k
Forks
538
Avg merge
4d 11h
Merged PRs (30d)
8

Description

What Happened

First of all, thank you for this new release.
The upgrade from Pest 3.x to 4.x was without any issue.

But when I installed Pest 4.x browser test expected the issue.

The test:

test('example', function () {
    $routes = [
        route('home'),
        route('test1.home'),
        route('text2.home'),
        route('test3.home')
    ];

    visit($routes)->assertNoJavaScriptErrors();
});

The test fails with: FAILED Tests\Unit\ExampleTest > example
net::ERR_CERT_AUTHORITY_INVALID at http://development.local/

How to Reproduce
  1. Install a fresh Laravel app;
  2. add Pest test latest;
  3. setup minimum 2 domains or subdomain;
  4. create routes for every domains with views
  5. Pest test:
it('may welcome the user', function () {
    $page = visit(route('home'));

    $page->assertSee('Welcome');
});
Sample Repository

No response

Pest Version

4.0

PHP Version

8.3.24

Operation System

Linux

Notes

All routes are valid routes in a multi-domain Laravel setup.
route('home') => "https://development.local"
route('test1.home') => "https://test1.development.local"
route('text2.home') => "https://development2.local"
route('test3.home') => "https://development.local/test3"

The setup was tested without route() helper also. The issue is too same.

The environment is Ubuntu 24.04 based development environment with multi-php and every domain has own Apache vhost setup for port 80 and for port 443 with self-signed SSL cert.

Laravel: v12.25.0
PHP: 8.3.24
Pest: 4.0.x, latest

The APP_URL wast tested with http and https, the issue is too same.

The test was tried with
$page->assertNoSmoke();
$page->assertNoConsoleLogs(); and
$page->assertNoJavaScriptErrors();

The issue is too same.

Note: earlier I had run with Laravel Dusk to similar error too.

I tried to setup PlayWright in a playwright.config.ts in Laravel root folder, without any success.
Also tried to find browser binaries setup possibilities, without any success.

The $page->assertSchemeIs('https'); is supported in Pest 4.x, so how to should be setup the browser also to handle self-signed certificates.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the multi-domain Laravel browser test using the supplied route list and self-signed HTTPS setup; start with the browser-test integration and the mentioned playwright.config.ts. Confirm whether the finished change should let Pest browser assertions run against these certificates, and validate with the listed assertions.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, playwright
Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.