use of cucumber.api.java.en.Given in project cucumber-jvm by cucumber.
the class NavigationStepdefs method i_am_on_the_front_page.
@Given("^I am on the front page$")
public void i_am_on_the_front_page() throws InterruptedException {
webDriver.get("http://localhost:" + ServerHooks.PORT);
// The input fields won't be enabled until the WebSocket has established
// a connection. Wait for this to happen.
WebDriverWait wait = new WebDriverWait(webDriver, 1);
wait.until(ExpectedConditions.elementToBeClickable(By.id("celcius")));
}
use of cucumber.api.java.en.Given in project cucumber-jvm by cucumber.
the class JavaStepDefinitionTest method does_not_throw_ambiguous_when_nothing_is_ambiguous.
@Test
public void does_not_throw_ambiguous_when_nothing_is_ambiguous() throws Throwable {
backend.addStepDefinition(THREE_DISABLED_MICE.getAnnotation(Given.class), THREE_DISABLED_MICE);
Reporter reporter = new Reporter() {
@Override
public void before(Match match, Result result) {
throw new UnsupportedOperationException();
}
@Override
public void result(Result result) {
if (result.getError() != null) {
throw new RuntimeException(result.getError());
}
}
@Override
public void after(Match match, Result result) {
throw new UnsupportedOperationException();
}
@Override
public void match(Match match) {
}
@Override
public void embedding(String mimeType, byte[] data) {
}
@Override
public void write(String text) {
}
};
runtime.buildBackendWorlds(reporter, Collections.<Tag>emptySet(), mock(Scenario.class));
Tag tag = new Tag("@foo", 0);
Set<Tag> tags = asSet(tag);
runtime.runBeforeHooks(reporter, tags);
Step step = new Step(NO_COMMENTS, "Given ", "three blind mice", 1, null, null);
runtime.runStep("some.feature", step, reporter, ENGLISH);
assertTrue(defs.foo);
assertFalse(defs.bar);
}
use of cucumber.api.java.en.Given in project azure-tools-for-java by Microsoft.
the class SparkBatchRemoteDebugJobScenario method mockLivyService.
@Given("^setup a mock livy service for (.+) request '(.+)' to return '(.+)' with status code (\\d+)$")
public void mockLivyService(String action, String serviceUrl, String response, int statusCode) throws Throwable {
URI mockUri = new URI(serviceUrl);
int mockedPort = mockUri.getPort() == -1 ? 80 : mockUri.getPort();
if (httpServerMock == null || httpServerMock.port() != mockedPort) {
httpServerMock = new WireMockServer(wireMockConfig().bindAddress(mockUri.getHost()).port(mockedPort));
httpServerMock.start();
}
configureFor(mockUri.getHost(), mockedPort);
stubFor(request(action, urlEqualTo(serviceUrl.substring(mockUri.resolve("/").toString().length() - 1))).willReturn(aResponse().withStatus(statusCode).withBody(response)));
}
use of cucumber.api.java.en.Given in project open-kilda by telstra.
the class Common method a_clean_flow_topology.
/**
* This code will make sure there aren't any flows
*/
@Given("^a clean flow topology$")
public void a_clean_flow_topology() throws Throwable {
FlowUtils.cleanupFlows();
FeatureTogglePayload features = new FeatureTogglePayload(true, true);
FlowUtils.updateFeaturesStatus(features);
}
use of cucumber.api.java.en.Given in project open-kilda by telstra.
the class FlowFFRTest method a_multi_path_topology.
@Given("^basic multi-path topology$")
public void a_multi_path_topology() throws Throwable {
String fileName = "topologies/barebones-topology.json";
ClassLoader classLoader = getClass().getClassLoader();
URL resource = classLoader.getResource(fileName);
if (resource == null) {
throw new IllegalArgumentException(String.format("No such topology json file: %s", fileName));
}
File file = new File(resource.getFile());
String json = new String(Files.readAllBytes(file.toPath()));
assertTrue(TopologyHelp.CreateMininetTopology(json));
}
Aggregations