Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Add a new env var to enable devTools
Browse files Browse the repository at this point in the history
  • Loading branch information
ankur22 committed Dec 3, 2024
1 parent a21dc96 commit 59dba6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chromium/browser_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func prepareFlags(lopts *common.BrowserOptions, k6opts *k6lib.Options) (map[stri
"headless": lopts.Headless,
"window-size": fmt.Sprintf("%d,%d", 800, 600),
}
if lopts.Debug {
if lopts.DevTools {
f["auto-open-devtools-for-tabs"] = true
lopts.Headless = false
}
Expand Down
4 changes: 4 additions & 0 deletions common/browser_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const optType = "type"
type BrowserOptions struct {
Args []string
Debug bool
DevTools bool
ExecutablePath string
Headless bool
IgnoreDefaultArgs []string
Expand Down Expand Up @@ -79,6 +80,7 @@ func (bo *BrowserOptions) Parse( //nolint:cyclop
env.BrowserIgnoreDefaultArgs,
env.LogCategoryFilter,
env.BrowserGlobalTimeout,
env.BrowserDevTools,
}

for _, e := range envOpts {
Expand Down Expand Up @@ -106,6 +108,8 @@ func (bo *BrowserOptions) Parse( //nolint:cyclop
bo.LogCategoryFilter = ev
case env.BrowserGlobalTimeout:
bo.Timeout, err = parseTimeOpt(e, ev)
case env.BrowserDevTools:
bo.DevTools, err = parseBoolOpt(e, ev)
}
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ const (
// BrowserGlobalTimeout is an environment variable that can be used
// to set the global timeout for the browser.
BrowserGlobalTimeout = "K6_BROWSER_TIMEOUT"

// BrowserDevTools will open up the dev tools window allowing quick
// access to the SuT DOM and other debug facilities in chrome.
BrowserDevTools = "K6_BROWSER_DEVTOOLS"
)

// Logging and debugging.
Expand Down

0 comments on commit 59dba6c

Please sign in to comment.