Flicker.Test (Flicker v0.1.0)

Copy Markdown View Source

A PhoenixTest helper for driving Flicker.select/1 the way a user would: open the picker, type to filter, pick a result.

Flicker does not depend on phoenix_test itself. Add {:phoenix_test, "~> 0.5", only: :test} to your own mix.exs to use this helper (most PhoenixTest users already have it).

Summary

Functions

Opens the palette identified by palette_id.

Opens the picker identified by select_id and types query into it.

Opens the picker identified by its required component id, types option_text into it to filter, then clicks the resulting option of the same text.

Functions

open_palette(session, palette_id)

@spec open_palette(struct(), String.t()) :: struct()

Opens the palette identified by palette_id.

Returns the session, ready for search/3 assertions or search_select/3.

search(session, select_id, query)

@spec search(struct(), String.t(), String.t()) :: struct()

Opens the picker identified by select_id and types query into it.

Returns the session after the provider's asynchronous search completes. Use this when asserting result-list contents without choosing an option.

search_select(session, select_id, option_text)

@spec search_select(struct(), String.t(), String.t()) :: struct()

Opens the picker identified by its required component id, types option_text into it to filter, then clicks the resulting option of the same text.

Returns the session for further PhoenixTest chaining.

Example

session
|> Flicker.Test.search_select("client-select", "Casey Cassidy")
|> PhoenixTest.assert_has("#selection", text: "Casey Cassidy")