mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-23 23:35:24 +00:00
Optional use of local chrome for headless tests via tags (#2568)
This commit is contained in:
parent
f93d0e3956
commit
7ce03bcc5b
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/protocolstate"
|
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/protocolstate"
|
||||||
|
"github.com/projectdiscovery/nuclei/v2/pkg/testutils/testheadless"
|
||||||
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
"github.com/projectdiscovery/nuclei/v2/pkg/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -516,7 +517,7 @@ func testHeadless(t *testing.T, actions []*Action, timeout time.Duration, handle
|
|||||||
t.Helper()
|
t.Helper()
|
||||||
_ = protocolstate.Init(&types.Options{})
|
_ = protocolstate.Init(&types.Options{})
|
||||||
|
|
||||||
browser, err := New(&types.Options{ShowBrowser: false})
|
browser, err := New(&types.Options{ShowBrowser: false, UseInstalledChrome: testheadless.HeadlessLocal})
|
||||||
require.Nil(t, err, "could not create browser")
|
require.Nil(t, err, "could not create browser")
|
||||||
defer browser.Close()
|
defer browser.Close()
|
||||||
|
|
||||||
|
|||||||
6
v2/pkg/testutils/testheadless/headless_local.go
Normal file
6
v2/pkg/testutils/testheadless/headless_local.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//go:build headless_local
|
||||||
|
|
||||||
|
package testheadless
|
||||||
|
|
||||||
|
// HeadlessLocal determines if local headless chrome should be used in tests
|
||||||
|
const HeadlessLocal = true
|
||||||
6
v2/pkg/testutils/testheadless/headless_runtime.go
Normal file
6
v2/pkg/testutils/testheadless/headless_runtime.go
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
//go:build !headless_local
|
||||||
|
|
||||||
|
package testheadless
|
||||||
|
|
||||||
|
// HeadlessLocal determines if local headless chrome should be used in tests
|
||||||
|
const HeadlessLocal = false
|
||||||
Loading…
x
Reference in New Issue
Block a user