After upgrading to Phoenix LiveView 1.1.11, I encountered issues in my LiveView tests due to the introduction of Lazy_HTML—a struct that replaces the previously returned HTML string. Since LazyHTML does not implement the Enumerable protocol, any attempt to iterate over or pattern match against it using Enum functions results in a Protocol.UndefinedError. This change requires explicitly converting the struct to a string before performing assertions or content checks.
Hey @Nimalan,
you should not see LazyHTML structs when using the LiveViewTest API (like render Phoenix.LiveViewTest — Phoenix LiveView v1.2.5 ). Can you please clarify with some code where you’re having those issues?
Hi steffend,
thank you for your attention. Here i am giving the code block and the respective error.
{:ok, index_live, _html} =
conn |> log_in_user(sekserv_teamleiter_user_fixture()) |> live(~p"/cms/articles")
the error is,
(EXIT from #PID<0.1897.0>) an exception was raised:
** (Protocol.UndefinedError) protocol Enumerable not implemented for type LazyHTML (a struct). This protocol is implemented for the following type(s): DBConnection.PrepareStream, DBConnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, Floki.HTMLTree, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, Jason.OrderedObject, List, Map, MapSet, Phoenix.LiveView.LiveStream, Postgrex.Stream, Range, Scrivener.Page, Stream, Timex.Interval
Got value:
%LazyHTML{resource: #Reference<0.771119243.934936598.65676>}
(elixir 1.18.4) lib/enum.ex:1: Enumerable.impl_for!/1
(elixir 1.18.4) lib/enum.ex:166: Enumerable.reduce/3
(elixir 1.18.4) lib/enum.ex:1641: Enum.reduce_into_protocol/4
(elixir 1.18.4) lib/enum.ex:1625: Enum.into_protocol/3
(phoenix_live_view 1.1.11) lib/phoenix_live_view/test/client_proxy.ex:128: Phoenix.LiveViewTest.ClientProxy.init/1
(stdlib 6.2.2.2) gen_server.erl:2229: :gen_server.init_it/2
(stdlib 6.2.2.2) gen_server.erl:2184: :gen_server.init_it/6
(stdlib 6.2.2.2) proc_lib.erl:329: :proc_lib.init_p_do_apply/3
thank you.
If you want people to receive notifications then you should type @ and then the username. Pasting a link to their profile will not notify them.
thank you for your attention. I have solved the problem. It was dependency version mixed up. After i deleted the test deps and run,
mix deps.clean --all
mix deps.get
mix compile solved the problem.
Thank you.
thank you.






















