Search in sources :

Example 1 with Given

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")));
}
Also used : WebDriverWait(org.openqa.selenium.support.ui.WebDriverWait) Given(cucumber.api.java.en.Given)

Example 2 with Given

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);
}
Also used : Given(cucumber.api.java.en.Given) Reporter(gherkin.formatter.Reporter) Tag(gherkin.formatter.model.Tag) Step(gherkin.formatter.model.Step) Match(gherkin.formatter.model.Match) Result(gherkin.formatter.model.Result) Scenario(gherkin.formatter.model.Scenario) Test(org.junit.Test)

Example 3 with Given

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)));
}
Also used : URI(java.net.URI) WireMockServer(com.github.tomakehurst.wiremock.WireMockServer) Given(cucumber.api.java.en.Given)

Example 4 with Given

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);
}
Also used : FeatureTogglePayload(org.openkilda.messaging.payload.FeatureTogglePayload) Given(cucumber.api.java.en.Given)

Example 5 with Given

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));
}
Also used : File(java.io.File) URL(java.net.URL) Given(cucumber.api.java.en.Given)

Aggregations

Given (cucumber.api.java.en.Given)119 ApplicationEnvironmentAuthorizationUpdateRequest (alien4cloud.rest.orchestrator.model.ApplicationEnvironmentAuthorizationUpdateRequest)10 Connection (io.syndesis.common.model.connection.Connection)10 Connector (io.syndesis.common.model.connection.Connector)10 Step (io.syndesis.common.model.integration.Step)9 StepDefinition (io.syndesis.qe.bdd.entities.StepDefinition)9 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)7 Action (io.syndesis.common.model.action.Action)6 ConnectorDescriptor (io.syndesis.common.model.action.ConnectorDescriptor)6 AbstractStep (io.syndesis.qe.bdd.AbstractStep)5 S3BucketNameBuilder (io.syndesis.qe.utils.S3BucketNameBuilder)5 File (java.io.File)5 Map (java.util.Map)5 Publication (uk.nhs.digital.ps.test.acceptance.models.Publication)5 Application (alien4cloud.model.application.Application)4 Response (com.jayway.restassured.response.Response)4 IOException (java.io.IOException)4 List (java.util.List)4 FF4jCacheProxy (org.ff4j.cache.FF4jCacheProxy)4 InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)4