[Bug]: Browser Tests Timeout / Chrome Processes for previous test cases left open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 11.7k
- Forks
- 538
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
What Happened
In my testsuite I have a number of browser tests using the browser plugin.
I can't run my test suite as my browser tests start timing out after a few cases have been tested.
When running with --debug or --headed I noticed it's opening a new chromium process/window for each test case. When the test case passes/fails it moves onto the next test case and opens another chromium browser instance while leaving the previous browsers still open.
This results in a high number of browsers open and exhausting CPU/RAM on my machine and the test cases then fail due to timing out.
I haven't actually checked the processes when running the testsuite without --headed or --debug, but I'm getting the same symptoms and tests fail.
Note: I'm running the test suite without --parallel so that is not the cause of multiple browser windows.
How to Reproduce
Put multiple basic browser tests in a test file, run the tests with --headed and see multiple chrome browsers open.
Sample Repository
No response
Pest Version
4.0.3
PHP Version
8.4
Operation System
macOS
Notes
I am using tenancyforlaravel and I did see this post in discussions which also seems to be leveraging tenancyforlaravel (based on seeing central. in their route name)
Discussion: https://github.com/pestphp/pest/discussions/1453
I have managed to fix this doing $page->page()->close(); after my assertions/expectations on all browser tests but this is not ideal.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with multiple basic browser tests using --headed, then inspect the browser plugin lifecycle between test cases. Compare the open-browser behavior with the reported page()->close() workaround; done means each test releases its Chromium process and the suite no longer accumulates browsers or times out.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100