Search in sources :

Example 26 with JavaFXLibraryNonFatalException

use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.

the class TestFxAdapter method setCurrentSessionScreenshotDirectory.

public void setCurrentSessionScreenshotDirectory(String dir) {
    if (activeSession != null) {
        File errDir = new File(dir);
        if (!errDir.exists())
            errDir.mkdirs();
        activeSession.screenshotDirectory = dir;
    } else
        throw new JavaFXLibraryNonFatalException("Unable to set screenshot directory, no application is currently open!");
}
Also used : JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) JarFile(java.util.jar.JarFile) File(java.io.File)

Example 27 with JavaFXLibraryNonFatalException

use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.

the class Session method closeApplication.

public void closeApplication() {
    try {
        FxToolkit.hideStage();
        FxToolkit.cleanupStages();
        sessionRobot.release(new KeyCode[] {});
        sessionRobot.release(new MouseButton[] {});
        // If application processes are left running, use isMac() or other HelperFunctions to call cleanup.
        if (!HelperFunctions.isMac())
            FxToolkit.cleanupApplication(sessionApplication);
    } catch (Exception e) {
        throw new JavaFXLibraryNonFatalException("Problem shutting down the application: " + e.getMessage(), e);
    }
}
Also used : JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) TimeoutException(java.util.concurrent.TimeoutException)

Example 28 with JavaFXLibraryNonFatalException

use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.

the class ApplicationLauncher method logSystemProperties.

@RobotKeyword("Prints all system properties that has been set with *Set System Property* -keyword\n")
public void logSystemProperties() {
    try {
        Properties p = System.getProperties();
        Enumeration keys = p.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            String value = (String) p.get(key);
            HelperFunctions.robotLog("INFO", key + "=" + value);
        }
    } catch (Exception e) {
        throw new JavaFXLibraryNonFatalException("Unable to log system properties", e);
    }
}
Also used : JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) JavaFXLibraryFatalException(javafxlibrary.exceptions.JavaFXLibraryFatalException) RobotKeyword(org.robotframework.javalib.annotation.RobotKeyword)

Example 29 with JavaFXLibraryNonFatalException

use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.

the class ApplicationLauncher method logApplicationClassPath.

@RobotKeyword("Logs current classpath content")
public void logApplicationClassPath() {
    try {
        ClassLoader cl = ClassLoader.getSystemClassLoader();
        URL[] urls = ((URLClassLoader) cl).getURLs();
        HelperFunctions.robotLog("INFO", "Printing out classpaths: \n");
        for (URL url : urls) {
            HelperFunctions.robotLog("INFO", url.getFile());
        }
    } catch (Exception e) {
        throw new JavaFXLibraryNonFatalException("Unable to log application classpaths", e);
    }
}
Also used : JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) URLClassLoader(java.net.URLClassLoader) URLClassLoader(java.net.URLClassLoader) URL(java.net.URL) JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) JavaFXLibraryFatalException(javafxlibrary.exceptions.JavaFXLibraryFatalException) RobotKeyword(org.robotframework.javalib.annotation.RobotKeyword)

Example 30 with JavaFXLibraryNonFatalException

use of javafxlibrary.exceptions.JavaFXLibraryNonFatalException in project JavaFXLibrary by eficode.

the class ConvenienceKeywords method getTableCellValue.

@RobotKeyword("Returns the value of cell in the given location\n\n" + "``locator`` is either a _query_ or _Object:Node_ for identifying the TableView element, see " + "`3. Locating or specifying UI elements`. \n\n" + "``row`` Integer value for the row\n\n" + "``column`` Integer value for the column")
@ArgumentNames({ "table", "row", "column" })
public Object getTableCellValue(Object locator, int row, int column) {
    try {
        TableView table = (TableView) objectToNode(locator);
        Object item = table.getItems().get(row);
        TableColumn col = (TableColumn) table.getColumns().get(column);
        Object value = col.getCellObservableValue(item).getValue();
        return HelperFunctions.mapObject(value);
    } catch (ClassCastException cce) {
        throw new JavaFXLibraryNonFatalException("Unable to handle argument as TableView!");
    } catch (IndexOutOfBoundsException e) {
        throw new JavaFXLibraryNonFatalException("Out of table bounds: " + e.getMessage());
    } catch (Exception e) {
        throw new JavaFXLibraryNonFatalException("Couldn't get table cell value");
    }
}
Also used : JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) JavaFXLibraryNonFatalException(javafxlibrary.exceptions.JavaFXLibraryNonFatalException) RobotKeyword(org.robotframework.javalib.annotation.RobotKeyword) ArgumentNames(org.robotframework.javalib.annotation.ArgumentNames)

Aggregations

JavaFXLibraryNonFatalException (javafxlibrary.exceptions.JavaFXLibraryNonFatalException)46 RobotKeyword (org.robotframework.javalib.annotation.RobotKeyword)32 ArgumentNames (org.robotframework.javalib.annotation.ArgumentNames)28 Node (javafx.scene.Node)15 Method (java.lang.reflect.Method)6 TimeoutException (java.util.concurrent.TimeoutException)6 ConditionTimeoutException (org.awaitility.core.ConditionTimeoutException)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 PseudoClass (javafx.css.PseudoClass)5 Window (javafx.stage.Window)5 Scene (javafx.scene.Scene)4 JavaFXLibraryFatalException (javafxlibrary.exceptions.JavaFXLibraryFatalException)4 BoundingBox (javafx.geometry.BoundingBox)3 Image (javafx.scene.image.Image)3 TableViewSkin (com.sun.javafx.scene.control.skin.TableViewSkin)2 VirtualFlow (com.sun.javafx.scene.control.skin.VirtualFlow)2 URL (java.net.URL)2 URLClassLoader (java.net.URLClassLoader)2 JarFile (java.util.jar.JarFile)2 ObservableList (javafx.collections.ObservableList)2