MCPcopy
hub / github.com/mxschmitt/playwright-go / TestBrowserClose

Function TestBrowserClose

tests/browser_test.go:126–139  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func TestBrowserClose(t *testing.T) {
127 browser, err := browserType.Launch()
128 require.NoError(t, err)
129 onCloseWasCalled := make(chan bool, 1)
130 onClose := func(b playwright.Browser) {
131 require.False(t, b.IsConnected())
132 onCloseWasCalled <- true
133 }
134 browser.OnDisconnected(onClose)
135 require.True(t, browser.IsConnected())
136 require.NoError(t, browser.Close())
137 <-onCloseWasCalled
138 require.False(t, browser.IsConnected())
139}
140
141func TestBrowserShoulOutputATrace(t *testing.T) {
142 BeforeEach(t)

Callers

nothing calls this directly

Calls 4

LaunchMethod · 0.65
IsConnectedMethod · 0.65
OnDisconnectedMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected