File tree Expand file tree Collapse file tree 7 files changed +28
-26
lines changed
Expand file tree Collapse file tree 7 files changed +28
-26
lines changed Original file line number Diff line number Diff line change 1+ defmodule Prima.WallabyCase do
2+ use ExUnit.CaseTemplate
3+
4+ using do
5+ quote do
6+ use Wallaby.Feature
7+ import Prima.WallabyTestHelpers
8+ end
9+ end
10+ end
Original file line number Diff line number Diff line change 1+ defmodule Prima.WallabyTestHelpers do
2+ @ moduledoc "Test helpers for headless browser tests"
3+ import Wallaby.Browser
4+ alias Wallaby.Query
5+
6+ @ doc """
7+ A better alternative to refute_has. The built-in refute_has will wait up to 3 seconds for the element to appear before giving up. This slows down the tests a lot.
8+ Assert_missing will return immediately if the element is indeed missing from DOM.
9+ """
10+ def assert_missing ( session , query ) do
11+ assert_has ( session , query |> Query . count ( 0 ) )
12+ end
13+ end
Original file line number Diff line number Diff line change 11defmodule PrimaWeb.AsyncModalTest do
2- use ExUnit.Case , async: true
3- use Wallaby.Feature
4-
5- def assert_missing ( session , query ) do
6- assert_has ( session , query |> Query . count ( 0 ) )
7- end
2+ use Prima.WallabyCase , async: true
83
94 @ modal_panel Query . css ( "#demo-form-modal [prima-ref=modal-panel]" )
105 @ modal_overlay Query . css ( "#demo-form-modal [prima-ref=modal-overlay]" )
Original file line number Diff line number Diff line change 11defmodule PrimaWeb.ComboboxTest do
2- use ExUnit.Case , async: true
3- use Wallaby.Feature
4-
5- def assert_missing ( session , query ) do
6- assert_has ( session , query |> Query . count ( 0 ) )
7- end
2+ use Prima.WallabyCase , async: true
83
94 @ combobox_container Query . css ( "#demo-combobox" )
105 @ search_input Query . css ( "#demo-combobox input[data-prima-ref=search_input]" )
Original file line number Diff line number Diff line change 11defmodule PrimaWeb.CreatableComboboxTest do
2- use ExUnit.Case , async: true
3- use Wallaby.Feature
4-
5- def assert_missing ( session , query ) do
6- assert_has ( session , query |> Query . count ( 0 ) )
7- end
2+ use Prima.WallabyCase , async: true
83
94 @ combobox_container Query . css ( "#demo-creatable-combobox" )
105 @ search_input Query . css ( "#demo-creatable-combobox input[data-prima-ref=search_input]" )
Original file line number Diff line number Diff line change 11defmodule PrimaWeb.DropdownTest do
2- use ExUnit.Case , async: true
3- use Wallaby.Feature
2+ use Prima.WallabyCase , async: true
43
54 @ dropdown_container Query . css ( "#dropdown" )
65 @ dropdown_button Query . css ( "#dropdown [aria-haspopup=menu]" )
76 @ dropdown_menu Query . css ( "#dropdown [role=menu]" )
87 @ dropdown_items Query . css ( "#dropdown [role=menuitem]" )
98
10- def assert_missing ( session , query ) do
11- assert_has ( session , query |> Query . count ( 0 ) )
12- end
13-
149 feature "shows dropdown menu when button is clicked" , % { session: session } do
1510 session
1611 |> visit ( "/fixtures/dropdown" )
Original file line number Diff line number Diff line change 11defmodule PrimaWeb.SimpleModalTest do
2- use ExUnit.Case , async: true
3- use Wallaby.Feature
2+ use Prima.WallabyCase , async: true
43
54 @ modal_panel Query . css ( "#simple-modal [prima-ref=modal-panel]" )
65 @ modal_overlay Query . css ( "#simple-modal [prima-ref=modal-overlay]" )
You can’t perform that action at this time.
0 commit comments