File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
packages/build/src/extensions Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -295,10 +295,29 @@ class PlaywrightExtension implements BuildExtension {
295295 * We save this output to a file and then parse it to get the download urls for the browsers.
296296 */
297297 instructions . push ( `RUN npx playwright install --dry-run > /tmp/browser-info.txt` ) ;
298+
299+ // Determine which browsers to actually install
300+ const browsersToInstall = new Set < PlaywrightBrowser | "chromium-headless-shell" > ( ) ;
301+
298302 this . options . browsers . forEach ( ( browser ) => {
299- const browserType = browser === "chromium" ? "chromium-headless-shell" : browser ;
303+ if ( browser === "chromium" ) {
304+ if ( this . options . headless ) {
305+ // For headless mode, only install chromium-headless-shell
306+ browsersToInstall . add ( "chromium-headless-shell" ) ;
307+ } else {
308+ // For non-headless mode, install both chromium and chromium-headless-shell
309+ // This allows users to easily switch between headless and non-headless mode
310+ browsersToInstall . add ( "chromium" ) ;
311+ browsersToInstall . add ( "chromium-headless-shell" ) ;
312+ }
313+ } else {
314+ browsersToInstall . add ( browser ) ;
315+ }
316+ } ) ;
317+
318+ Array . from ( browsersToInstall ) . forEach ( ( browser ) => {
300319 instructions . push (
301- `RUN grep -A5 "browser: ${ browserType } " /tmp/browser-info.txt > /tmp/${ browser } -info.txt` ,
320+ `RUN grep -A5 -m1 "browser: ${ browser } " /tmp/browser-info.txt > /tmp/${ browser } -info.txt` ,
302321
303322 `RUN INSTALL_DIR=$(grep "Install location:" /tmp/${ browser } -info.txt | cut -d':' -f2- | xargs) && \
304323 DIR_NAME=$(basename "$INSTALL_DIR") && \
You can’t perform that action at this time.
0 commit comments