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

Commit 83b795a

Browse files
committed
Add skip test if XK6_HEADLESS is set
This is so that we don't run the test in CI but do run it where that env var isn't set. Resolves: #677 (comment)
1 parent d4fcdeb commit 83b795a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/frame_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package tests
22

33
import (
4+
"os"
5+
"strconv"
46
"testing"
57

68
"github.com/dop251/goja"
@@ -74,12 +76,22 @@ func TestFrameDismissDialogBox(t *testing.T) {
7476
}
7577

7678
func TestFrameNoPanicWithEmbeddedIFrame(t *testing.T) {
77-
// This test only works when headless mode is false.
78-
t.SkipNow()
79+
if strValue, ok := os.LookupEnv("XK6_HEADLESS"); ok {
80+
if value, err := strconv.ParseBool(strValue); err == nil && value {
81+
// We're skipping this when running in headless
82+
// environments since the bug that the test fixes
83+
// only surfaces when in headfull mode.
84+
// Remove this skip once we have headfull mode in
85+
// CI: https://github.com/grafana/xk6-browser/issues/678
86+
t.Skip("skipped when in headless mode")
87+
}
88+
}
7989

8090
t.Parallel()
8191

82-
b := newTestBrowser(t, withFileServer())
92+
opts := defaultLaunchOpts()
93+
opts.Headless = false
94+
b := newTestBrowser(t, withFileServer(), opts)
8395
p := b.NewPage(nil)
8496

8597
var result string

0 commit comments

Comments
 (0)