Testing LiveView

The fastest way to learn how to test LiveView. Deploy to production with peace of mind.

Completely updated for Phoenix 1.7 and LiveView 0.20

So, I have a problem...

LiveView is amazing for building interactive applications! ๐Ÿคฉ

I know it. You know it. Even grandma knows it.

So everyone is rushing to learn how to build LiveView apps. (yes, even grandma)

But who knows how to test LiveView? ๐Ÿค”




That's right. No one. No one.

I've scoured the earth. There are no resources. ๐Ÿ˜ฉ

Wait. What's that you see? ๐Ÿ‘€


Someone is raising their hand?

They say they've learned how to test LiveView? That they've mastered it?

Pish posh.

  • You and I know LiveView comes with a set of brand new testing tools. It would take years to master that.
  • And we both know LiveView uses a proxy process to act as the browser. This isn't your run of-the mill Chromedriver-executing-things-on-a-page test.
  • And have you heard? Turns out we can write tests that seem correct but fail to test large portions of our LiveView code! ๐Ÿ˜ฑ

Don't believe him. He's a charlatan.


He says what?! ๐Ÿ˜ณ

He'll show you AND teach you all his tricks!?

  • ... that he crafted his lessons from experience testing LiveView applications in the wild? ๐Ÿ˜ฎ
  • ... and refined by a decade of experience practicing test-driven development? ๐Ÿ˜ฒ
  • ... that you'll learn how to write fast, robust, and easy-to-maintain LiveView tests?! ๐Ÿคฏ

Impossible! ๐Ÿ˜ก

Those are trade secrets! No one in their right mind would teach that!

I know. Call... his... bluff. ๐Ÿ˜

Demand he show you what he'll teach you.... I bet he has nothing.

What?! ๐Ÿ˜ณ He'll show you?

Here's what you'll learn

We'll cover everything you need to know. From fundamentals to mastery.

(All in the super sweet context of The Lord of the Rings, of course)

  • Testing Rendering

    The basics of setting up a LiveView test, rendering the LiveView, and making an assertion.

  • Scoping Assertions

    Let's get more precise about what we expect from LiveView's UI without getting more coupled to it.

  • Testing Interactions

    Test interactivity from the perspective of the user. We'll learn to target elements, click them, and expect responses users can see.

  • Testing Async Assigns

    Learn how to write tests that can handle asynchronous assigns! We cover the naive approach, followed by the best approach, and we even consider how to test failure cases.

  • Debugging LiveView Tests

    Tests can sometimes fail in mysterious ways. Learn how to inspect our LiveView tests so we can get unstuck.

  • Testing Forms

    Learn how to test (and how not to test) the bread and butter of the web: forms.

  • Testing Form Changes

    LiveView's forms are interactive. Learn how to test dynamic form changes.

  • Testing Function Components

    Phoenix is all in on components. Learn what to test (and what not to test) when it comes to function components.

A directory page from one of the Testing LiveView lessons Terminal showing test error
  • Testing LiveComponents

    Learn how to test LiveComponents. We'll see which parts to test directly and which to test through the parent LiveView.

  • Testing Live Navigation

    LiveView has different ways of navigating across pages: LiveView to LiveView (same session), LiveView to LiveView (different sessions), and LiveView to non-LiveView. That's a lot! But don't worry. We'll cover how to effectively test all those navigations.

  • Testing Live Patch

    Learn to test live patches. I'll share my unique approach on how to test that same code with less coupling! (That's not something you can learn anywhere else -- even LiveView's docs)

  • Testing JS Hooks

    Learn to test JS hooks. And more importantly, discover our tests' limitations when it comes to JavaScript!

  • Testing Upload Previews

    LiveView comes with wonderful uploads previews out of the box! Learn how to use the helpers needed to ensure the previews are working correctly!

  • Testing Uploads (Direct to Server)

    Learn to test LiveView uploads when we're uploading them directly to our servers.

  • Testing Uploads (Direct to Cloud)

    And learn to test uploads when we're uploading them to the cloud!

Todos lesson from Testing LiveView course Terminal showing test error

