-
Hi, I use rod for ui e2e testing. I have http server that I want to start before each test case with some conditions. so how to do this ? |
Beta Was this translation helpful? Give feedback.
-
I usually use the got test lib with rod: package rod_test
import (
"testing"
"github.com/go-rod/rod"
"github.com/ysmood/got"
)
func TestServer(t *testing.T) {
g := got.T(t)
router := g.Serve()
router.Route("/a", ".html", `
<html>
<body>ok</body>
</html>
`)
page := rod.New().MustConnect().MustPage(router.URL("/a"))
g.Eq(
page.MustElement("body").MustText(),
"ok",
)
} |
Beta Was this translation helpful? Give feedback.
It depends how your http server is designed, such as: