Search in sources :

Example 6 with FluentElement

use of org.activityinfo.test.pageobject.api.FluentElement in project activityinfo by bedatadriven.

the class ChooseColumnsDialog method showAllColumns.

public ChooseColumnsDialog showAllColumns() {
    int counter = 0;
    while (!allColumnsRows(false).isEmpty()) {
        // first select first invisible row
        allColumnsRows(false).get(0).getContainer().clickWhenReady();
        // element is changed because of selection (stale element), re-select invisible rows again
        FluentElement container = allColumnsRows(false).get(0).getContainer();
        final String text = container.text();
        container.doubleClick();
        modal.getWindowElement().waitUntil(new Predicate<WebDriver>() {

            @Override
            public boolean apply(WebDriver input) {
                // if not in invisible row list then stop waiting
                for (BsTable.Row notVisible : allColumnsRows(false)) {
                    if (notVisible.getContainer().text().contains(text)) {
                        return false;
                    }
                }
                return true;
            }
        });
        counter++;
        if (counter > 1000) {
            // be on safe side
            throw new AssertionError("Failed to make all columns visible in instance table.");
        }
    }
    return this;
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement) WebDriver(org.openqa.selenium.WebDriver)

Example 7 with FluentElement

use of org.activityinfo.test.pageobject.api.FluentElement in project activityinfo by bedatadriven.

the class ChooseColumnsDialog method hideBuiltInColumns.

public ChooseColumnsDialog hideBuiltInColumns() {
    int counter = 0;
    while (getFirstVisibleBuiltInRow() != null) {
        // first select first visible row
        getFirstVisibleBuiltInRow().getContainer().clickWhenReady();
        // element is changed because of selection (stale element), re-select invisible rows again
        FluentElement container = getFirstVisibleBuiltInRow().getContainer();
        final String text = container.text();
        container.doubleClick();
        modal.getWindowElement().waitUntil(new Predicate<WebDriver>() {

            @Override
            public boolean apply(WebDriver input) {
                // wait until appears in invisible list
                for (BsTable.Row invisible : allColumnsRows(false)) {
                    if (invisible.getContainer().text().contains(text)) {
                        return true;
                    }
                }
                return false;
            }
        });
        counter++;
        if (counter > 1000) {
            // be on safe side
            throw new AssertionError("Failed to make all columns visible in instance table.");
        }
    }
    return this;
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement) WebDriver(org.openqa.selenium.WebDriver)

Example 8 with FluentElement

use of org.activityinfo.test.pageobject.api.FluentElement in project activityinfo by bedatadriven.

the class SubformPanel method delete.

public void delete() {
    FluentElement deleteElement = element.find().span(withClass("icon_remove")).first();
    deleteElement.moveOver().clickWhenReady();
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement)

Example 9 with FluentElement

use of org.activityinfo.test.pageobject.api.FluentElement in project activityinfo by bedatadriven.

the class GxtGrid method extractData.

public DataTable extractData(boolean withHeader) {
    Stopwatch stopwatch = Stopwatch.createStarted();
    List<List<String>> rows = new ArrayList<>();
    // If nothing appears within 90 seconds, consider it empty
    while (rows.isEmpty() && stopwatch.elapsed(TimeUnit.SECONDS) < 90) {
        if (withHeader) {
            List<String> headers = new ArrayList<>();
            for (FluentElement headerCell : container.findElements(By.xpath("//div[@role='columnheader']/span"))) {
                headers.add(headerCell.text().trim());
            }
            rows.add(headers);
        }
        for (FluentElement row : container.findElements(By.className("x-grid3-row"))) {
            List<String> cells = Lists.newArrayList();
            for (FluentElement cell : row.findElements(By.className("x-grid3-cell"))) {
                cells.add(cell.text());
            }
            rows.add(cells);
        }
    }
    return DataTable.create(rows);
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement) Stopwatch(com.google.common.base.Stopwatch) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 10 with FluentElement

use of org.activityinfo.test.pageobject.api.FluentElement in project activityinfo by bedatadriven.

the class GxtGrid method findCell.

public GxtCell findCell(String rowText, String columnId) {
    FluentElement nodeWithText = container.find().anyElement(withText(rowText)).first();
    FluentElement ancestor = nodeWithText.find().ancestor().div(withClass("x-grid3-row")).first();
    FluentElements cells = ancestor.find().descendants().td(withClass("x-grid3-td-" + columnId)).waitForList();
    if (cells.size() != 1) {
        throw new AssertionError(format("Expected unique row containing text '%s', found %d rows", rowText, cells.size()));
    }
    return new GxtCell(cells.first().get());
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement) FluentElements(org.activityinfo.test.pageobject.api.FluentElements)

Aggregations

FluentElement (org.activityinfo.test.pageobject.api.FluentElement)29 FluentElements (org.activityinfo.test.pageobject.api.FluentElements)4 WebDriver (org.openqa.selenium.WebDriver)4 ArrayList (java.util.ArrayList)3 DataTableRow (gherkin.formatter.model.DataTableRow)2 GxtModal (org.activityinfo.test.pageobject.gxt.GxtModal)2 GxtTree (org.activityinfo.test.pageobject.gxt.GxtTree)2 DesignPage (org.activityinfo.test.pageobject.web.design.DesignPage)2 DesignTab (org.activityinfo.test.pageobject.web.design.DesignTab)2 Test (org.junit.Test)2 Stopwatch (com.google.common.base.Stopwatch)1 List (java.util.List)1 BsDataEntryDriver (org.activityinfo.test.driver.BsDataEntryDriver)1 DataEntryDriver (org.activityinfo.test.driver.DataEntryDriver)1 XPathBuilder (org.activityinfo.test.pageobject.api.XPathBuilder)1 ReportsTab (org.activityinfo.test.pageobject.web.reports.ReportsTab)1 Select (org.openqa.selenium.support.ui.Select)1