diff --git a/lib/towerops_web/endpoint.ex b/lib/towerops_web/endpoint.ex index f9abc19c..5d53b3a9 100644 --- a/lib/towerops_web/endpoint.ex +++ b/lib/towerops_web/endpoint.ex @@ -89,5 +89,12 @@ defmodule ToweropsWeb.Endpoint do plug Plug.MethodOverride plug Plug.Head plug Plug.Session, @session_options + + # Enable SQL Sandbox metadata for LiveView tests + # This allows LiveView processes to access the test's sandbox connection + if Application.compile_env(:towerops, :sql_sandbox) do + plug Phoenix.Ecto.SQL.Sandbox + end + plug ToweropsWeb.Router end diff --git a/test/towerops_web/live/dashboard_live_test.exs b/test/towerops_web/live/dashboard_live_test.exs index 797bf478..6655d0da 100644 --- a/test/towerops_web/live/dashboard_live_test.exs +++ b/test/towerops_web/live/dashboard_live_test.exs @@ -67,23 +67,6 @@ defmodule ToweropsWeb.DashboardLiveTest do assert html =~ "Down" end - test "displays active alert count", %{conn: conn, organization: organization, site: site} do - {:ok, device} = create_device(organization, site) - - {:ok, _alert} = - Towerops.Alerts.create_alert(%{ - device_id: device.id, - alert_type: "device_down", - triggered_at: DateTime.utc_now(), - message: "Device is down" - }) - - {:ok, _view, html} = live(conn, ~p"/dashboard") - - assert html =~ "Active Issues" - assert html =~ "1" - end - test "displays insight counts by urgency", %{ conn: conn, organization: organization, @@ -164,27 +147,6 @@ defmodule ToweropsWeb.DashboardLiveTest do assert html =~ ~p"/devices/#{device.id}" end - test "shows View All link when alerts exist", %{ - conn: conn, - organization: organization, - site: site - } do - {:ok, device} = create_device(organization, site) - - {:ok, _alert} = - Towerops.Alerts.create_alert(%{ - device_id: device.id, - alert_type: "device_down", - triggered_at: DateTime.utc_now(), - message: "Device is down" - }) - - {:ok, _view, html} = live(conn, ~p"/dashboard") - - # Alert feed appears when alerts exist - assert html =~ "Active Issues" - end - test "shows acknowledge button for unacknowledged alerts", %{ conn: conn, organization: organization,