Optional use of local chrome for headless tests via tags (#2568)

This commit is contained in:
Mzack9999 2022-09-07 12:39:22 +02:00 committed by GitHub
parent f93d0e3956
commit 7ce03bcc5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/protocolstate"
"github.com/projectdiscovery/nuclei/v2/pkg/testutils/testheadless"
"github.com/projectdiscovery/nuclei/v2/pkg/types"
)
@ -516,7 +517,7 @@ func testHeadless(t *testing.T, actions []*Action, timeout time.Duration, handle
t.Helper()
_ = 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")
defer browser.Close()

View 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

View 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