feat: add playwright and a11y audit and example test
This commit is contained in:
parent
96085ea420
commit
c6be9b5104
19 changed files with 133 additions and 2 deletions
23
test/e2e/a11y/a11y_test.exs
Normal file
23
test/e2e/a11y/a11y_test.exs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
defmodule MvWeb.A11yTest do
|
||||
use PhoenixTest.Playwright.Case, async: true
|
||||
|
||||
alias PhoenixTest.Playwright.Frame
|
||||
|
||||
test "is accessible", %{conn: conn} do
|
||||
conn = conn_with_oidc_user(conn)
|
||||
conn = Plug.Test.init_test_session(conn, locale: "de")
|
||||
{:ok, _view, html} = live(conn, "/members")
|
||||
conn
|
||||
#|> visit("/members")
|
||||
|> unwrap(&assert_a11y/1)
|
||||
end
|
||||
|
||||
defp assert_a11y(%{frame_id: frame_id}) do
|
||||
Frame.evaluate(frame_id, A11yAudit.JS.axe_core())
|
||||
|
||||
frame_id
|
||||
|> Frame.evaluate("axe.run()")
|
||||
|> A11yAudit.Results.from_json()
|
||||
|> A11yAudit.Assertions.assert_no_violations()
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue