com.github.mkolisnyk.sirius.cucumber.steps.TableSteps Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sirius-java-client Show documentation
Show all versions of sirius-java-client Show documentation
Common client library for automated GUI testing
The newest version!
package com.github.mkolisnyk.sirius.cucumber.steps;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.junit.Assert;
import com.github.mkolisnyk.sirius.client.Context;
import com.github.mkolisnyk.sirius.client.ui.controls.TableView;
import com.udojava.evalex.Expression;
import cucumber.api.DataTable;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class TableSteps {
private ControlSteps steps = new ControlSteps();
@Then("^(?:I should see |)the \"(.*)\" (?:list|table) is (|not )empty$")
public void verifyListEmptyState(String list, String emptyState) throws Throwable {
boolean empty = emptyState.trim().equals("");
TableView control = (TableView) steps.verifyElementExists(list);
if (empty) {
Assert.assertTrue("The '" + list + "' element is not empty", control.isEmpty());
} else {
Assert.assertTrue("The '" + list + "' element is empty", control.isNotEmpty());
}
}
@Then("^(?:I should see |)the (first|last) (?:row|item) of "
+ "the \"(.*)\" (?:list|table) contains the following data:$")
public void verifyListRowData(String firstLast, String list, DataTable data) throws Throwable {
int index = 0;
TableView control = (TableView) steps.verifyElementExists(list);
if (firstLast.equals("last")) {
index = control.getItemsCount() - 1;
}
List