Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@ jobs:
matrix:
php: [8.2, 8.3, 8.4, 8.5]
deps: [highest]
symfony: [6.4.*, 7.4.*, 8.0.*, 8.1.*]
symfony: [6.4.*, 7.4.*, 8.1.*]
include:
- php: 8.2
deps: lowest
symfony: '*'
exclude:
- php: 8.2
symfony: 8.0.*
- php: 8.3
symfony: 8.0.*
- php: 8.2
symfony: 8.1.*
- php: 8.3
Expand All @@ -40,6 +36,7 @@ jobs:
php: ${{ matrix.php }}
symfony: ${{ matrix.symfony }}
deps: ${{ matrix.deps }}
phpunit: paratest --functional

code-coverage:
name: Code Coverage
Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class MyTest extends TestCase
}
```

All browsers have the following methods:
Both browsers have the following methods:

```php
/** @var \Zenstruck\Browser $browser **/
Expand Down Expand Up @@ -235,7 +235,7 @@ $browser

### Authentication

All browsers have helpers and assertions for authentication:
Both browsers have helpers and assertions for authentication:

```php
/** @var \Zenstruck\Browser $browser **/
Expand Down Expand Up @@ -277,7 +277,7 @@ previous request didn't perform any security-related operations. Possible soluti
### Exceptions

Exceptions thrown while handling a request are caught and converted to a response, as they are in
production. The `KernelBrowser` and `PlaywrightBrowser` can both turn this off:
production. Both browsers can turn this off:

```php
/** @var \Zenstruck\Browser $browser **/
Expand All @@ -299,8 +299,7 @@ $browser

### Redirects

By default, redirects are followed. Both the `KernelBrowser` and `PlaywrightBrowser` can stop on
them instead:
By default, redirects are followed. Both browsers can stop on them instead:

```php
/** @var \Zenstruck\Browser $browser **/
Expand Down Expand Up @@ -336,7 +335,7 @@ $browser

### Profiling

The Symfony profiler is available to both browsers:
Both browsers expose the Symfony profiler:

```php
/** @var \Zenstruck\Browser $browser **/
Expand Down Expand Up @@ -619,6 +618,19 @@ Each `playwrightBrowser()` call gets its own browser context, isolated from the
and storage, while sharing one browser process. They also share the kernel booted for the test, so
they see the same application state, just as separate browsers hitting one webserver would.

### Parallel Testing

Both browsers work with [ParaTest](https://github.com/paratestphp/paratest). Each worker is a
separate PHP process with its own browser, launched only if that worker runs a test needing one.

Saved artifacts work as usual: each worker writes to the configured directories, and a failure
still saves the source, screenshot and console log. The summary printed at the end of a serial run
is not shown, as ParaTest does not surface worker output by then.

> [!NOTE]
> Expect one browser per worker: `--processes 8` means up to eight browsers, each with its own Node
> process, so pick a number your machine and CI runner can carry.

## Configuration

There are several environment variables available to configure:
Expand Down
Binary file removed attachment.zip
Binary file not shown.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
"zenstruck/callback": "^1.4.2"
},
"require-dev": {
"brianium/paratest": "^6.11|^7.0",
"justinrainbow/json-schema": "^5.3",
"mtdowling/jmespath.php": "^2.6",
"phpstan/phpstan": "^2.0",
"phpunit/phpunit": "^9.6.21|^10.4",
"phpunit/phpunit": "^9.6.21|^10.4|^11.5|^12.0|^13.0",
"playwright-php/playwright": "^1.4",
"playwright-php/playwright-symfony": "^0.10",
"symfony/console": "^6.4|^7.0|^8.0",
Expand Down
6 changes: 5 additions & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
failOnRisky="true"
failOnWarning="true"
Expand All @@ -15,6 +15,10 @@
<server name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0&amp;max[direct]=0"/>
</php>

<extensions>
<bootstrap class="Zenstruck\Browser\Test\BrowserExtension"/>
</extensions>

<testsuites>
<testsuite name="Project Test Suite">
<directory>./tests/</directory>
Expand Down
Loading