Package docking.test

Class AbstractDockingTest

    • Constructor Detail

      • AbstractDockingTest

        public AbstractDockingTest()
    • Method Detail

      • dockingSetUp

        public void dockingSetUp()
      • dockingTearDown

        public void dockingTearDown()
      • waitForUpdateOnChooser

        public static void waitForUpdateOnChooser​(GhidraFileChooser chooser)
                                           throws java.lang.Exception
        Throws:
        java.lang.Exception
      • getWindowByTitleContaining

        public static java.awt.Window getWindowByTitleContaining​(java.awt.Window parentWindow,
                                                                 java.lang.String text)
      • getWindow

        protected static java.awt.Window getWindow​(java.lang.String title)
      • getWindowByTitle

        protected static java.awt.Window getWindowByTitle​(java.awt.Window parentWindow,
                                                          java.lang.String title)
      • waitForErrorDialog

        public static AbstractErrDialog waitForErrorDialog()
        Waits for the system error dialog to appear
        Returns:
        the dialog
      • waitForInfoDialog

        public static OkDialog waitForInfoDialog()
        Waits for the system info dialog to appear
        Returns:
        the dialog
      • waitForWindow

        public static java.awt.Window waitForWindow​(java.lang.Class<?> windowClass)
      • waitForWindowByTitleContaining

        public static java.awt.Window waitForWindowByTitleContaining​(java.lang.String text)
      • waitForWindow

        @Deprecated
        public static java.awt.Window waitForWindow​(java.lang.String title,
                                                    int timeoutMS)
        Deprecated.
        Instead call one of the methods that does not take a timeout (we are standardizing timeouts). The timeouts passed to this method will be ignored in favor of the standard value.
        Waits for a window with the given name.
        Parameters:
        title - The title of the window for which to search
        timeoutMS - The timeout after which this method will wait no more
        Returns:
        The window, if found, null otherwise.
      • waitForWindow

        public static java.awt.Window waitForWindow​(java.lang.String title)
        Waits for a window with the given name
        Parameters:
        title - The title of the window for which to search
        Returns:
        The window, if found, null otherwise.
      • waitForWindowByName

        public static java.awt.Window waitForWindowByName​(java.lang.String name)
        Waits for a window with the given name.
        Parameters:
        name - The name of the window for which to search
        Returns:
        The window, if found, null otherwise
      • getMessageText

        public static java.lang.String getMessageText​(java.awt.Window w)
        Check for and display message component text associated with OptionDialog windows
        Parameters:
        w - any window
        Returns:
        the message string if one can be found; null otherwise
      • getStatusText

        public static java.lang.String getStatusText​(DialogComponentProvider provider)
        Get the dialog provider's status text
        Parameters:
        provider - dialog component provider
        Returns:
        status text
      • closeSaveChangesDialog

        public static void closeSaveChangesDialog()
        Will try to close dialogs prompting for changes to be saved, whether from program changes or from tool config changes.
      • close

        public void close​(java.awt.Window w)
      • closeAllWindows

        public static void closeAllWindows​(boolean showError)
      • closeAllWindowsAndFrames

        @Deprecated
        public static void closeAllWindowsAndFrames()
        Deprecated.
        instead call the new closeAllWindows()
        A convenience method to close all of the windows and frames that the current Java windowing environment knows about
      • closeAllWindows

        public static void closeAllWindows()
        A convenience method to close all of the windows and frames that the current Java windowing environment knows about
      • getTitleForWindow

        public static java.lang.String getTitleForWindow​(java.awt.Window window)
      • waitForJDialog

        public static javax.swing.JDialog waitForJDialog​(java.lang.String title)
        Waits for the JDialog with the given title

        Note: Sometimes the task dialog might have the same title as the dialog you pop up and you want to get yours instead of the one for the task monitor.

        Parameters:
        title - the title of the dialog
        Returns:
        the dialog
      • waitForJDialog

        @Deprecated
        public static javax.swing.JDialog waitForJDialog​(java.awt.Window window,
                                                         java.lang.String title,
                                                         int timeoutMS)
        Deprecated.
        Waits for the JDialog with the indicated title and that is parented to the indicated window

        Note: Sometimes the task dialog might have the same title as the dialog you pop up and you want to get yours instead of the one for the task monitor.

        Parameters:
        window - the parent window
        title - the title of the dialog
        timeoutMS - Maximum time to wait for the dialog
        Returns:
        the dialog
      • findComponent

        public static <T extends java.awt.Component> T findComponent​(DialogComponentProvider provider,
                                                                     java.lang.Class<T> desiredClass)
        Returns the first Component of the given type inside of the given dialog
        Parameters:
        provider - the dialog
        desiredClass - the class of the component
        Returns:
        the component; null if none was found
      • waitForDialogComponent

        public static DialogComponentProvider waitForDialogComponent​(java.lang.String title)
        Returns the DialogComponentProvider with the given title. This method is not preferred, but instead you should use a waitForDialogComponent(Class) that takes a class so that you can get the correct return type. This method is meant for clients that need a dialog, but that type is private of package restricted and thus cannot be referenced by a test. Also, code that relies on a title is more subject to breaking when code is refactored; code that relies on class types will get refactored along side the referenced code.

        This method will fail if no dialog can be found

        Parameters:
        title - the title of the desired dialog
        Returns:
        the dialog
      • waitForDialogComponent

        public static <T extends DialogComponentProvider> T waitForDialogComponent​(java.lang.Class<T> ghidraClass)
        Waits for the first window of the given class.
        Parameters:
        ghidraClass - The class of the dialog the user desires
        Returns:
        The first occurrence of a dialog that extends the given ghirdraClass
        See Also:
        waitForDialogComponent(Window, Class, int)
      • waitForDialogComponent

        @Deprecated
        public static <T extends DialogComponentProvider> T waitForDialogComponent​(java.awt.Window parentWindow,
                                                                                   java.lang.Class<T> clazz,
                                                                                   int timeoutMS)
        Deprecated.
        Instead call one of the methods that does not take a timeout (we are standardizing timeouts). The timeouts passed to this method will be ignored in favor of the standard value.
        Waits for the first window of the given class. This method assumes that the desired dialog is parented by parentWindow.
        Parameters:
        parentWindow - The parent of the desired dialog; may be null
        clazz - The class of the dialog the user desires
        timeoutMS - The max amount of time in milliseconds to wait for the requested dialog to appear.
        Returns:
        The first occurrence of a dialog that extends the given ghirdraClass
      • getDialogComponent

        public static <T extends DialogComponentProvider> T getDialogComponent​(java.lang.Class<T> ghidraClass)
        Gets a dialog component provider of the given type
        Parameters:
        ghidraClass - the class of the desired DialogComponentProvider.
        Returns:
        the dialog or null if it cannot be found
      • getDialogComponentProvider

        protected static <T extends DialogComponentProvider> T getDialogComponentProvider​(java.awt.Window window,
                                                                                          java.lang.Class<T> ghidraClass)
        Gets the dialog component provider that is inside the given window or null if a provider of the given class type is not in the window.
        Parameters:
        window - the window that contains the desired provider.
        ghidraClass - the class of the desired provider
        Returns:
        the desired provider or null if the window does not contain a provider of the given type.
      • getComponentProvider

        public static <T extends ComponentProvider> T getComponentProvider​(java.lang.Class<T> clazz)
        Searches for the first occurrence of a ComponentProvider that is an instance of the given providerClass.
        Parameters:
        clazz - The class of the ComponentProvider to locate
        Returns:
        The component provider, or null if one cannot be found
      • waitForComponentProvider

        public static <T extends ComponentProvider> T waitForComponentProvider​(java.lang.Class<T> clazz)
        Searches for the first occurrence of a ComponentProvider that is an instance of the given providerClass. This method will repeat the search every AbstractGTest.DEFAULT_WAIT_DELAY milliseconds until the provider is found, or the maximum number of searches has been reached, where maximum number of searches = MaxTimeMS / AbstractGTest.DEFAULT_WAIT_DELAY
        Parameters:
        clazz - The class of the ComponentProvider to locate
        Returns:
        The component provider, or null if one cannot be found
      • waitForComponentProvider

        public static <T extends ComponentProvider> T waitForComponentProvider​(java.lang.Class<T> clazz,
                                                                               java.lang.String title)
        Allows you to find a component provider with the given title. Most plugins will only ever have a single provider. In those cases, use waitForComponentProvider(Class). This version of that method is to allow you to differentiate between multiple instances of a given provider that have different titles.
        Parameters:
        clazz - The class of the ComponentProvider to locate
        title - the title of the component provider
        Returns:
        The component provider, or null if one cannot be found
      • waitForComponentProvider

        @Deprecated
        public static <T extends ComponentProvider> T waitForComponentProvider​(java.awt.Window parentWindow,
                                                                               java.lang.Class<T> providerClass,
                                                                               int maxTimeMS)
        Deprecated.
        Instead call one of the methods that does not take a timeout (we are standardizing timeouts). The timeouts passed to this method will be ignored in favor of the standard value.
        Searches for the first occurrence of a ComponentProvider that is an instance of the given providerClass. This method will repeat the search every AbstractGTest.DEFAULT_WAIT_DELAY milliseconds until the provider is found, or the maximum number of searches has been reached, where maximum number of searches = MaxTimeMS / AbstractGTest.DEFAULT_WAIT_DELAY
        Parameters:
        parentWindow - The window that will become the parent window of the provider (this is typically the tool's frame).
        providerClass - The class of the ComponentProvider to locate.
        maxTimeMS - The maximum amount of time to wait. This is an approximation (see above).
        Returns:
        The component provider, or null if one cannot be found
      • getWindows

        protected static java.util.Set<java.awt.Window> getWindows​(java.awt.Window parentWindow)
      • pressButtonByText

        public static void pressButtonByText​(DialogComponentProvider provider,
                                             java.lang.String buttonText)
        Finds the button with the indicated TEXT that is a sub-component of the indicated container, and then programmatically presses the button.
        The following is a sample JUnit test use:
                env.showTool();
                OptionDialog dialog = (OptionDialog)env.waitForDialog(OptionDialog.class, 1000);
                assertNotNull(dialog);
                pressButtonByText(dialog, "OK");
         
        Parameters:
        provider - the DialogComponentProvider containing the button.
        buttonText - the text on the desired JButton.
      • pressButtonByText

        public static void pressButtonByText​(DialogComponentProvider provider,
                                             java.lang.String buttonText,
                                             boolean waitForCompletion)
        Finds the button with the indicated TEXT that is a sub-component of the indicated container, and then programmatically presses the button.
        Parameters:
        provider - the DialogComponentProvider containing the button.
        buttonText - the text on the desired JButton.
        waitForCompletion - if true wait for action to complete before returning, otherwise schedule action to be performed and return immediately.
      • setToggleButtonSelected

        public static void setToggleButtonSelected​(java.awt.Container container,
                                                   java.lang.String buttonName,
                                                   boolean selected)
        Finds the toggle button with the given name inside of the given container and then ensures that the selected state of the button matches selected.

        Note: this works for any instanceof JToggleButton, such as:

        • JCheckBox
        • JRadioButton
        as well as EmptyBorderToggleButtons.
        Parameters:
        container - a container that has the desired button as a descendant
        buttonName - the name of the button (you must set this on the button when it is constructed; if there is no button with the given name found, then this method will search for a button with the given text
        selected - true to toggle the button to selected; false for de-selected
      • setToggleButtonSelected

        public static void setToggleButtonSelected​(javax.swing.AbstractButton button,
                                                   boolean selected)
        Ensures that the selected state of the button matches selected.

        Note: this works for most toggle button implementations which are derived from AbstractButton and relay on AbstractButton.isSelected() and AbstractButton.doClick() for toggling, such as:

        Parameters:
        button - the button to select
        selected - true to toggle the button to selected; false for de-selected
      • assertToggleButtonSelected

        public static void assertToggleButtonSelected​(javax.swing.JToggleButton button,
                                                      boolean selected)
        Checks the selected state of a JToggleButton in a thread safe way.
        Parameters:
        button - the toggle button for which to check the selected state.
        selected - the expected state of the toggle button.
      • assertEnabled

        public static void assertEnabled​(javax.swing.JComponent component,
                                         boolean enabled)
        Checks the enablement state of a JComponent in a thread safe way.
        Parameters:
        component - the component for which to check the enablement state.
        enabled - the expected enablement state for the component.
      • getActionsByName

        public static java.util.Set<DockingActionIf> getActionsByName​(Tool tool,
                                                                      java.lang.String name)
        A helper method to find all actions with the given name
        Parameters:
        tool - the tool containing all system actions
        name - the name to match
        Returns:
        the matching actions; empty list if no matches
      • getActionsByOwner

        public static java.util.Set<DockingActionIf> getActionsByOwner​(Tool tool,
                                                                       java.lang.String name)
        A helper method to find all actions with the given owner's name (this will not include reserved system actions)
        Parameters:
        tool - the tool containing all system actions
        name - the owner's name to match
        Returns:
        the matching actions; empty list if no matches
      • getActionsByOwnerAndName

        public static java.util.Set<DockingActionIf> getActionsByOwnerAndName​(Tool tool,
                                                                              java.lang.String owner,
                                                                              java.lang.String name)
        A helper method to find all actions by name, with the given owner's name (this will not include reserved system actions)
        Parameters:
        tool - the tool containing all system actions
        owner - the owner's name
        name - the owner's name to match
        Returns:
        the matching actions; empty list if no matches
      • getAction

        public static DockingActionIf getAction​(Tool tool,
                                                java.lang.String name)
        Finds the singular tool action by the given name. If more than one action exists with that name, then an exception is thrown. If you want more than one matching action, the call getActionsByName(Tool, String) instead.

        Note: more specific test case subclasses provide other methods for finding actions when you have an owner name (which is usually the plugin name).

        Parameters:
        tool - the tool containing all system actions
        name - the name to match
        Returns:
        the matching action; null if no matching action can be found
      • getAction

        public static DockingActionIf getAction​(Tool tool,
                                                java.lang.String owner,
                                                java.lang.String name)
        Finds the action by the given owner name and action name. If you do not know the owner name, then use the call getActionsByName(Tool, String) instead (this will not include reserved system actions).

        Note: more specific test case subclasses provide other methods for finding actions when you have an owner name (which is usually the plugin name).

        Parameters:
        tool - the tool containing all system actions
        owner - the owner of the action
        name - the name to match
        Returns:
        the matching action; null if no matching action can be found
      • getLocalAction

        public static DockingActionIf getLocalAction​(ComponentProvider provider,
                                                     java.lang.String actionName)
        Returns the action by the given name that belongs to the given provider
        Parameters:
        provider - the provider
        actionName - the action name
        Returns:
        the action
      • getAction

        public static DockingActionIf getAction​(DialogComponentProvider provider,
                                                java.lang.String actionName)
        Returns the given dialog's action that has the given name
        Parameters:
        provider - the dialog provider
        actionName - the name of the action
        Returns:
        the action
      • performAction

        public static void performAction​(DockingActionIf action)
        Performs the specified action within the Swing Thread. This method will block until the action completes. Do not use this method if the given actions triggers a modal dialog. Instead, call performAction(DockingActionIf, boolean) with a false value.

        If the action results in a modal dialog, then call performAction(DockingActionIf, boolean) with a value of false.

        Parameters:
        action - action to be performed (event will be null)
      • performAction

        public static void performAction​(DockingActionIf action,
                                         boolean waitForCompletion)
        Performs the specified action within the Swing Thread. If the action results in a modal dialog, waitForCompletion must be false.
        Parameters:
        action - action to be performed
        waitForCompletion - if true wait for action to complete before returning, otherwise schedule action to be performed and return immediately.
      • performAction

        public static void performAction​(DockingActionIf action,
                                         ComponentProvider provider,
                                         boolean wait)
        Performs the specified action with context within the Swing Thread. If the action results in a modal dialog, waitForCompletion must be false.
        Parameters:
        action - action to be performed
        provider - the component provider from which to get action context; if null, then an empty context will used
        wait - if true wait for action to complete before returning, otherwise schedule action to be performed and return immediately.
      • performDialogAction

        public static void performDialogAction​(DockingActionIf action,
                                               DialogComponentProvider provider,
                                               boolean wait)
        Performs the specified action with context within the Swing Thread. If the action results in a modal dialog, waitForCompletion must be false.
        Parameters:
        action - action to be performed
        provider - the component provider from which to get action context
        wait - if true wait for action to complete before returning, otherwise schedule action to be performed and return immediately.
      • performAction

        public static void performAction​(DockingActionIf action,
                                         ActionContext context,
                                         boolean wait)
        Performs the specified action with context within the Swing Thread. If the action results in a modal dialog, waitForCompletion must be false.
        Parameters:
        action - action to be performed
        context - the context to use with the action
        wait - if true wait for action to complete before returning, otherwise schedule action to be performed and return immediately.
      • setToggleActionSelected

        public static void setToggleActionSelected​(ToggleDockingActionIf toggleAction,
                                                   ActionContext context,
                                                   boolean selected)
        Ensures the given toggle action is in the given selected state. If it is not, then the action will be performed. This call will wait for the action to finish.
        Parameters:
        toggleAction - the action
        context - the context for the action
        selected - true if the action is be be selected; false for not selected
      • setToggleActionSelected

        public static void setToggleActionSelected​(ToggleDockingActionIf toggleAction,
                                                   ActionContext context,
                                                   boolean selected,
                                                   boolean wait)
        Ensures the given toggle action is in the given selected state. If it is not, then the action will be performed. This call will wait for the action to finish.
        Parameters:
        toggleAction - the action
        context - the context for the action
        selected - true if the action is be be selected; false for not selected
        wait - true to wait for the action to finish; false to invoke later
      • findComponentByName

        public static java.awt.Component findComponentByName​(DialogComponentProvider provider,
                                                             java.lang.String componentName)
        Searches the component and subcomponents of the indicated provider and returns the component with the specified name.
        Parameters:
        provider - the provider of the component to search
        componentName - the name of the desired component
        Returns:
        the component, or null if not found
      • findButtonByText

        public static javax.swing.JButton findButtonByText​(DialogComponentProvider provider,
                                                           java.lang.String text)
      • findButtonByIcon

        public static javax.swing.JButton findButtonByIcon​(DialogComponentProvider provider,
                                                           javax.swing.Icon icon)
      • findButtonByActionName

        public static javax.swing.JButton findButtonByActionName​(java.awt.Container container,
                                                                 java.lang.String name)
      • triggerActionKey

        public static void triggerActionKey​(java.awt.Component c,
                                            int modifiers,
                                            int keyCode)
        Simulates a user typing a single key. This method should used for the special keyboard keys (ARROW, F1, END, etc) and alpha keys when associated with actions.
        Parameters:
        c - the component that should be the receiver of the key event; the event source
        modifiers - the modifier keys down during event (shift, ctrl, alt, meta) Either extended _DOWN_MASK or old _MASK modifiers should be used, but both models should not be mixed in one event. Use of the extended modifiers is preferred.
        keyCode - the integer code for an actual key.
      • triggerActionKey

        public static void triggerActionKey​(java.awt.Component destination,
                                            DockingActionIf action)
        Simulates a user initiated keystroke using the keybinding of the given action
        Parameters:
        destination - the component for the action being executed
        action - The action to simulate pressing
      • triggerEscapeKey

        public static void triggerEscapeKey​(java.awt.Component c)
      • triggerBackspaceKey

        public static void triggerBackspaceKey​(java.awt.Component c)
      • triggerEnter

        public static void triggerEnter​(java.awt.Component c)
        Simulates the user pressing the 'Enter' key on the given text field
        Parameters:
        c - the component
      • triggerText

        public static void triggerText​(java.awt.Component destination,
                                       java.lang.String string)
        Types the indicated string using the triggerKey(Component, int, int, char) method. This method should be used when typing into text components. For example, JTextFields and JTextAreas. All three events are fired, KEY_PRESSED, KEY_TYPED, and KEY_RELEASED.
        Note: Handles the following characters:

        ABCDEFGHIJKLMNOPQRSTUVWXYZ
        abcdefghijklmnopqrstuvwxyz
        `1234567890-=[]\;',./
        ~!@#$%^&*()_+{}|:"<>?

        It also handles '\n', '\t', and '\b'.
        Parameters:
        destination - the component to receive the events
        string - the string to be typed.
      • triggerText

        public static void triggerText​(java.awt.Component destination,
                                       java.lang.String string,
                                       java.util.function.BiConsumer<java.awt.Component,​java.awt.event.KeyEvent> consumer)
        Types the indicated string using the triggerKey(Component, int, int, char) method. This method should be used when typing into text components. For example, JTextFields and JTextAreas. All three events are fired, KEY_PRESSED, KEY_TYPED, and KEY_RELEASED.
        Note: Handles the following characters:

        ABCDEFGHIJKLMNOPQRSTUVWXYZ
        abcdefghijklmnopqrstuvwxyz
        `1234567890-=[]\;',./
        ~!@#$%^&*()_+{}|:"<>?

        It also handles '\n', '\t', and '\b'.
        Parameters:
        destination - the component to receive the events
        string - the string to be typed.
        consumer - the consumer of the text to be generated
      • triggerKey

        public static void triggerKey​(java.awt.Component c,
                                      javax.swing.KeyStroke ks)
        Fires a KeyListener.keyPressed(KeyEvent), KeyListener.keyTyped(KeyEvent) and KeyListener.keyReleased(KeyEvent) for the given key stroke
        Parameters:
        c - the destination component
        ks - the key stroke
      • triggerKey

        public static void triggerKey​(java.awt.Component c,
                                      int modifiers,
                                      int keyCode,
                                      char keyChar)
        Fires a KeyListener.keyPressed(KeyEvent), KeyListener.keyTyped(KeyEvent) and KeyListener.keyReleased(KeyEvent) for the given key code and char.

        If the key you need is not a character, but is an action, pass KeyEvent.CHAR_UNDEFINED for the keyChar parameter.

        Parameters:
        c - the destination component
        modifiers - any modifiers, like Control
        keyCode - the key code (see KeyEvent's VK_xyz values)
        keyChar - the key char or KeyEvent.CHAR_UNDEFINED
      • triggerKey

        public static void triggerKey​(java.awt.Component c,
                                      int modifiers,
                                      int keyCode,
                                      char keyChar,
                                      java.util.function.BiConsumer<java.awt.Component,​java.awt.event.KeyEvent> consumer)
      • getClipboardText

        public java.lang.String getClipboardText()
                                          throws java.lang.Exception
        Gets any current text on the clipboard
        Returns:
        the text on the clipboard; null if no text is on the clipboard
        Throws:
        java.lang.Exception - if there are any issues copying from the clipboard
      • isUseErrorGUI

        public static boolean isUseErrorGUI()
      • setErrorGUIEnabled

        public static void setErrorGUIEnabled​(boolean enable)
        By default Ghidra will use a modal error dialog to display errors when running tests. This method should be used to disable this feature, as opposed to calling:
              Err.setErrorDisplay( new ConsoleErrorDisplay() );
         
        Parameters:
        enable - true to use the GUI; false to use the error console
      • disposeErrorGUI

        public static void disposeErrorGUI()
        Turns off the gui displays for errors. This does not change the "isUseErrorGUI()" value for other tests in the TestCase.
      • showProvider

        public ComponentProvider showProvider​(Tool tool,
                                              java.lang.String name)
        Shows the provider by the given name.
        Parameters:
        tool - the tool in which the provider lives
        name - the name of the provider to show
        Returns:
        the newly shown provider
      • clickComponentProvider

        public static java.awt.Component clickComponentProvider​(ComponentProvider provider)
        Performs a single left mouse click in the center of the given provider. This is useful when trying to make a provider the active provider, while making sure that one of the provider's components has focus.
        Parameters:
        provider - The provider to click
        Returns:
        the actual Java JComponent that was clicked.
        See Also:
        clickComponentProvider(ComponentProvider, int, int, int, int, int, boolean)
      • selectTabIfAvailable

        protected static void selectTabIfAvailable​(DockableComponent dockableComponent)
        If this dockable component is in a tabbed pane then select the associated tab.
        Parameters:
        dockableComponent - the dockable component of interest
      • getDockableComponent

        protected static DockableComponent getDockableComponent​(javax.swing.JComponent component)
        Get the dockable component that contains this component if there is one.
        Parameters:
        component - the component that may be within a dockable component.
        Returns:
        the dockable component or null
      • clickComponentProvider

        public static java.awt.Component clickComponentProvider​(ComponentProvider provider,
                                                                int button,
                                                                int x,
                                                                int y,
                                                                int clickCount,
                                                                int modifiers,
                                                                boolean popupTrigger)
        Clicks the JComponent at the given point from within the given provider.
        Parameters:
        provider - The provider to be clicked.
        button - The mouse button to use (left, center, right)
        x - the x location of the click
        y - the y location of the click
        clickCount - the number of times to click
        modifiers - the modifiers to apply (Ctrl, Alt, etc; 0 is none)
        popupTrigger - true if this click should show a popup menu
        Returns:
        the actual Java JComponent that was clicked
      • printOpenWindows

        public static void printOpenWindows()
        Prints all found windows that are showing, nesting by parent-child relationship.
      • getOpenWindowsAsString

        public static java.lang.String getOpenWindowsAsString()
        Returns a pretty-print string of all found windows that are showing, nesting by parent-child relationship.
        Returns:
        the result string
      • waitForTableModel

        public static <T> void waitForTableModel​(ThreadedTableModel<T,​?> model)
      • getNode

        public static GTreeNode getNode​(GTree tree,
                                        java.lang.String... path)
      • expandPath

        public static void expandPath​(GTree tree,
                                      java.lang.String... path)
      • expandTree

        public static void expandTree​(GTree tree,
                                      java.lang.String... path)
      • selectPath

        public static void selectPath​(GTree tree,
                                      java.lang.String... path)
      • waitForTree

        public static void waitForTree​(GTree gTree)
      • isEnabled

        public static boolean isEnabled​(javax.swing.AbstractButton button)
      • isSelected

        public static boolean isSelected​(javax.swing.AbstractButton button)
      • createContext

        public ActionContext createContext​(java.lang.Object contextObject)
        Creates a generic action context with no provider, with the given context object
        Parameters:
        contextObject - the generic object to put in the context
        Returns:
        the new context
      • createContext

        public ActionContext createContext​(ComponentProvider provider,
                                           java.lang.Object contextObject)
        Creates a generic action context with the given provider, with the given context object
        Parameters:
        provider - the provider
        contextObject - the generic object to put in the context
        Returns:
        the new context
      • capture

        public void capture​(java.awt.Component c,
                            java.lang.String name)
                     throws java.lang.Exception
        Creates and writes to file an image of the given component. The file will be written to the reports directory (this differs depending upon how the test was run), nested inside a directory structure of the form {test class name}/{test name}. A console statement will be written indicating the location of the written file.
        Parameters:
        c - the component to capture
        name - the file name suffix
        Throws:
        java.lang.Exception - if there is any issue capturing the component
      • writeImage

        protected void writeImage​(java.awt.Image image,
                                  java.lang.String name)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • createScreenImage

        public static java.awt.Image createScreenImage​(java.awt.Component c)
                                                throws java.awt.AWTException
        Creates a png of the given component by capturing a screenshot of the image. This differs from creating the image by rendering it via a Graphics object.
        Parameters:
        c - the component
        Returns:
        the new image
        Throws:
        java.awt.AWTException - if there is a problem creating the image
      • createRenderedImage

        public static java.awt.Image createRenderedImage​(java.awt.Component c)
      • writeImage

        public static void writeImage​(java.awt.Image image,
                                      java.io.File imageFile)
                               throws java.io.IOException
        Writes the given image to the given file
        Parameters:
        image - the image
        imageFile - the file
        Throws:
        java.io.IOException - if there is any issue writing the image