โญ๏ธ Bonus: CSS Selectors for Tests

Testing LiveView requires us to use CSS selectors to target elements. But which selectors should you use? Don't worry. I include a bonus lesson on my personal approach to using CSS selectors in tests.

I hope you find it helpful and insightful — even if you opt for a different approach.

โญ๏ธ Bonus: Detailed Notes with Every Lesson

I know I don't always remember exactly what I learned. I just remember that I learned it. ๐Ÿ˜…

So, when I buy something, I want to be able to reference the contents I've seen before. But that is tough with videos (ever scrub through video to find a good landing spot? No, not that spot. Not that one either. I know, me too ๐Ÿ˜ช).

It's way faster to skim and search text! โญ๏ธ

That's why I include detailed summaries for each lesson! ๐ŸŽ‰ You can always come back and find what you need quickly.

Don't believe me? Ask Josh! ๐Ÿ‘‡

"What if I don't learn how to test LiveView?"

I'm confident this course will teach you how to test LiveView.

But I don't want you to sweat it. ๐Ÿ˜ฅ I know this is a leap of faith.

That's why I offer my Learn to test guarantee! โœจ

Learn to test guarantee

If you don't learn how to test LiveView by the time you finish the course, I will give you a full refund.

If you don't learn, I don't earn.

So, if you want a risk-free, guided tour to learn to test LiveView like a pro, click the Get Full Course button (put that credit card in there), and embark on this epic journey!


Individual License

$149 $99
  • All videos

  • Access to the source code with detailed commits

  • Detailed notes for all videos so you can quickly reference anything without having to scrub through the video

  • Share your thoughts and questions on any lesson along with other Elixirists

  • Suggest topics for future videos

Team Log In

  • Get 5 simultaneous sessions for your team with a single shared login (such as dev@yourcompany.com)

  • Everything from the individual license

  • Share that login with your team guilt-free!

Curious what people think of the course? ๐Ÿ‘‡

This was the biggest instructive course I've learned in my elixir journey. Thank you so much for all your efforts

โ€” Shahryar Tavakkoli

Hot damn! This was a thorough, amazing and thoughtfully organized course! Amazing work. Much respect.

โ€” Benjamin Shepard

Going into this I thought $100 is a bit much, but now I can see how much work went into this making it all simple and easy to understand.

Totally worth it.

You've struck a great balance between showing how to write tests and application without getting sidetracked with other app details. You've upgraded my skills. Thanks again!

โ€” Krister Viirsaar

I can't thank you enough for the course! It's allowed me to get comfortable with Elixir and Phoenix LiveView quickly as my career shifted from data science (C++, Python, R) to web-app testing & development.

Other frequently asked questions

Canโ€™t find the answer youโ€™re looking for?

Send me an email

Who is this course for?
Developers who want to learn to test LiveView effectively, without creating tests that are brittle, slow, and hard to maintain.
What are the videos like?
Tons of live coding. Each video should feel a little like you're pairing with me.
Do I need to know how to use LiveView?
Yes. I assume you have knowledge of LiveView in the course. You don't need to be an expert, but it helps if you've seen it before. If you've never used LiveView, I recommend The Pragmatic Studio's LiveView Course .
What's your refund policy?
I offer my Learn to Test Guarantee. If you don't learn how to test LiveView by the time you're done with the course, I'll give you a refund. If you don't learn, I don't earn.
What if I live in a different country?
If the course is too expensive because you live in a different country, I'm happy to give you a discount. Just send me an email with the country where you live, along with a suggested reasonable price for your country, and I'll send you a discount code.
German Velasco

About Me

German Velasco

I've been practicing test-driven development for more than a decade.

Testing is my passion. I love thinking about it, iterating on practices, and figuring out how to write tests that are valuable, stable, and easy to maintain.

You might recognize me from my one of my short video tips I share weekly , my Testing LiveView ElixirConf talk , my TDD Phoenix book , or one of my blog posts .

For the past ten years, I've been helping teams deal with slow test suites, intermittent failures, difficult test cases, and more.