本文整理汇总了Java中cucumber.api.java.en.Then类的典型用法代码示例。如果您正苦于以下问题:Java Then类的具体用法?Java Then怎么用?Java Then使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Then类属于cucumber.api.java.en包,在下文中一共展示了Then类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loginWithDifferentUserAccounts
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^I use those accounts to login successfully and unsuccessfully$")
public void loginWithDifferentUserAccounts() {
for (String [] userAccount : userAccounts) {
jwalaUi.loadPath("/login");
jwalaUi.sendKeys(By.id("userName"), userAccount[0]);
jwalaUi.sendKeys(By.id("password"), userAccount[1]);
jwalaUi.click(By.cssSelector("input[type=\"button\"]"));
if (userAccount[2].equalsIgnoreCase("mainPage")) {
jwalaUi.waitUntilElementIsVisible(By.className("banner-logout"));
} else if (userAccount[2].equalsIgnoreCase("loginErrorMessage")) {
jwalaUi.waitUntilElementIsVisible(By.className("login-error-msg"));
} else {
fail("Unexpected result = " + userAccount[2]);
}
}
}
示例2: iCanSeeUpcomingPublications
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^I can see upcoming publications$")
public void iCanSeeUpcomingPublications() throws Throwable {
final List<Publication> expectedPublications = testDataRepo.getPublications(UPCOMING);
final List<UpcomingPublicationOverivewWidget> actualPublicationEntries =
publicationsOverviewPage.getUpcomingPublicationsWidgets();
assertThat("Should display correct quantity of upcoming publications.",
actualPublicationEntries,
hasSize(expectedPublications.size())
);
for (int i = 0; i < expectedPublications.size(); i++) {
assertThat("Should display upcoming publication.",
actualPublicationEntries.get(i),
matchesUpcomingPublication(expectedPublications.get(i))
);
}
}
示例3: theRolledUpPointOnWillBePurged
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^the rolled up point on \"([^\"]*)\" (\\d+) \"([^\"]*)\" will be purged$")
public void theRolledUpPointOnWillBePurged(String timestampState,
long timestampDiff,
String timestampUnit) throws Throwable {
String sql = ""
+ " SELECT * FROM point_" + rollUp.getTargetGranularity()
+ " WHERE \"metric_id\" = ? "
+ " AND \"timestamp\" = ? "
+ " AND \"aggregation\" = ? ";
Timestamp timestamp = resolveTimestamp(timestampState, timestampDiff, timestampUnit);
try (Connection connection = pugTSDB.getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setInt(1, metric.getId());
statement.setTimestamp(2, timestamp);
statement.setString(3, aggregation.getName());
ResultSet resultSet = statement.executeQuery();
assertFalse(resultSet.next());
}
}
示例4: checkJHipsterSampleAppPage
import cucumber.api.java.en.Then; //导入依赖的package包/类
/**
* Check JHipsterSampleApp portal page.
*
* @throws FailureException
* if the scenario encounters a functional error.
*/
@Then("The JHIPSTERSAMPLEAPP portal is displayed")
public void checkJHipsterSampleAppPage() throws FailureException {
try {
Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(jHipsterSampleAppPage.signInMessage)));
if (!jHipsterSampleAppPage.isDisplayed()) {
logInToJHipsterSampleAppWithNoraRobot();
}
if (!jHipsterSampleAppPage.checkPage()) {
new Result.Failure<>(jHipsterSampleAppPage.getApplication(), Messages.FAIL_MESSAGE_UNKNOWN_CREDENTIALS, true, jHipsterSampleAppPage.getCallBack());
}
} catch (Exception e) {
new Result.Failure<>(jHipsterSampleAppPage.getApplication(), Messages.FAIL_MESSAGE_UNKNOWN_CREDENTIALS, true, jHipsterSampleAppPage.getCallBack());
}
Auth.setConnected(true);
}
示例5: theRolledUpPointOnWontBePurged
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^the rolled up point on \"([^\"]*)\" (\\d+) \"([^\"]*)\" wont be purged$")
public void theRolledUpPointOnWontBePurged(String timestampState,
long timestampDiff,
String timestampUnit) throws Throwable {
String sql = ""
+ " SELECT * FROM point_" + rollUp.getTargetGranularity()
+ " WHERE \"metric_id\" = ? "
+ " AND \"timestamp\" = ? "
+ " AND \"aggregation\" = ? ";
Timestamp timestamp = resolveTimestamp(timestampState, timestampDiff, timestampUnit);
try (Connection connection = pugTSDB.getDataSource().getConnection();
PreparedStatement statement = connection.prepareStatement(sql)) {
statement.setInt(1, metric.getId());
statement.setTimestamp(2, timestamp);
statement.setString(3, aggregation.getName());
ResultSet resultSet = statement.executeQuery();
assertTrue(resultSet.next());
}
}
示例6: theFollowingDependenciesAreExcludedFrom
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^The following dependencies are excluded from \"([^\"]*) ([^\"]*)\":$")
public void theFollowingDependenciesAreExcludedFrom(String configuration, String from, List<String> exclusions) throws Throwable {
JsonObject reportForProject = report.getAsJsonObject(projectName);
assertThat(reportForProject).describedAs("Report for " + projectName).isNotNull();
for (JsonElement dependency : reportForProject.getAsJsonArray(configuration)) {
JsonObject dependencyObject = dependency.getAsJsonObject();
if (from.equals(dependencyObject.get("coordinates").getAsString())) {
assertThat(dependencyObject.getAsJsonArray("excludes"))
.extracting(JsonObject.class::cast)
.extracting(it -> {
String group = it.get("group").getAsString();
JsonElement module = it.get("module");
if (module.isJsonNull()) {
return group;
}
return group + ":" + module.getAsString();
})
.containsAll(exclusions);
break;
}
}
}
示例7: iShouldNotSeeHeaders
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^I should not see headers:$")
public void iShouldNotSeeHeaders(DataTable headersTable) throws Throwable {
List<String> headers = headersTable.asList(String.class);
for (String header : headers) {
assertNull("Header should not be displayed", sitePage.findElementWithText(header));
}
}
示例8: loop
import cucumber.api.java.en.Then; //导入依赖的package包/类
/**
* Loop on steps execution for a specific number of times.
*
* @param actual
* actual value for global condition.
* @param expected
* expected value for global condition.
* @param times
* Number of loops.
* @param steps
* List of steps run in a loop.
*/
@Lorsque("Si '(.*)' vérifie '(.*)', je fais '(.*)' fois:")
@Then("If '(.*)' matches '(.*)', I do '(.*)' times:")
public void loop(String actual, String expected, int times, List<GherkinConditionedLoopedStep> steps) {
try {
if (new GherkinStepCondition("loopKey", expected, actual).checkCondition()) {
for (int i = 0; i < times; i++) {
runAllStepsInLoop(steps);
}
}
} catch (TechnicalException e) {
throw new AssertError(Messages.getMessage(TechnicalException.TECHNICAL_SUBSTEP_ERROR_MESSAGE) + e.getMessage());
}
}
示例9: iShouldSeeThePageNotFoundErrorPage
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^I should see the page not found error page$")
public void iShouldSeeThePageNotFoundErrorPage() throws Throwable {
// Ideally we would check the HTTP response code is 404 as well but it's not
// currently possible to do this with the Selinium Web Driver.
// See https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/141
iShouldSeePageTitled("Page not found");
}
示例10: i_receive_a_list_of_suggestions_with
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^I receive a list of suggestions, with \"([^\"]*)\"$")
public void i_receive_a_list_of_suggestions_with(String arg1) throws Throwable {
driver.get(baseUrl+"/");
SeleniumUtils.entrarComoUsuario(driver);
SeleniumUtils.EsperaCargaPagina(driver, "id", "crear", 10);
SeleniumUtils.textoPresentePagina(driver, arg1);
}
示例11: the_original_hexes_at_the_coordinates_are_removed
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^the original hexes at the coordinates are removed$")
public void the_original_hexes_at_the_coordinates_are_removed() throws Throwable {
// Write code here that turns the phrase above into concrete actions
//check lvl >1
Hex hex = gameBoard.getHexFromCoordinate(new Coordinate(100,100));
int level = hex.getLevel();
if(level == 1){
fail("Level not incremented");
}
}
示例12: the_new_tile_is_saved_at_those_coordinates
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^the new tile is saved at those coordinates$")
public void the_new_tile_is_saved_at_those_coordinates() throws Throwable {
ArrayList<Tile> placedTiles = gameBoard.getPlacedTiles();
Tile tile = placedTiles.get(2);
ArrayList<Coordinate> coords = tile.getCoords();
if(!(coords.get(0).getX() == 100 && coords.get(0).getY() == 100 && coords.get(1).getX()==101 && coords.get(1).getY()==100
&& coords.get(2).getX()==101 && coords.get(2).getY()== 101)){
fail("Tile not saved at new coordinates");
}
}
示例13: checkFlowRules
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^flow rules should not be cleared up")
public void checkFlowRules() {
FlowRules result = CLIENT
.target(DefaultParameters.FLOODLIGHT_ENDPOINT)
.path(ACL_RULES_PATH)
.request()
.get(FlowRules.class);
assertTrue("Floodlight should send flow rules", result != null && result.getFlows() != null);
String expectedCookie = String.valueOf(Long.parseLong(COOKIE.substring(2), 16));
assertThat(result.getFlows(), hasItem(hasProperty("cookie", is(expectedCookie))));
dockerClient.close();
}
示例14: contain
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^the table should contain (\\d+) items$")
public void theTableShouldContainItems(final int count) throws Throwable {
notLoadingAnymore();
eventually(() -> {
final List<WebElement> rows = webDriver.findElement(By.tagName("table"))
.findElement(By.tagName("tbody"))
.findElements(By.tagName("tr"));
assertEquals(count, rows.size());
return null;
});
}
示例15: iCanSeeThePasswordErrorMessages
import cucumber.api.java.en.Then; //导入依赖的package包/类
@Then("^I can see the password error messages$")
public void iCanSeeThePasswordErrorMessages() throws Throwable {
assertThat("Password error is displayed", dashboardPage.getPasswordErrorMessages(),
hasItems(
equalTo("Password must be at least 12 characters long"),
equalTo("Password may not be the same as previous 5 passwords"),
equalTo("Password must not contain user name, first name or last name"),
containsString("Password should contain at least one capitalized letter"),
containsString("Password should contain at least one lower case letter"),
containsString("Password should contain at least one digit")
)
);
}