@@ -190,14 +190,19 @@ return [
190190playwright :
191191 intercepted_hosts :
192192 - ' localhost'
193- - ' 127.0.0.1'
194- - ' myapp .local'
193+ - ' 127.0.0.1'
194+ - ' testapp .local'
195195 debug : ' %kernel.debug%'
196+ default_browser : ' default'
196197 browsers :
197198 default :
198199 type : ' chromium'
199200 headless : true
200- default_browser : ' default'
201+ timeout_ms : 30000
202+ slowmo_ms : 0
203+ firefox :
204+ type : ' firefox'
205+ headless : true
201206` ` `
202207
2032083. **Create your test base class**:
@@ -259,7 +264,7 @@ class LoginTest extends BaseE2ETest
259264
260265 // Wait for navigation and verify result
261266 $page->waitForLoadState();
262- $this->assertStringContains ('Dashboard', $page->content() );
267+ $this->assertPageContains ('Dashboard');
263268
264269 // Access intercepted request/response
265270 $response = $this->getLastResponse();
@@ -277,7 +282,7 @@ class LoginTest extends BaseE2ETest
277282 $authCookie = $this->getCookie('AUTH');
278283 $this->assertNotNull($authCookie);
279284
280- $this->assertStringContains ('Admin Panel', $page->content() );
285+ $this->assertPageContains ('Admin Panel');
281286 }
282287}
283288```
@@ -286,7 +291,7 @@ class LoginTest extends BaseE2ETest
286291
287292** For applications with existing test infrastructure** :
288293
289- 1 . Place E2E tests in ` tests/E2E/ ` directory
294+ 1 . Place E2E tests in ` tests/Integration/ E2E/ ` directory (this repository’s convention)
2902952 . Configure separate test database for E2E tests
2912963 . Use environment variables to control test behavior:
292297 - ` KERNEL_CLASS ` - Custom kernel class
@@ -317,7 +322,7 @@ jobs:
317322 run : npx playwright install chromium --with-deps
318323
319324 - name : Run E2E tests
320- run : vendor/bin/phpunit tests/E2E/
325+ run : vendor/bin/phpunit tests/Integration/ E2E/
321326 env :
322327 PLAYWRIGHT_HEADLESS : true
323328` ` `
@@ -343,10 +348,9 @@ The bundle provides these methods in `PlaywrightTestCase`:
343348- `getLastRequest() : ?SymfonyRequest` - Get last intercepted request
344349- `getLastResponse() : ?SymfonyResponse` - Get last intercepted response
345350
346- **Hooks (override in your tests ):**
351+ **Hooks (public methods you can override ):**
347352- `beforeRequest(SymfonyRequest $request) : void` - Called before each request
348353- `afterResponse(SymfonyResponse $response) : void` - Called after each response
349- - `loadFixtures(array $fixtures) : void` - Override to load test data
350354
351355All browser interactions use the native [Playwright PHP Page API](https://github.com/playwright-php/playwright).
352356
@@ -359,14 +363,14 @@ All browser interactions use the native [Playwright PHP Page API](https://github
359363# # Running Tests
360364
361365` ` ` bash
362- # Run all E2E tests
363- vendor/bin/phpunit tests/E2E
366+ # Run all E2E tests (repository convention)
367+ vendor/bin/phpunit tests/Integration/ E2E
364368
365369# Run with visible browser
366- PLAYWRIGHT_HEADLESS=false vendor/bin/phpunit tests/E2E
370+ PLAYWRIGHT_HEADLESS=false vendor/bin/phpunit tests/Integration/ E2E
367371
368- # Run specific test
369- vendor/bin/phpunit tests/E2E/UserFlowTest .php
372+ # Run specific test file
373+ vendor/bin/phpunit tests/Integration/ E2E/HelloE2ETest .php
370374` ` `
371375
372376# # Tips and Best Practices
@@ -400,10 +404,10 @@ public function testApiCalls(): void
400404
401405` ` ` bash
402406# Show browser during tests
403- PLAYWRIGHT_HEADLESS=false vendor/bin/phpunit tests/E2E/
407+ PLAYWRIGHT_HEADLESS=false vendor/bin/phpunit tests/Integration/ E2E/
404408
405409# Use different browser
406- PLAYWRIGHT_BROWSER=firefox vendor/bin/phpunit tests/E2E/
410+ PLAYWRIGHT_BROWSER=firefox vendor/bin/phpunit tests/Integration/ E2E/
407411` ` `
408412
409413# # Comparison with WebTestCase
@@ -419,7 +423,7 @@ PLAYWRIGHT_BROWSER=firefox vendor/bin/phpunit tests/E2E/
419423| Multiple Tabs | ❌ | ✅ |
420424| Request Interception | ✅ | ✅ |
421425| Symfony Integration | ✅ | ✅ |
422- | Transaction Rollback | ✅ | ✅ |
426+ | Transaction Rollback | Depends | Depends |
423427
424428# # Contributing
425429
0 commit comments