live_svelte/example_project/test/support/feature_case.ex
Denis Donici bfdae993c2
feat/add comprehensive e2e testing (#207)
* add an exmaple with a static svelte component in a live view parent with list

* adjusted the styling of example

* chore: added more e2e tests

* chore: preserve client state

* chore: added tests for simple counter

* chore: added live lights e2e tests

* chore: added sigil e2e tests

* chore: added plus/minus tests

* chore: added live plus/minus tests

* chore: added hybrid plus/minus tests

* chore: added static color demo tests

* fix: handle correctly v sigil props

* chore: added tests to log list example

* chore: added tests to breaking news example

* chore: added chat tests

* chore: added tests for live json

* chore: added tests for simple slots

* chore: added tests for dynamic slots. added missing test ids

* chore: add tests to client loading

* chore: addes tests to otp ecto example

* chore: prepare for 0.17.4 release
2026-02-18 21:30:17 +02:00

32 lines
863 B
Elixir

defmodule ExampleWeb.FeatureCase do
@moduledoc """
Case for browser E2E tests using Wallaby.
Use `@tag :e2e` on tests and run with: mix test --only e2e
"""
use ExUnit.CaseTemplate
using do
quote do
use Wallaby.DSL
@endpoint ExampleWeb.Endpoint
end
end
setup tags do
# Start Wallaby only when running E2E tests (avoids requiring chromedriver for plain mix test).
# If chromedriver is not installed, setup will fail; run `mix test --exclude e2e` to skip E2E.
{:ok, _} = Application.ensure_all_started(:wallaby)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Example.Repo)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Example.Repo, {:shared, self()})
end
{:ok, session} = Wallaby.start_session()
on_exit(fn -> Wallaby.end_session(session) end)
{:ok, session: session}
end
end