Skip to main content

Tester

Class that programmatically interacts with page controls and the test environment.

Inherits: Service

Methods

  • drag - Drag from the center of the given control by the provided offset.
  • drag_from - Drag from the given start offset by the provided offset delta.
  • enter_text - Give the text input control specified by finder the focus and replace its content with text, as if it had been provided by the onscreen keyboard.
  • find_by_icon - Finds controls by an icon.
  • find_by_key - Finds controls by a Key instance or key name.
  • find_by_text - Finds controls containing string equal to the text argument.
  • find_by_text_containing - Finds controls containing specified text pattern.
  • find_by_tooltip - Finds controls by a tooltip.
  • long_press - Dispatch a pointer down / pointer up sequence (with a delay of 600 ms between the two events) at the center of the given control, assuming it is exposed.
  • mouse_click - Dispatch a primary mouse click at the center of the given control.
  • mouse_click_at - Dispatch a primary mouse click at the given offset.
  • mouse_double_click - Dispatch a primary mouse double click at the center of the given control.
  • mouse_double_click_at - Dispatch a primary mouse double click at the given offset.
  • mouse_hover - Dispatch a pointer hover event at the center of the given control.
  • pump - Triggers a frame after duration amount of time.
  • pump_and_settle - Repeatedly calls pump until there are no longer any frames scheduled.
  • right_mouse_click - Dispatch a secondary mouse click at the center of the given control.
  • right_mouse_click_at - Dispatch a secondary mouse click at the given offset.
  • take_screenshot - Takes a screenshot of the entire application window.
  • tap - Dispatch a pointer down / pointer up sequence at the center of the given control, assuming it is exposed.
  • tap_at - Dispatch a pointer down / pointer up sequence at the given offset.
  • teardown - Teardown Flutter integration test and exit Flutter process.

Methods

dragasync

drag(finder: Finder, offset: Offset)

Drag from the center of the given control by the provided offset.

Parameters:

  • finder (Finder) - Finder to search for a control.
  • offset (Offset) - Offset delta to drag by.

drag_fromasync

drag_from(start: Offset, offset: Offset)

Drag from the given start offset by the provided offset delta.

Parameters:

  • start (Offset) - Initial pointer location.
  • offset (Offset) - Offset delta to drag by.

enter_textasync

enter_text(finder: Finder, text: str)

Give the text input control specified by finder the focus and replace its content with text, as if it had been provided by the onscreen keyboard.

Parameters:

  • finder (Finder) - Finder to search for a control.
  • text (str) - The text to enter.

find_by_iconasync

find_by_icon(icon: IconData) -> Finder

Finds controls by an icon.

Parameters:

  • icon (IconData) - The Icon to search by.

find_by_keyasync

find_by_key(key: KeyValue) -> Finder

Finds controls by a Key instance or key name.

Parameters:

  • key (KeyValue) - A key instance or its name.

find_by_textasync

find_by_text(text: str) -> Finder

Finds controls containing string equal to the text argument.

Parameters:

  • text (str) - The exact text value to search control by.

find_by_text_containingasync

find_by_text_containing(pattern: str) -> Finder

Finds controls containing specified text pattern.

Parameters:

  • pattern (str) - Regular expression pattern.

find_by_tooltipasync

find_by_tooltip(value: str) -> Finder

Finds controls by a tooltip.

Parameters:

  • value (str) - Tooltip value.

long_pressasync

long_press(finder: Finder)

Dispatch a pointer down / pointer up sequence (with a delay of 600 ms between the two events) at the center of the given control, assuming it is exposed.

Parameters:

  • finder (Finder) - Finder to search for a control.

mouse_clickasync

mouse_click(finder: Finder)

Dispatch a primary mouse click at the center of the given control.

Parameters:

  • finder (Finder) - Finder to search for a control.

mouse_click_atasync

mouse_click_at(offset: Offset)

Dispatch a primary mouse click at the given offset.

Parameters:

  • offset (Offset) - Offset value at which the click will occur.

mouse_double_clickasync

mouse_double_click(finder: Finder)

Dispatch a primary mouse double click at the center of the given control.

Parameters:

  • finder (Finder) - Finder to search for a control.

mouse_double_click_atasync

mouse_double_click_at(offset: Offset)

Dispatch a primary mouse double click at the given offset.

Parameters:

  • offset (Offset) - Offset value at which the double click will occur.

mouse_hoverasync

mouse_hover(finder: Finder)

Dispatch a pointer hover event at the center of the given control.

Parameters:

  • finder (Finder) - Finder to search for a control.

pumpasync

pump(duration: DurationValue | None=None)

Triggers a frame after duration amount of time.

Parameters:

  • duration (DurationValue | None, default: None) - A duration after which to trigger a frame.

pump_and_settleasync

pump_and_settle(
    duration: DurationValue | None = None,
    timeout: float | None = 10,
)

Repeatedly calls pump until there are no longer any frames scheduled. This will call pump at least once, even if no frames are scheduled when the function is called, to flush any pending microtasks which may themselves schedule a frame.

This essentially waits for all animations to have completed.

Parameters:

  • duration (DurationValue | None, default: None) - A duration after which to trigger a frame.
  • timeout (float | None, default: 10) - Maximum seconds to wait for completion.

right_mouse_clickasync

right_mouse_click(finder: Finder)

Dispatch a secondary mouse click at the center of the given control.

Parameters:

  • finder (Finder) - Finder to search for a control.

right_mouse_click_atasync

right_mouse_click_at(offset: Offset)

Dispatch a secondary mouse click at the given offset.

Parameters:

  • offset (Offset) - Offset value at which the click will occur.

take_screenshotasync

take_screenshot(name: str) -> bytes

Takes a screenshot of the entire application window. This method works when testing on iOS and Android only.

Parameters:

  • name (str) - The name of the screenshot.

Returns:

  • bytes - Screenshot in PNG format.

tapasync

tap(finder: Finder)

Dispatch a pointer down / pointer up sequence at the center of the given control, assuming it is exposed.

Parameters:

  • finder (Finder) - Finder to search for a control.

tap_atasync

tap_at(offset: Offset)

Dispatch a pointer down / pointer up sequence at the given offset.

Parameters:

  • offset (Offset) - Offset value at which tap will occur.

teardownasync

teardown(timeout: float | None=10)

Teardown Flutter integration test and exit Flutter process.

Parameters:

  • timeout (float | None, default: 10) - Maximum seconds to wait for teardown acknowledgement.