pestphp / pestphp/pest

[Bug]: Playwright is required when running php specific test groups

Open
#1,489 0 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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
  1. Setup a Browser testing group
  2. Setup a regular testing group
  3. Run vendor/bin/pest --group=regular_group
  4. Ensure Playwright is 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
  1. As mentioned under the samepl repo, we could provide an argument to silence it or
  2. A bit more involved solution which I have tested, is to pass the groups down to the Pest\Browser\Filters \UsesBrowserTestCaseMethodFilter and if the group does not contain browser then 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.