Skip to content

Commit

Permalink
Remove support for browser devtools option (#868)
Browse files Browse the repository at this point in the history
A decision was made to no longer support the devtools browser option,
which behaves as a flag in order to automatically enable DevTools in all
new pages as this was not providing much value.
  • Loading branch information
ka3de authored May 3, 2023
1 parent 480c0c1 commit 6615b02
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 30 deletions.
9 changes: 4 additions & 5 deletions chromium/browser_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,10 @@ func prepareFlags(lopts *common.LaunchOptions, k6opts *k6lib.Options) (map[strin
"use-mock-keychain": true,
"no-service-autorun": true,

"no-startup-window": true,
"no-default-browser-check": true,
"headless": lopts.Headless,
"auto-open-devtools-for-tabs": lopts.Devtools,
"window-size": fmt.Sprintf("%d,%d", 800, 600),
"no-startup-window": true,
"no-default-browser-check": true,
"headless": lopts.Headless,
"window-size": fmt.Sprintf("%d,%d", 800, 600),
}
if lopts.Headless {
f["hide-scrollbars"] = true
Expand Down
6 changes: 0 additions & 6 deletions chromium/browser_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ func TestBrowserTypePrepareFlags(t *testing.T) {
expInitVal, expChangedVal any
post func(t *testing.T, flags map[string]any)
}{
{
flag: "auto-open-devtools-for-tabs",
expInitVal: false,
changeOpts: &common.LaunchOptions{Devtools: true},
expChangedVal: true,
},
{
flag: "hide-scrollbars",
changeOpts: &common.LaunchOptions{IgnoreDefaultArgs: []string{"hide-scrollbars"}, Headless: true},
Expand Down
5 changes: 0 additions & 5 deletions common/browser_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
const (
optArgs = "args"
optDebug = "debug"
optDevTools = "devtools"
optEnv = "env"
optExecutablePath = "executablePath"
optHeadless = "headless"
Expand All @@ -36,7 +35,6 @@ type ProxyOptions struct {
type LaunchOptions struct {
Args []string
Debug bool
Devtools bool
Env map[string]string
ExecutablePath string
Headless bool
Expand Down Expand Up @@ -111,8 +109,6 @@ func (l *LaunchOptions) Parse(ctx context.Context, logger *log.Logger, opts goja
err = exportOpt(rt, k, v, &l.Args)
case optDebug:
l.Debug, err = parseBoolOpt(k, v)
case optDevTools:
l.Devtools, err = parseBoolOpt(k, v)
case optEnv:
err = exportOpt(rt, k, v, &l.Env)
case optExecutablePath:
Expand Down Expand Up @@ -145,7 +141,6 @@ func (l *LaunchOptions) shouldIgnoreIfBrowserIsRemote(opt string) bool {

shouldIgnoreIfBrowserIsRemote := map[string]struct{}{
optArgs: {},
optDevTools: {},
optEnv: {},
optExecutablePath: {},
optHeadless: {},
Expand Down
14 changes: 0 additions & 14 deletions common/browser_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func TestBrowserLaunchOptionsParse(t *testing.T) {
opts: map[string]any{
// disallow changing the following opts
"args": []string{"any"},
"devtools": true,
"env": map[string]string{"some": "thing"},
"executablePath": "something else",
"headless": false,
Expand Down Expand Up @@ -120,19 +119,6 @@ func TestBrowserLaunchOptionsParse(t *testing.T) {
opts: map[string]any{"debug": "true"},
err: "debug should be a boolean",
},
"devtools": {
opts: map[string]any{
"devtools": true,
},
assert: func(tb testing.TB, lo *LaunchOptions) {
tb.Helper()
assert.True(t, lo.Devtools)
},
},
"devtools_err": {
opts: map[string]any{"devtools": "true"},
err: "devtools should be a boolean",
},
"env": {
opts: map[string]any{
"env": map[string]string{"key": "value"},
Expand Down

0 comments on commit 6615b02

Please sign in to comment.