MCPcopy Create free account
hub / github.com/basecamp/hey-cli / fetchHTML

Function fetchHTML

tests/smoke/helpers_test.go:408–431  ·  view source on GitHub ↗

--------------------------------------------------------------------------- Server-side verification helpers --------------------------------------------------------------------------- fetchHTML fetches a page via HTTP using the session cookie and returns the raw HTML body. This is a lightweight alt

(t *testing.T, url string)

Source from the content-addressed store, hash-verified

406func browserPageText(t *testing.T, pageURL string) string {
407 t.Helper()
408
409 ctx, ctxCancel, allocCancel := newBrowserContext()
410 defer ctxCancel()
411 defer allocCancel()
412
413 tCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
414 defer cancel()
415
416 // Set session cookie directly instead of doing a full login flow.
417 // This avoids loading the heavy post-login homepage which can crash Chrome.
418 parsed, err := url.Parse(baseURL)
419 if err != nil {
420 t.Fatalf("failed to parse baseURL %q: %v", baseURL, err)
421 }
422 cookieDomain := parsed.Hostname()
423 if err := chromedp.Run(tCtx,
424 network.SetCookie("session_token", sessionCookie).
425 WithDomain(cookieDomain).
426 WithPath("/").
427 WithHTTPOnly(true),
428 ); err != nil {
429 t.Fatalf("failed to set session cookie: %v", err)
430 }
431
432 var text string
433 if err := chromedp.Run(tCtx,
434 chromedp.Navigate(pageURL),

Callers 15

TestTodoCRUDFunction · 0.85
TestTodoAddWithDateFunction · 0.85
TestComposeFunction · 0.85
TestThreadsFunction · 0.85
TestReplyFunction · 0.85
TestTimetrackingFunction · 0.85
TestTimetrackListFunction · 0.85
TestSeenUnseenFunction · 0.85
TestBoxesListFunction · 0.85
TestBoxImboxFunction · 0.85
TestJournalWriteAndReadFunction · 0.85
TestJournalListFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected