Integration testing Phoenix LiveView apps

What is the best way to do integration testing in phoenix live view, I have tried setting up wallaby but does not to work as expected.

I could use the built-in testing but is there a way I can continue using wallaby with live view?


What exactly didn’t work? Were there any errors?

My impression is Wallaby still only supports PhantomJS which has been abandoned for a few years now. I think this is a dead-end. I’d love to be corrected though. Hound supports a few other drivers.

At work we use Cypress and I love it. You have to do a little extra work to build test fixtures (we use a shared fixtures controller in test) and to integrate SQL sandboxing, but it is an extremely productive environment for building and debugging E2E tests. After a failure you can inspect all the state - what the screen looked like and all the DOM nodes, what the network payloads were - at every step of the test and usually instantly see where things are going wrong. We haven’t needed their paid product.

1 Like

Wallaby also supports Chromedriver and Selenium and no longer requires PhantomJS. It still says the support is “experimental” but it works great for me. I found it worked better with JS-heavy pages than Hound but YMMV. Have not tried it with LiveView yet… seems like it should work.

I finaly managed to set this up but the problem is that live view events are not being handled when we send a click event via wallaby

For example when I click on the delete button, it finds the button and click on it but the user is not deleted. The delete event is handled by phoenix live view

1 Like

Just setup Wallaby today, and the first button I attempted to press was a live_link…
Will try to go with Cypress now.

Is cypress working well for you?

I followed this guide:
Took me around an hour to get setup and have my first test running.

1 Like

hi Doerge, did you set it up on an Ecto 2.x or 3.x project? I see the note about it being different, and I’m just going through setting things up now.

I set it up for Ecto3. I think it worked as is, or a with a simple google for the right module api.

1 Like

Would you mind sharing the few changes you made, for the sake of future readers who might want to implement it. I will try set this up later in the week

1 Like