Skip to content

Tester

Tester #

Bases: Service

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

data #

data: Any = skip_field()

Arbitrary data of any type.

key #

key: KeyValue | None = None

page #

page: Page | PageView | None

The page (of type Page or PageView) to which this control belongs to.

parent #

parent: BaseControl | None

The direct ancestor(parent) of this control.

It defaults to None and will only have a value when this control is mounted (added to the page tree).

The Page control (which is the root of the tree) is an exception - it always has parent=None.

before_event #

before_event(e: ControlEvent)

before_update #

before_update()

This method is called every time when this control is being updated.

Note

Make sure not to call/request an update() here.

did_mount #

did_mount()

enter_text #

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.

PARAMETER DESCRIPTION
finder

Finder to search for a control.

TYPE: Finder

text

The text to enter.

TYPE: str

find_by_icon #

find_by_icon(icon: IconValue) -> Finder

Finds controls by an icon.

PARAMETER DESCRIPTION
icon

The Icon to search by.

TYPE: IconValue

find_by_key #

find_by_key(key: KeyValue) -> Finder

Finds controls by a Key instance or key name.

PARAMETER DESCRIPTION
key

A key instance or its name.

TYPE: KeyValue

find_by_text #

find_by_text(text: str) -> Finder

Finds controls containing string equal to the text argument.

PARAMETER DESCRIPTION
text

The exact text value to search control by.

TYPE: str

find_by_text_containing #

find_by_text_containing(pattern: str) -> Finder

Finds controls containing specified text pattern.

PARAMETER DESCRIPTION
pattern

Regular expression pattern.

TYPE: str

find_by_tooltip #

find_by_tooltip(value: str) -> Finder

Finds controls by a tooltip.

PARAMETER DESCRIPTION
value

Tooltip value.

TYPE: str

init #

init()

is_isolated #

is_isolated()

mouse_hover #

mouse_hover(finder: Finder)

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

PARAMETER DESCRIPTION
finder

Finder to search for a control.

TYPE: Finder

pump #

pump(duration: Duration | None = None)

Triggers a frame after duration amount of time.

PARAMETER DESCRIPTION
duration

A duration after which to trigger a frame.

TYPE: Duration | None DEFAULT: None

pump_and_settle #

pump_and_settle()

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.

take_screenshot #

take_screenshot(name: str) -> bytes

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

PARAMETER DESCRIPTION
name

The name of the screenshot.

TYPE: str

RETURNS DESCRIPTION
bytes

Screenshot in PNG format.

tap #

tap(finder: Finder)

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

PARAMETER DESCRIPTION
finder

Finder to search for a control.

TYPE: Finder

teardown #

teardown()

Teardown Flutter integration test and exit Flutter process.

update #

update() -> None

will_unmount #

will_unmount()