Skip to content

Commit 27f4680

Browse files
committed
Try connecting to chrome earlier
... so that it's less confusing when it doesn't work
1 parent 028706f commit 27f4680

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

internal/api/js/chrome/chrome.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ func RunHeadless(logPrefix string, onConsoleLog func(s string), requiresPersiste
156156
// chromedp.WithBrowserDebugf(log.Printf),
157157
))
158158

159+
// Make sure we can talk to Chrome before we start messing about with js-sdk
160+
fmt.Println("Starting chrome via chromedp")
161+
err := chromedp.Run(ctx, chromedp.Evaluate(`(() => 1)()`, nil))
162+
if err != nil {
163+
return nil, fmt.Errorf("failed to run test evaluation via chromedp: %w", err)
164+
}
165+
159166
// Listen for console logs for debugging AND to communicate live updates
160167
chromedp.ListenTarget(ctx, func(ev interface{}) {
161168
switch ev := ev.(type) {

0 commit comments

Comments
 (0)