Use httptest to serve wasm test files.

This picks a port automatically, so avoids any conflicts that might
arise from running the tests in parallel.
This commit is contained in:
Elliott Sales de Andrade
2020-12-22 17:56:53 -05:00
committed by Ron Evans
parent 5bae55d755
commit f3bdebe2a6
6 changed files with 40 additions and 34 deletions
+4 -1
View File
@@ -13,6 +13,9 @@ func TestEvent(t *testing.T) {
t.Parallel()
wasmTmpDir, server, cleanup := startServer(t)
defer cleanup()
err := run("tinygo build -o " + wasmTmpDir + "/event.wasm -target wasm testdata/event.go")
if err != nil {
t.Fatal(err)
@@ -23,7 +26,7 @@ func TestEvent(t *testing.T) {
var log1, log2 string
err = chromedp.Run(ctx,
chromedp.Navigate("http://localhost:8826/run?file=event.wasm"),
chromedp.Navigate(server.URL+"/run?file=event.wasm"),
chromedp.WaitVisible("#log"),
chromedp.Sleep(time.Second),
chromedp.InnerHTML("#log", &log1),