Excessibility.Source protocol (Excessibility v0.5.13)
View SourceProtocol for extracting HTML from various test sources.
Excessibility uses this protocol to support multiple test source types:
Plug.Conn- Phoenix controller test responsesWallaby.Session- Browser-based feature test sessionsPhoenix.LiveViewTest.View- LiveView test viewsPhoenix.LiveViewTest.Element- LiveView test elements
Extending
To add support for a custom source type, implement this protocol:
defimpl Excessibility.Source, for: MyCustomSource do
def to_html(source) do
# Return HTML string or Floki-parsed tree
MyCustomSource.get_html(source)
end
end
Summary
Functions
Converts a test source into HTML content.
Types
@type t() :: term()
All the types that implement this protocol.