-
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.
Answered by
ysmood
Jun 27, 2024
Replies: 1 comment 3 replies
-
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.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It depends how your http server is designed, such as: