Search in sources :

Example 11 with FluentElement

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

the class GxtGrid method columnValues.

public List<String> columnValues(String columnId) {
    FluentElements cells = container.find().div(withClass("x-grid3-cell-inner"), withClass("x-grid3-col-" + columnId)).asList();
    List<String> values = new ArrayList<>();
    for (FluentElement cell : cells) {
        values.add(cell.text().trim());
    }
    return values;
}
Also used : FluentElements(org.activityinfo.test.pageobject.api.FluentElements) FluentElement(org.activityinfo.test.pageobject.api.FluentElement) ArrayList(java.util.ArrayList)

Example 12 with FluentElement

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

the class RelevanceDialog method set.

public RelevanceDialog set(DataTable dataTable, AliasTable alias) {
    for (int i = 0; i < dataTable.getGherkinRows().size(); i++) {
        DataTableRow row = dataTable.getGherkinRows().get(i);
        List<String> cells = row.getCells();
        Preconditions.checkState(cells.size() == 4);
        String fieldLabel = alias.getAlias(cells.get(0));
        String operation = cells.get(1);
        String value = cells.get(2);
        String controlType = cells.get(3);
        if ("radio".equals(controlType)) {
            value = alias.getAlias(value);
        }
        FluentElement lastRow = lastRow();
        List<FluentElement> select = lastRow.find().select().waitForList().list();
        Select fieldSelector = new Select(select.get(1).element());
        fieldSelector.selectByVisibleText(fieldLabel);
        Select operationSelector = new Select(select.get(2).element());
        operationSelector.selectByVisibleText(operation);
        switch(controlType) {
            case "radio":
                FluentElement radioLabel = lastRow().find().label(XPathBuilder.withText(value)).first();
                radioLabel.clickWhenReady();
                break;
        }
    }
    return save();
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement) Select(org.openqa.selenium.support.ui.Select) DataTableRow(gherkin.formatter.model.DataTableRow)

Example 13 with FluentElement

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

the class DataEntryTab method buttonClick.

public DataEntryTab buttonClick(String buttonLabel) {
    final FluentElement button = container.find().button(withText(buttonLabel)).first();
    button.waitUntil(new // wait until button become enabled (there may be small period before it becomes enabled)
    Predicate<WebDriver>() {

        @Override
        public boolean apply(@Nullable WebDriver input) {
            return button.attribute("aria-disabled").equals("false");
        }
    });
    button.click();
    return this;
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement) WebDriver(org.openqa.selenium.WebDriver)

Example 14 with FluentElement

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

the class GxtFormDataEntryDriver method moveToNextSection.

private void moveToNextSection() {
    FluentElement sectionElement = sections.next();
    sectionElement.click();
    String sectionName = sectionElement.findElement(By.className("formSecHeader")).text();
    System.out.println(sectionName);
    switch(sectionName) {
        case "Indicators":
            currentForm = new GxtIndicatorForm(modal.getWindowElement());
            break;
        case "Comments":
            currentForm = new GxtCommentsForm(modal.getWindowElement());
            break;
        default:
            currentForm = findVisibleForm();
            break;
    }
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement)

Example 15 with FluentElement

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

the class ImportDialog method selectTargetName.

private void selectTargetName(String targetName) {
    FluentElement panel = modal.getWindowElement().find().div(withClass("panel-body")).first();
    Optional<FluentElement> radio = panel.find().label(withText(targetName)).ancestor().span(withClass("radio")).firstIfPresent();
    if (radio.isPresent()) {
        radio.get().clickWhenReady();
        return;
    }
    throw new AssertionError("Failed to find target column: " + targetName);
}
Also used : FluentElement(org.activityinfo.test.pageobject.api.FluentElement)

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