[Bug]: Playwright is required when running php specific test groups
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 11.7k
- Forks
- 538
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
What Happened
I am currently testing 3 parts of my app, all in their own github workflow / action; architecture, app (3 shards) and browser. When running the architecture / app tests I get this error Playwright is not installed. Which isn't being installed in the first place because its not needed for php level code - doesn't seem logical to require it. It also becomes wasted quota for github actions.
How to Reproduce
- Setup a Browser testing group
- Setup a regular testing group
- Run
vendor/bin/pest --group=regular_group - Ensure
Playwrightis not installed
You will receive Playwright is not installed. Please run [npm install playwright && npx playwright install] in the root directory of your project.
Potential Solutions
- As mentioned under the samepl repo, we could provide an argument to silence it or
- A bit more involved solution which I have tested, is to pass the groups down to the
Pest\Browser\Filters \UsesBrowserTestCaseMethodFilterand if the group does not containbrowserthen we can prevent starting the playwright server (which calls the exception)
Sample Repository
For now have a created a draft PR against the pest-plugin-browser repo as the exception is thrown there (easiest POC) https://github.com/SethSharp/pest-plugin-browser/pull/1. Not sure if this solution belongs in a browser specific repo
Pest Version
4.0
PHP Version
8.3
Operation System
macOS
Notes
Removing
<testsuite name="Browser">
<directory>tests/Browser</directory>
</testsuite>
from phpunit.xml does bypass this error but means browser tests are not tested.
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
Start by reproducing vendor/bin/pest --group=regular_group without Playwright, then inspect Pest\Browser\Filters\UsesBrowserTestCaseMethodFilter and the exception path in the pest-plugin-browser repository. Check the draft PR linked in the issue and the phpunit.xml Browser suite configuration. Done means regular PHP test groups run without Playwright while browser tests remain covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100