Search in sources :

Example 1 with GxtTree

use of org.activityinfo.test.pageobject.gxt.GxtTree in project activityinfo by bedatadriven.

the class TargetsPage method expandTree.

public void expandTree(String indicatorName) {
    GxtTree tree = GxtTree.treeGrid(container);
    try {
        // expand roots -> must be removed once we find out real problem for KeyDown on TreeGrid (throws cannot focus element on key down)
        for (GxtTree.GxtNode root : Lists.newArrayList(tree.findRootNodes())) {
            root.ensureExpanded();
        }
        tree.waitUntil(new Predicate<GxtTree>() {

            @Override
            public boolean apply(GxtTree tree) {
                Optional<GxtTree.GxtNode> root = tree.firstRootNode();
                boolean loaded = root.isPresent() && root.get().joint().firstIfPresent().isPresent();
                return !loaded;
            }
        });
        tree.search(indicatorName).get().ensureExpanded();
    } catch (WebDriverException e) {
    // revisit it later
    // unknown error: cannot focus element on key down
    }
    Preconditions.checkState(tree.firstRootNode().get().joint().firstIfPresent().isPresent());
}
Also used : Optional(com.google.common.base.Optional) GxtTree(org.activityinfo.test.pageobject.gxt.GxtTree) WebDriverException(org.openqa.selenium.WebDriverException)

Aggregations

Optional (com.google.common.base.Optional)1 GxtTree (org.activityinfo.test.pageobject.gxt.GxtTree)1 WebDriverException (org.openqa.selenium.WebDriverException)1