joshamb

joshamb

LiveView uses Playwright for e2e testing, whilst also shipping with LiveViewTest

They both have there pros, but the biggest ones (to me) are:

  • Playwight - codegen (the ability to interactively create your tests in the browser very quickly)
  • LiveViewTest - (is probably) a lot quicker to run a significant amount of tests & native integration for component testing

I was wondering how other people decide when to use which one, or if they only use either Playwight or LiveViewTest (or another!).

From how I see it, LiveViewTest has the advantage of it being able to do both component and e2e tests, however it’s much quicker (for a developer) to make e2e tests in Playwright.

First 4 of 4 Posts Switch mode

D4no0

D4no0

For e2e tests, there is also Wallaby.

It’s all about whether you want a battery-included solution or you are OK with doing/maintaining a part of the setup yourself. LiveViewTest as you mentioned is a unified tool for all your phoenix test needs, it requires zero setup if you have a phoenix project, but at the same time it’s obviously not as flexible as using the dependency directly.

axelson

axelson

Scenic Core Team

To me the biggest consideration is that if you need to execute your js hooks then you’ll need a full e2e runner like Playwright or Wallaby since LiveViewTest runs only the Elixir code.

LostKobrakai

LostKobrakai

There’s currently work happening on phoenix_test to make playwright another driver for it, so switching to it would become a config switch.

fteschke

fteschke

Here’s the mentioned Playwright driver for PhoenixTest:

defmodule Features.RegisterTest do
  use PhoenixTest.Playwright.Case

  @tag trace: :open                      # replay in interactive viewer
  test "register", %{conn: conn} do
    conn
    |> visit(~p"/")
    |> click_link("Register")
    |> fill_in("Email", with: "f@ftes.de")
    |> click_button("Create an account")
    |> assert_has(".text-rose-600", text: "required")
  end
end
— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

We're in Beta

About us Mission Statement