-
-
Notifications
You must be signed in to change notification settings - Fork 78
Feature/configurable browser launch args #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.x
Are you sure you want to change the base?
Conversation
|
@cyppe, I am in the process of merging some PRs. Could you update yours to resolve the conflicts. |
cfb3fb1 to
3729e86
Compare
|
Nice! I see you have been very active. I was a bit AFK, but have resolved conflict now. |
|
Failure not related to this PR as I understand. |
|
@jasonmccreary something I can do to push forward with this PR? |
|
+1 on this. I need this too. Like, a LOT. Like, will need to fork this repo if I don't get it! Happy to help in any way I can to get this - or something else that allows custom launch args - merged in. For context, my use case is testing a webapp with a requirement for media device access. I need to pass in |
|
@nunomaduro @jasonmccreary Is there anything I can do to get this PR moving? Or is there some kind of idea when someone will have some time to look into PRs for this project so we get some hint about timeline. |
Add configurable browser launch arguments
Problem
Currently, there's no way to pass custom launch arguments to the browser when running Pest browser tests. This creates issues in several scenarios:
--no-sandboxand--disable-dev-shm-usageIn our case, we needed to configure HiDPI scaling for browser tests running in DDEV with Omarchy (Arch Linux desktop environment) to match the 2x scaling of our regular desktop environment.
Solution
This PR adds three new methods to the
Configurationclass:withArgs(array $args)- Sets arguments for all modes (headless and headed)withHeadedArgs(array $args)- Sets arguments only for headed modewithHeadlessArgs(array $args)- Sets arguments only for headless modeArguments are merged intelligently: global args are always included, plus mode-specific args based on whether
--headedflag is used.Usage
Configure globally in
tests/Pest.php:Or using the fluent configuration API:
Implementation
Playwrightclass to store launch argumentsClient::connectTo()to include custom arguments in launch optionsBackward Compatibility
This change is fully backward compatible. Existing tests continue to work unchanged, and the new functionality is opt-in.