You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, for some reason my tests work in real Chrome but not when run in chromedp.
Full error which only occurs in WSL with chromedp:
[wasmbrowsertest]: 2020/02/04 23:01:50 main.go:214: {"type":"object","subtype":"error","className":"TypeError","description":"Ty
peError: Could not download wasm module","objectId":"{\"injectedScriptId\":2,\"id\":1}","preview":{"type":"object","subtype":"er
ror","description":"TypeError: Could not download wasm module","overflow":false,"properties":[{"name":"stack","type":"string","v
alue":"TypeError: Could not download wasm module"},{"name":"message","type":"string","value":"Could not download wasm module"}]}
}
git clone https://gitlab.com/polyapp-open-source/build-wasm
cd build-wasm
git checkout 1-create-and-run-integration-tests-which-require-a-browser
Inspect the test_build_run.sh script for errors in your environment.
This next step will start a convenient web server.
./test_build_run.sh
This next step is, finally, where the problem is.
./test_integration.sh
The Problem
Finally, we can see the problem. If you navigate to localhost:4200 and open dev tools, you see this, which is 100% exactly what I expect to see and is made possible by running the integration testing wasm file when you load the web server started with ./test_build_run.sh:
--- FAIL: TestAlwaysFail (0.00s)
wasm_exec.js:41 main_integration_test.go:20: always fail
wasm_exec.js:41 FAIL
(index):46 go program terminated
wasm_exec.js:487 Uncaught Error: Go program has already exited
at global.Go._resume (wasm_exec.js:487)
at wasm_exec.js:500
at XMLHttpRequest.req.onload ((index):62)
_resume @ wasm_exec.js:487
(anonymous) @ wasm_exec.js:500
req.onload @ (index):62
load (async)
fetchWrapper @ (index):61
syscall/js.valueCall @ wasm_exec.js:327
syscall_js.valueCall @ wasm-0200847e-1263:1
syscall_js.Value.Call @ wasm-0200847e-1249:1
gitlab.com_polyapp_open_source_build_wasm_cmd_frontend.ButtonPressCallback @ wasm-0200847e-2843:1
gitlab.com_polyapp_open_source_build_wasm_cmd_frontend.TestButtonPressCallback @ wasm-0200847e-2848:1
testing.tRunner @ wasm-0200847e-2253:1
wasm_pc_f_loop @ wasm-0200847e-964:1
wasm_export_run @ wasm-0200847e-962:1
run @ wasm_exec.js:478
(anonymous) @ (index):45
Promise.then (async)
(anonymous) @ (index):41
(anonymous) @ (index):53
Now consider the output from running the test_integration script in build-wasm, which is running chromedp in headless mode:
integration testing WASM code GOOS=js; GOARCH=wasm
2020/02/04 23:22:12 reached special case
[wasmbrowsertest]: 2020/02/04 23:22:12 main.go:176: exit code seen: 0
[wasmbrowsertest]: 2020/02/04 23:22:12 main.go:214: {"type":"object","subtype":"error","className":"TypeError","description":"Ty
peError: Could not download wasm module","objectId":"{\"injectedScriptId\":2,\"id\":1}","preview":{"type":"object","subtype":"er
ror","description":"TypeError: Could not download wasm module","overflow":false,"properties":[{"name":"stack","type":"string","v
alue":"TypeError: Could not download wasm module"},{"name":"message","type":"string","value":"Could not download wasm module"}]}
}
integration testing everything else GOOS=default; GOARCH=default
ok gitlab.com/polyapp-open-source/build-wasm/cmd/backend (cached)
? gitlab.com/polyapp-open-source/build-wasm/cmd/webserver [no test files]
There are 2 problems here, only 1 of which is baffling. First, the test failed yet a non-0 exit code was produced (this is fixed in #13 ). Second, we see the error is occurring because the wasm file did not download. I have no idea why my simple web server is capable of serving the WASM file to a real Chrome instance running on Windows yet this similar clone running inside wasmbrowsertest isn't able to serve to Chromium in headless mode. I'm especially baffled because I basically copied the server from the existing wasmbrowsertest web server in handler.go. For your amusement, you can mess with func (ws *simpleWebServer) ServeHTTP in wasmbrowsertest/main.go by, say, eliminating the special case for wasm code. Rebuild with the scripts as before and notice you get the same result.
Summary and Speculation
For some reason my tests work in real Chrome but not when run in chromedp.
One of the following could be true:
Chromium in WSL seems to be handling a served WASM file differently than Chrome in Windows (by not loading it? - seems unlikely since it works with the regular wasmbrowsertest).
github.com/chromedp/chromedp is not setting up Chromium correctly in WSL for it to receive said WASM file. This doesn't really make sense to me because chromedp has loaded the file correctly before, as noted above.
There's something wrong with my test setup which leads the WASM file to not be downloaded by my wasmbrowsertest branch, but yet another web server I have works, and wasmbrowsertest 's regular setup also works. After staring at index.html for a while I don't see any important differences when we're calling WebAssembly.instantiateStreaming
I suppose I could also post this Issue on chromedp's repo, or just keep plugging away until i figure it out.
The text was updated successfully, but these errors were encountered:
Basically, for some reason my tests work in real Chrome but not when run in chromedp.
Full error which only occurs in WSL with chromedp:
See the source code: https://chromium.googlesource.com/chromium/src/+/70d7b68f1669306da4c713c7e4d4b0be97a13ab8/third_party/WebKit/Source/bindings/modules/v8/wasm/WasmResponseExtensions.cpp
And a tangentially related commit: https://chromium-review.googlesource.com/c/chromium/src/+/876103
Reproduction
Reproduction first involves getting the testing setup, and then getting the actual project to test against.
Testing Setup
Then inspect the script test_build_install.sh for errors for your environment
Project to test against
first go somewhere outside a repo. Then...
Inspect the test_build_run.sh script for errors in your environment.
This next step will start a convenient web server.
This next step is, finally, where the problem is.
The Problem
Finally, we can see the problem. If you navigate to localhost:4200 and open dev tools, you see this, which is 100% exactly what I expect to see and is made possible by running the integration testing wasm file when you load the web server started with ./test_build_run.sh:
Now consider the output from running the test_integration script in build-wasm, which is running chromedp in headless mode:
There are 2 problems here, only 1 of which is baffling. First, the test failed yet a non-0 exit code was produced (this is fixed in #13 ). Second, we see the error is occurring because the wasm file did not download. I have no idea why my simple web server is capable of serving the WASM file to a real Chrome instance running on Windows yet this similar clone running inside wasmbrowsertest isn't able to serve to Chromium in headless mode. I'm especially baffled because I basically copied the server from the existing wasmbrowsertest web server in handler.go. For your amusement, you can mess with
func (ws *simpleWebServer) ServeHTTP
in wasmbrowsertest/main.go by, say, eliminating the special case for wasm code. Rebuild with the scripts as before and notice you get the same result.Summary and Speculation
For some reason my tests work in real Chrome but not when run in chromedp.
One of the following could be true:
I suppose I could also post this Issue on chromedp's repo, or just keep plugging away until i figure it out.
The text was updated successfully, but these errors were encountered: