Skip to content

Commit bbbe770

Browse files
committed
Update documentation with process hang fix
1 parent 9c50929 commit bbbe770

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

PLAYWRIGHT_WORKER_FIXES.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,19 @@
1515
- **Fix**: Allow auto-initialization when `manualStart` is false
1616
- **Impact**: Tests with `Before()` hooks now work properly with restart=browser mode
1717

18-
### 3. ⚠️ Per-Test Config with Session Mode + Workers (LIMITATION DOCUMENTED)
18+
### 3. ✅ Process Hanging After Tests Complete (FIXED)
19+
**Problem**: Process doesn't exit after all tests pass, hangs indefinitely
20+
- **Root Cause**: Playwright's internal event loops keep the process alive even after cleanup
21+
- **File**: `lib/helper/Playwright.js` `_cleanup()` method
22+
- **Fix**: Add delayed auto-exit (2 seconds) after cleanup completes
23+
- **Details**:
24+
- Uses `setTimeout().unref()` to allow natural exit if possible
25+
- Only exits if no other exit handlers are registered
26+
- Respects existing `process.exitCode`
27+
- Can be disabled with `CODECEPT_DISABLE_AUTO_EXIT=1` environment variable
28+
- **Impact**: Tests now exit cleanly within 2 seconds after completion
29+
30+
### 4. ⚠️ Per-Test Config with Session Mode + Workers (LIMITATION DOCUMENTED)
1931
**Problem**: Per-test `.config()` doesn't work in BROWSER_RESTART=session mode with workers
2032
- **Root Cause**: `teardown()` afterEach hooks don't execute in worker/pool mode
2133
- **Evidence**: File logging showed config changes applied but restore callbacks never fired
@@ -27,7 +39,7 @@
2739
- **Affected Tests**: 18 tests from `config_test.js` and `session_test.js`
2840
- **Workaround Applied**: Changed CI workflow to avoid the problematic combination
2941

30-
### 4. ⚠️ Selector Registration Conflicts (NEW ISSUE)
42+
### 5. ⚠️ Selector Registration Conflicts (NEW ISSUE)
3143
**Problem**: BROWSER_RESTART=context with workers causes selector registration conflicts
3244
- **Error**: `browser.newContext: "__value" selector engine has been already registered`
3345
- **Root Cause**: Custom selectors are registered globally on the Playwright module instance (module-level variable)

0 commit comments

Comments
 (0)