elixir-wallaby / wallaby

Concurrent browser tests for your Elixir web apps.
https://twitter.com/elixir_wallaby
MIT License
1.68k stars 198 forks source link

LiveView testing with chromedriver results in errors #683

Closed jmeinerz closed 2 years ago

jmeinerz commented 2 years ago

LiveView testing with chromedriver results in errors

I am getting not-so-great results when testing LiveViews with Wallaby.

Locally my tests pass, but the tests log a lot of stuff:

 % mix test
...................................................................................................................................................."phx-FuXFB0RdDnhUigPL mount:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL update:  - " Object
"phx-FuXFB0RdDnhUigPL error: view crashed - " undefined
.............

Finished in 3.5 seconds (0.6s async, 2.9s sync)
3 features, 158 tests, 0 failures

When running on GitHub Actions, the feature tests fail. They pass if I don't visit any LiveView.

I've also ran it locally with Selenium (Geckodriver) and that worked, but I am hesitant to change from Chromedriver to Selenium.

Details

Elixir: 1.13.3 Erlang: 24.3.1 OS: MacOS (local) / Ubuntu (CI) Webdriver (selenium, chromedriver, geckodriver, etc): chromedriver Browser (Chrome, Firefox, Safari, etc): Chrome Local or CI: Weird logs locally, failing on CI (GitHub Actions)

mhanberg commented 2 years ago

Hi, I believe this is a live view issue that automatically enables debug mode on the JS client, which outputs all of these logs.

You can disable the logs by putting liveSocket.disableDebug(); in your javascript code when you are initializing the LiveSocket.