use of gherkin.formatter.model.DataTableRow in project activityinfo by bedatadriven.
the class DataEntryTab method createMapping.
private List<Pair<String, String>> createMapping(DataTable dataTable) {
List<Pair<String, String>> mapping = Lists.newArrayList();
DataTableRow headerRow = dataTable.getGherkinRows().get(0);
for (String cell : headerRow.getCells()) {
mapping.add(Pair.newPair(cell, cell));
}
return mapping;
}
use of gherkin.formatter.model.DataTableRow in project activityinfo by bedatadriven.
the class BsModal method fill.
public void fill(DataTable dataTable, AliasTable aliasTable) {
BsFormPanel form = form();
DataTableRow labelRow = dataTable.getGherkinRows().get(0);
DataTableRow typeRow = dataTable.getGherkinRows().get(1);
for (int i = 2; i < dataTable.getGherkinRows().size(); i++) {
DataTableRow row = dataTable.getGherkinRows().get(i);
for (int j = 0; j < row.getCells().size(); j++) {
String value = row.getCells().get(j);
String label = labelRow.getCells().get(j);
String type = typeRow.getCells().get(j);
label = isBuiltinLabel(label) ? label : aliasTable.getAlias(label);
BsFormPanel.BsField field = form.findFieldByLabel(label);
if (type.equalsIgnoreCase("text") || type.equalsIgnoreCase("quantity")) {
field.fill(value);
} else if (type.equalsIgnoreCase("enum")) {
field.select(aliasTable.getAlias(value));
} else if (type.equalsIgnoreCase("date")) {
field.fill(org.joda.time.LocalDate.parse(value));
} else {
throw new RuntimeException("Unsupported type: " + type);
}
}
}
}
use of gherkin.formatter.model.DataTableRow in project activityinfo by bedatadriven.
the class ExcelConvertor method asExcelData.
public static String asExcelData(DataTable dataTable) {
String s = "";
for (int i = 0; i < dataTable.getGherkinRows().size(); i++) {
DataTableRow row = dataTable.getGherkinRows().get(i);
for (int j = 0; j < row.getCells().size(); j++) {
String cell = row.getCells().get(j);
s = s + cell;
boolean isLastCell = j == (row.getCells().size() - 1);
if (!isLastCell) {
s += ";";
}
}
boolean isLastRow = i == (dataTable.getGherkinRows().size() - 1);
if (!isLastRow) {
s = s + "\n";
}
}
return s;
}
use of gherkin.formatter.model.DataTableRow in project activityinfo by bedatadriven.
the class DataEntrySteps method I_enter_values.
@And("^I enter values:$")
public void I_enter_values(DataTable table) throws Throwable {
BsModal modal = currentOpenedForm();
DataTableRow header = table.getGherkinRows().get(0);
DataTableRow type = table.getGherkinRows().get(1);
for (int i = 2; i < table.getGherkinRows().size(); i++) {
DataTableRow row = table.getGherkinRows().get(i);
for (int j = 0; j < row.getCells().size(); j++) {
String label = header.getCells().get(j);
if (!BsModal.isBuiltinLabel(label)) {
label = driver.getAliasTable().getAlias(label);
}
String value = row.getCells().get(j);
if (label.equalsIgnoreCase(I18N.CONSTANTS.partner())) {
value = driver.getAliasTable().getAlias(value);
}
modal.form().findFieldByLabel(label).fill(value, type.getCells().get(j));
Sleep.sleepMillis(100);
}
}
}
use of gherkin.formatter.model.DataTableRow in project activityinfo by bedatadriven.
the class DataEntrySteps method opened_form_has_repeating_subform_values.
@Then("^opened form has repeating subform values:$")
public void opened_form_has_repeating_subform_values(DataTable expectedSubformValues) throws Throwable {
BsModal modal = currentOpenedForm();
DataTableRow header = expectedSubformValues.getGherkinRows().get(0);
DataTableRow type = expectedSubformValues.getGherkinRows().get(1);
for (int i = 2; i < expectedSubformValues.getGherkinRows().size(); i++) {
DataTableRow row = expectedSubformValues.getGherkinRows().get(i);
for (int j = 0; j < header.getCells().size(); j++) {
String label = driver.getAliasTable().getAlias(header.getCells().get(j));
String currentValue = modal.form().findFieldsByLabel(label).get(i - 2).getValue(ControlType.fromValue(type.getCells().get(j)));
assertEquals(row.getCells().get(j), currentValue);
}
}
}
Aggregations