Plushie.Test.Case (Plushie v0.7.1)

Copy Markdown View Source

ExUnit case template for testing Plushie apps.

Starts a real Plushie app (Runtime + Bridge) connected to the shared renderer session pool before each test, and stops it on exit.

Usage

defmodule MyApp.CounterTest do
  use Plushie.Test.Case, app: MyApp.Counter

  test "clicking increment updates counter" do
    click("#increment")
    assert find!("#count") |> text() == "1"
  end
end

Selectors

All interaction helpers (click/1, find!/1, type_text/2, etc.) accept the following selector forms:

  • "#save" matches a unique local widget ID
  • "#form/save" matches an exact scoped ID
  • {:text, "Save"} matches visible text (content, label, value, placeholder)
  • {:role, "button"} matches an accessibility role
  • {:label, "Save"} matches an accessibility label
  • :focused matches the currently focused element

Bare strings without a # prefix are not valid selectors. Use {:text, "Save"} to match by visible text content.