Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot run wasm_bindgen_test on headless browsers #2151

Closed
TomPradat opened this issue May 24, 2020 · 9 comments
Closed

Cannot run wasm_bindgen_test on headless browsers #2151

TomPradat opened this issue May 24, 2020 · 9 comments
Labels

Comments

@TomPradat
Copy link

Describe the Bug

When trying to run a wasm_bindgen_test on a headless browser, i get the following error:

Running headless tests in Chrome on `http://127.0.0.1:41061/`
Try find `webdriver.json` for configure browser's capabilities:
Not found
driver status: signal: 9                          
driver stdout:
    Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 41061
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.

Error: non-200 response code: 404                 
{"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"#0 0x55e28740e579 \u003Cunknown>\n"}}

Steps to Reproduce

I followed the following guide https://rustwasm.github.io/docs/book/game-of-life

Expected Behavior

I'd expect the test to be able to run, or to have more indications on how to resolve it.

@TomPradat TomPradat added the bug label May 24, 2020
@TomPradat
Copy link
Author

wasm_game_of_life.zip

@alexcrichton
Copy link
Contributor

Are you sure your chromedriver version is up to date? Or it matches your version of chrome? Otherwise I'm not sure how to debug this myself.

@TomPradat
Copy link
Author

I'm working on WSL2, sorry i forgot to mention that

@TomPradat
Copy link
Author

This is probably a problem with the connection between WSL2 and windows so i'm closing this

@austintheriot
Copy link

I'm running into a very similar issue on Pop!_OS, trying to run wasm_bindgen_test with a headless chrome browser. @TomPradat I know this is like an ancient issue by now, but were you ever able to resolve it?

Here's the error I'm seeing after running wasm-pack test --chrome --headless

Running headless tests in Chrome on `http://127.0.0.1:45141/`
Try find `webdriver.json` for configure browser's capabilities:
Ok
driver status: signal: 9                          
driver stdout:
    Starting ChromeDriver 104.0.5112.79 (3cf3e8c8a07d104b9e1260c910efb8f383285dc5-refs/branch-heads/5112@{#1307}) on port 45141
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.

Error: non-200 response code: 404                 
{"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"#0 0x55bbe8885403 \u003Cunknown>\n#1 0x55bbe868b64b \u003Cunknown>\n#2 0x55bbe86b5a0b \u003Cunknown>\n#3 0x55bbe86e097c \u003Cunknown>\n#4 0x55bbe86de620 \u003Cunknown>\n#5 0x55bbe86dde47 \u003Cunknown>\n#6 0x55bbe8663584 \u003Cunknown>\n#7 0x55bbe86643e3 \u003Cunknown>\n#8 0x55bbe88cce3d \u003Cunknown>\n#9 0x55bbe88cfdb6 \u003Cunknown>\n#10 0x55bbe88b613e \u003Cunknown>\n#11 0x55bbe88d09b5 \u003Cunknown>\n#12 0x55bbe88aa970 \u003Cunknown>\n#13 0x55bbe86630a5 \u003Cunknown>\n#14 0x7fcf4be71b80 \u003Cunknown>\n#15 0x55bbe863136a \u003Cunknown>\n"}}
error: test failed, to rerun pass '--test app'
Error: Running Wasm tests with wasm-bindgen-test failed
Caused by: failed to execute `cargo test`: exited with exit status: 1
  full command: "cargo" "test" "--target" "wasm32-unknown-unknown"

@TomPradat
Copy link
Author

I'm running into a very similar issue on Pop!_OS, trying to run wasm_bindgen_test with a headless chrome browser. @TomPradat I know this is like an ancient issue by now, but were you ever able to resolve it?

It's been some time y !
If I recall right I didn't solve the problem, I suspected this was because of WSL2

Good luck with your problem !

@katopz
Copy link

katopz commented Oct 11, 2022

I just run into this today, not even work with pure generated wasm-pack-template

wasm-pack test --headless --chrome

got

Set timeout to 20 seconds...
Running headless tests in Chrome on `http://127.0.0.1:54155/`
Try find `webdriver.json` for configure browser's capabilities:
Not found
driver status: signal: 9 (SIGKILL)                
driver stdout:
    Starting ChromeDriver 106.0.5249.61 (511755355844955cd3e264779baf0dd38212a4d0-refs/branch-heads/5249@{#569}) on port 54155
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.

Error: non-200 response code: 404                 
{"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"0   chromedriver                        0x000000010ed97598 chromedriver + 4404632\n1   chromedriver                        0x000000010ed1efa3 chromedriver + 3911587\n2   chromedriver                        0x000000010e9cbd20 chromedriver + 425248\n3   chromedriver                        0x000000010e9f65e1 chromedriver + 599521\n4   chromedriver                        0x000000010ea21cac chromedriver + 777388\n5   chromedriver                        0x000000010ea1ec0d chromedriver + 764941\n6   chromedriver                        0x000000010ea1e35b chromedriver + 762715\n7   chromedriver                        0x000000010e9a214a chromedriver + 254282\n8   chromedriver                        0x000000010ed670ce chromedriver + 4206798\n9   chromedriver                        0x000000010ed6b797 chromedriver + 4224919\n10  chromedriver                        0x000000010ed72a4f chromedriver + 4254287\n11  chromedriver                        0x000000010ed6c4da chromedriver + 4228314\n12  chromedriver                        0x000000010ed4523f chromedriver + 4067903\n13  chromedriver                        0x000000010e9a1182 chromedriver + 250242\n14  libdyld.dylib                       0x00007fff67fc8cc9 start + 1\n"}}
error: test failed, to rerun pass '--test web'
Error: Running Wasm tests with wasm-bindgen-test failed

Workaround is

wasm-pack test --headless --firefox 

or w/ head

wasm-pack test --chrome 

Good luck for someone passing by.

@spanishpear
Copy link

spanishpear commented Oct 14, 2022

Also ran into this today - on a single file very small project.

attaching stacktrace for any future adventurers

[INFO]: Checking for the Wasm target...
    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
[INFO]: Installing wasm-bindgen...
    Finished test [unoptimized + debuginfo] target(s) in 0.03s
     Running unittests src/lib.rs (target/wasm32-unknown-unknown/debug/deps/mipsy_web-6e787a29ea4d3aec.wasm)
Set timeout to 20 seconds...
Executing bindgen...                              
                                                  
Running headless tests in Chrome on `http://127.0.0.1:44501/`
Try find `webdriver.json` for configure browser's capabilities:
Ok
Starting new webdriver session...                 
Visiting http://127.0.0.1:39469...                
                                                  
driver status: signal: 9 (SIGKILL)
driver stdout:
    Starting ChromeDriver 106.0.5249.61 (511755355844955cd3e264779baf0dd38212a4d0-refs/branch-heads/5249@{#569}) on port 44501
    Only local connections are allowed.
    Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
    ChromeDriver was started successfully.

                                                  
Error: non-200 response code: 404
{"value":{"error":"invalid session id","message":"invalid session id","stacktrace":"#0 0x560a2e5a62c3 \u003Cunknown>\n#1 0x560a2e3af700 \u003Cunknown>\n#2 0x560a2e3db067 \u003Cunknown>\n#3 0x560a2e406e3c \u003Cunknown>\n#4 0x560a2e403c90 \u003Cunknown>\n#5 0x560a2e40335b \u003Cunknown>\n#6 0x560a2e383ab4 \u003Cunknown>\n#7 0x560a2e3848a3 \u003Cunknown>\n#8 0x560a2e5f418e \u003Cunknown>\n#9 0x560a2e5f7622 \u003Cunknown>\n#10 0x560a2e5daaae \u003Cunknown>\n#11 0x560a2e5f82a3 \u003Cunknown>\n#12 0x560a2e5ceecf \u003Cunknown>\n#13 0x560a2e38355c \u003Cunknown>\n#14 0x7f2bc92e1d90 \u003Cunknown>\n"}}
error: test failed, to rerun pass '--lib'
Error: Running Wasm tests with wasm-bindgen-test failed
Caused by: failed to execute `cargo test`: exited with exit status: 1
  full command: "cargo" "test" "--target" "wasm32-unknown-unknown"

as the above, without headless works perfectly fine

@spanishpear
Copy link

Further research indicates this issue occurs when chromedriver and google-chrome are of different versions:
elixir-wallaby/wallaby#468 (comment)

I upgraded my google chrome to the latest version and it worked perfectly fine :)

Wallaby project has a script here: elixir-wallaby/wallaby#468 that may be useful for future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants