Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: testfx

[31:21] static (extern: com.lehman.aussom.stdlib.AussomTestFx) extends: object

Provides JavaFX UI testing support by wrapping the TestFX library. The testfx class simulates user interactions such as clicking, typing, dragging, and scrolling, and provides assertion methods for verifying UI state. Usage: include testfx; testfx.setup(myApp); testfx.clickOn("#myButton"); testfx.verifyHasText("#myLabel", "Hello"); testfx.cleanup();

Methods

  • setHeadless (bool Headless)

    Enables or disables headless mode for UI testing. When enabled, JavaFX uses the Monocle Glass platform with a virtual framebuffer so no window appears on screen. This must be called before fx.fxApp() since the system properties need to be set before the JavaFX toolkit initializes.

    • @p Headless is a bool with true to enable headless mode.
  • setup (object FxAppObj)

    Initializes the test robot and targets the provided fxApp window. Must be called before any other testfx methods.

    • @p FxAppObj is the fxApp object to test against.
  • cleanup ()

    Releases held keys and mouse buttons and cleans up robot state.

  • clickOn (string Query)

    Clicks on a node found by CSS selector, ID (#id), or text content.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • doubleClickOn (string Query)

    Double-clicks on a node found by query.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • rightClickOn (string Query)

    Right-clicks on a node found by query.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • write (string Text)

    Types a string of text into the currently focused control.

    • @p Text is a string with the text to type.
  • push (string KeyCombo)

    Presses a key combination. The combo string uses "+" as a delimiter (e.g. "CONTROL+A", "SHIFT+TAB", "ENTER"). Key names match JavaFX KeyCode enum values.

    • @p KeyCombo is a string with the key combination.
  • eraseText (int Count)

    Presses backspace the specified number of times.

    • @p Count is an int with the number of times to press backspace.
  • moveTo (string Query)

    Moves the mouse to the specified node.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • moveBy (double X, double Y)

    Moves the mouse by a relative offset from its current position.

    • @p X is a double with the horizontal offset.
    • @p Y is a double with the vertical offset.
  • drag (string Query)

    Begins a drag from the specified node.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • dropTo (string Query)

    Drops at the specified node after a drag operation.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • scrollUp (int Amount = 1)

    Scrolls up the specified number of units.

    • @p Amount is an int with the number of scroll units.
  • scrollDown (int Amount = 1)

    Scrolls down the specified number of units.

    • @p Amount is an int with the number of scroll units.
  • lookup (string Query)

    Looks up a node by CSS selector, ID, or text content and returns it as an AussomJavaObject.

    • @p Query is a string with the CSS selector, node ID, or text to match.
    • @r An AussomJavaObject with the found JavaFX Node.
  • lookupAll (string Query)

    Returns a list of all nodes matching the query as AussomJavaObjects.

    • @p Query is a string with the CSS selector, node ID, or text to match.
    • @r A list of AussomJavaObject nodes.
  • exists (string Query)

    Checks if at least one node matches the query.

    • @p Query is a string with the CSS selector, node ID, or text to match.
    • @r A bool with true if a matching node exists.
  • verifyVisible (string Query)

    Asserts the node matching the query is visible. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • verifyInvisible (string Query)

    Asserts the node matching the query is not visible. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • verifyEnabled (string Query)

    Asserts the node matching the query is enabled. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • verifyDisabled (string Query)

    Asserts the node matching the query is disabled. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • verifyHasText (string Query, string Text)

    Asserts the labeled node (Label, Button, etc.) has the specified text. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
    • @p Text is a string with the expected text.
  • verifyExists (string Query)

    Asserts that at least one node matches the query. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • verifyNotExists (string Query)

    Asserts that no nodes match the query. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • verifyFocused (string Query)

    Asserts the node matching the query has focus. Throws an exception on failure.

    • @p Query is a string with the CSS selector, node ID, or text to match.
  • sleep (int Millis)

    Pauses execution for the specified number of milliseconds.

    • @p Millis is an int with the number of milliseconds to sleep.