Skip to content

Commit 6aa59a2

Browse files
committed
try to adress #4119
1 parent e4c8f26 commit 6aa59a2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

js/modules/k6/browser/tests/test_browser.go

+8
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/stretchr/testify/require"
1414
"golang.org/x/sync/errgroup"
1515

16+
"go.k6.io/k6/event"
1617
"go.k6.io/k6/js/modules/k6/browser/chromium"
1718
"go.k6.io/k6/js/modules/k6/browser/common"
1819
"go.k6.io/k6/js/modules/k6/browser/env"
@@ -89,6 +90,13 @@ func newTestBrowser(tb testing.TB, opts ...func(*testBrowser)) *testBrowser {
8990
tbr.pid = pid
9091
tbr.wsURL = b.WsURL()
9192
tb.Cleanup(func() {
93+
events, ok := tbr.vu.EventsField.Global.(*event.System)
94+
require.True(tb, ok)
95+
waitDone := events.Emit(&event.Event{
96+
Type: event.Exit,
97+
})
98+
99+
require.NoError(tb, waitDone(context.Background()), "error waiting on Exit done")
92100
select {
93101
case <-tbr.vu.Context().Done():
94102
default:

0 commit comments

Comments
 (0)