dave
08/27/2023, 12:34 PMclass RunWithPlaywrightTest {
private val app = routes(
"/foo" bind GET to { _: Request -> Response(OK).body("foo") },
"/" bind GET to { _: Request -> Response(OK).body("helloworld") }
)
@RegisterExtension
val playwright = RunWithPlaywright(app)
@Test
fun `provides http4k browser`(browser: Http4kBrowser) {
with(browser.newPage()) {
assertThat(String(navigateHome().body()), equalTo("helloworld"))
assertThat(String(navigate("/foo").body()), equalTo("foo"))
assertThat(String(navigate("<http://google.com>").body()), containsSubstring("google"))
}
}
}
Would love to incorporate any feedback or things you think are useful into it (or even if it has some massive flaw and is a terrible idea!) before we pull the trigger. 🙂dave
08/27/2023, 4:22 PMdmcg
08/27/2023, 9:37 PMdmcg
08/27/2023, 9:44 PMdave
08/28/2023, 7:01 AM