I very much echo the “great article” sentiments and thank you for making me aware of TAP!
I have a somewhat similar helper as your assert_html for LiveView tests to narrow down text within a certain element which I find myself doing a fair bit often:
defmacro assert_within(lv, selector, text_or_regex) do
quote do
assert unquote(lv)
|> element(unquote(selector))
|> render() =~ unquote(text_or_regex)
end
end
assert_within(lv, ".comments", "Product was definitely broken when it arrived, please send another.")


















