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;
}
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;
}
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();
}
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);
}
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());
}
Aggregations