This release helps us to drive complex websites with xk6-browser by fixing significant frame handling bugs and improving the integration testing suite and logging.
Bugs fixed
-
Fix major bug: Cannot find context with specified id (#49)
FrameSession
was blocking the frame handling mechanism, and the rest of the system couldn't propagate execution contexts, causing the context with specified id not found error. This happens when aSession
is closed while a relatedFrameSession
is booting up.Refactors
FrameSession
and frame handling code. Improves log messages and better reflects the cause of possible errors. -
Fix major bug: Cannot create frame session (#129)
Fixes and gracefully handles cannot create frame session issue reported by #125. It does so by preventing
FrameSession
from throwing an error if the error is temporary and instead logs the error.Improves the handling of creation and destruction of execution contexts in a more stable way.
Fixes related data race issues, refactors and cleans things up.
-
Fix frame aborted navigation event nil pending document sharing (#177)
We were sharing a
nil
pending document when a frame aborts navigation. -
Improve mainframe handling (#174)
This PR skips setting the mainframe if it is already the same. It also adds sanity checks and protects the mainframe field behind a mutex.
Improvements
-
Move WebSocket test server to its own package (#166)
Refactors WebSocket test server and gives it a convenient to use interface:
twss := ws.NewServer(t, ws.WithCDPHandler("/cdp", handler, &cmdsReceived))
-
Revise, refactor, and improve the integration test suite (#140)
This work allows us to reason about the tests better, write them quickly, and provide a first step for reducing circular dependencies between packages. We discovered subtle concurrency bugs thanks to this work. Now we can easily write an integration test like:
newTestBrowser(t) newTestBrowser(t, withFileServer()) // See the issue for more details
Internals
-
Improve execution context logs (#176)
-
Propagate the internal logger to more entities (#151)
Increases the consistency of log messages and adds more detailed log messages to some entities such as
BrowserContext
,FrameManager
,FrameSession
,Page
,Request
, andSession
. -
Update dependencies (#155)
-
Introduce
NewNullLogger
for ease of testing (NewNullLogger)// Old way NewLogger(ctx, NullLogger(), false, nil) // New way NewNullLogger()