cucumber.api.java.en.And Java Examples

The following examples show how to use cucumber.api.java.en.And. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StepDefs.java    From galeb with Apache License 2.0 6 votes vote down vote up
@And("^send (.+) (.+)$")
public void sendMethodPath(String method, String path) {
    URI fullUrl = URI.create(processFullUrl(path));
    switch (method) {
        case "GET":
            response = request.get(fullUrl).then();
            break;
        case "POST":
            final String fullUrlStr="http://127.0.0.1:" + port + path;
            response = request.post(URI.create(fullUrlStr)).then();
            break;
        case "PUT":
            response = request.put(fullUrl).then();
            break;
        case "PATCH":
            response = request.patch(fullUrl).then();
            break;
        case "DELETE":
            response = request.delete(fullUrl).then();
            break;
        default:
            break;
    }
}
 
Example #2
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I generate and start the webserver with the following parameters:$")
public void generateAndStartWebserver(Map<String, String> parameters) {
    navigationRunSteps.goToOperationsTab();
    navigationRunSteps.expandGroupInOperationsTab(parameters.get("group"));
    generateWebServerRunSteps.generateIndividualWebserver(parameters.get("webserverName"), parameters.get("group"));
    generateWebServerRunSteps.checkForSuccessfulGenerationOfAWebserver();
    startWebServersOfGroup(parameters.get("webserverName"), parameters.get("group"));
    startWebServerRunSteps.checkIfWebServerStateIsStarted(parameters.get("webserverName"), parameters.get("group"));
}
 
Example #3
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I go to the web-app file in resources under individual jvm with the following parameters:$")
public void goToResourceWebappUnderJvm(Map<String, String> parameters) {
    navigationRunSteps.goToConfigurationTab();
    navigationRunSteps.goToResourceTab();
    uploadResourceRunSteps.expandNode(parameters.get("group"));
    uploadResourceRunSteps.expandNode("JVMs");
    uploadResourceRunSteps.expandNode(parameters.get("jvmName"));
    uploadResourceRunSteps.clickNode(parameters.get("app"));
    handleResourceRunSteps.selectFile(parameters.get("file"));

}
 
Example #4
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I created a group JVM resource with the following parameters:$")
public void createGroupJvmResource(Map<String, String> parameters) throws Throwable {
    navigationRunSteps.goToResourceTab();
    uploadResourceRunSteps.expandNode(parameters.get("group"));
    uploadResourceRunSteps.expandNode("JVMs");
    uploadResourceRunSteps.clickNode("JVMs");
    uploadResourceRunSteps.clickAddResourceBtn();
    uploadResourceRunSteps.setDeployName(parameters.get("deployName"));
    uploadResourceRunSteps.setDeployPath(parameters.get("deployPath"));
    uploadResourceRunSteps.selectResourceFile(parameters.get("templateName"));
    uploadResourceRunSteps.clickUploadResourceDlgOkBtn();
    uploadResourceRunSteps.checkForSuccessfulResourceUpload();
}
 
Example #5
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I enter attribute in the group file MetaData with the following parameters:$")
public void enterAttributeInGroupMetaData(Map<String, String> parameters) {
    navigationRunSteps.goToConfigurationTab();
    navigationRunSteps.goToResourceTab();
    uploadResourceRunSteps.expandNode(parameters.get("group"));
    uploadResourceRunSteps.expandNode(parameters.get("componentType"));
    uploadResourceRunSteps.clickNode(parameters.get("componentType"));
    handleResourceRunSteps.clickResource(parameters.get("fileName"));
    handleResourceRunSteps.clickTab("Meta Data");
    handleResourceRunSteps.enterAttribute(parameters.get("attributeKey"), parameters.get("attributeValue"));
    handleResourceRunSteps.clickSaveButton("Meta Data");
    //click ok to override popup
    jwalaUi.clickOkWithSpan();
    handleResourceRunSteps.waitForNotification("Saved");
}
 
Example #6
Source File: HomePageSteps.java    From Mobile-Test-Automation-with-Appium with MIT License 5 votes vote down vote up
@And("^I choose \"([^\"]*)\" as my city$")
public void iChooseAsMyCity(String city) throws Throwable {
    new LandingPage(appiumDriver).skipToHomePage();

    /* TODO - Assignment - Move the try catch logic to base page */

    try {
        if (appiumDriver.findElement(By.xpath("//android.widget.Button[@text='Later']")).isDisplayed())
            appiumDriver.findElement(By.xpath("//android.widget.Button[@text='Later']")).click();
    } catch (Exception e) {
        //do nothing
    }

    new HomePage(appiumDriver).selectCity(city);
}
 
Example #7
Source File: CreateWebAppRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I see Unpack WAR checkbox is \"(.*)\"$")
public void checkUnpackWarFlag(final String flag) {
    if (flag.equalsIgnoreCase("checked")){
        assertTrue(jwalaUi.isCheckBoxChecked(By.name("unpackWar")));
    } else if (flag.equalsIgnoreCase("unchecked")) {
        assertFalse(jwalaUi.isCheckBoxChecked(By.name("unpackWar")));
    }
}
 
Example #8
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I attempt to deploy the resource \"(.*)\"$")
public void deployFile(String file) {
    handleResourceRunSteps.selectFile(file);
    handleResourceRunSteps.rightClickFile(file);
    handleResourceRunSteps.clickDeploy();
    handleResourceRunSteps.confirmDeployPopup();
}
 
Example #9
Source File: WebPageInteractionSteps.java    From akita with Apache License 2.0 5 votes vote down vote up
/**
 *  Производится сохранение заголовка страницы в переменную
 */
@И("^заголовок страницы сохранен в переменную \"([^\"]*)\"$")
@And("^page's header has been saved to the \"([^\"]*)\" variable$")
public void savePageTitleToVariable(String variableName) {
    String titleName = getWebDriver().getTitle().trim();
    akitaScenario.setVar(variableName, titleName);
    akitaScenario.write("Значение заголовка страницы [" + titleName + "] сохранено в переменную [" + variableName + "]");
}
 
Example #10
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I generate and start the jvm with the following parameters:$")
public void generateAndStartJvm(Map<String, String> parameters) {
    navigationRunSteps.goToOperationsTab();
    navigationRunSteps.expandGroupInOperationsTab(parameters.get("group"));
    generateJvmRunSteps.generateIndividualJvm(parameters.get("jvmName"), parameters.get("group"));
    generateJvmRunSteps.checkForSuccessfulGenerationIndividualJvm();
    startJvmOfGroup(parameters.get("jvmName"), parameters.get("group"));
    startJvmRunSteps.checkIfJvmStateIsStarted(parameters.get("jvmName"), parameters.get("group"));
}
 
Example #11
Source File: ApiSteps.java    From akita with Apache License 2.0 5 votes vote down vote up
/**
 * Посылается http запрос по заданному урлу без параметров и BODY.
 * Проверяется, что код ответа соответствует ожиданиям.
 * URL можно задать как напрямую в шаге, так и указав в application.properties
 */
@И("^выполнен (GET|POST|PUT|DELETE) запрос на URL \"([^\"]*)\". Ожидается код ответа: (\\d+)$")
@And("^(GET|POST|PUT|DELETE) request to URL \"([^\"]*)\" has been executed. Expected response code: (\\d+)$")
public void checkResponseCodeWithoutParams(String method, String address, int expectedStatusCode) throws Exception {
    Response response = sendRequest(method, address, new ArrayList<>());
    assertTrue(checkStatusCode(response, expectedStatusCode));
}
 
Example #12
Source File: ApiSteps.java    From akita with Apache License 2.0 5 votes vote down vote up
/**
 * Посылается http запрос по заданному урлу с заданными параметрами.
 * Проверяется, что код ответа соответствует ожиданиям.
 * URL можно задать как напрямую в шаге, так и указав в application.properties
 * Content-Type при необходимости должен быть указан в качестве header.
 */
@И("^выполнен (GET|POST|PUT|DELETE) запрос на URL \"([^\"]*)\" с headers и parameters из таблицы. Ожидается код ответа: (\\d+)$")
@And("^(GET|POST|PUT|DELETE) request to URL \"([^\"]*)\" with headers and parametres from the table has been executed. Expected response code: (\\d+)$")
public void checkResponseCode(String method, String address, int expectedStatusCode, List<RequestParam> paramsTable) throws Exception {
    Response response = sendRequest(method, address, paramsTable);
    assertTrue(checkStatusCode(response, expectedStatusCode));
}
 
Example #13
Source File: StepDefinitions.java    From demo-java with MIT License 5 votes vote down vote up
@And("I remove an item")
public void remove_an_item(){
    By itemButton = By.className("btn_secondary");

    wait.until(ExpectedConditions.elementToBeClickable(getDriver().findElement(itemButton)));
    getDriver().findElement(itemButton).click();
}
 
Example #14
Source File: RoundUpSteps.java    From akita with Apache License 2.0 5 votes vote down vote up
/**
 * Устанавливается значение переменной в хранилище переменных. Один из кейсов: установка login пользователя
 */
@И("^установлено значение переменной \"([^\"]*)\" равным \"(.*)\"$")
@And("^value of the variable \"([^\"]*)\" has been set to \"(.*)\"$")
public void setVariable(String variableName, String value) {
    value = getPropertyOrValue(value);
    akitaScenario.setVar(variableName, value);
}
 
Example #15
Source File: AWSCucumberStepdefs.java    From ibm-cos-sdk-java with Apache License 2.0 5 votes vote down vote up
@And("^I expect the response error message to include:$")
public void and_I_expect_the_response_error_message_include(String expected) {
    assertNotNull(exception);
    assertTrue(exception instanceof AmazonServiceException);
    String actual = exception.getErrorMessage().toLowerCase();
    assertTrue("Error message doesn't match. Expected : " + expected + ". Actual :" + actual,
            actual.contains(expected.toLowerCase()));
}
 
Example #16
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 5 votes vote down vote up
@And("^I attempt to deploy the jvm group resource \"(.*)\"$")
public void deployJvmGroupFile(String file) {
    handleResourceRunSteps.selectFile(file);
    handleResourceRunSteps.rightClickFile(file);
    handleResourceRunSteps.clickDeploy();
    handleResourceRunSteps.confirmOverride(file);
}
 
Example #17
Source File: CreateGroupRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I click the group add dialog ok button$")
public void clickOkBtn() {
    jwalaUi.clickOkWithSpan();
}
 
Example #18
Source File: HandleResourceRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I expand \"(.*)\" node in data tree$")
public void expandPropertyDataTree(String property) {
    jwalaUi.clickWhenReady(By.xpath("//span[contains(@class,'nodeKey') and contains(text(),'" + property + "') ]/preceding-sibling::span"));
}
 
Example #19
Source File: CreateWebAppRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I see the \"The table is empty!\" message$")
public void checkForEmptyTable() {
    jwalaUi.waitUntilElementIsVisible(By.xpath("//div[contains(@class,'noDataFoundMsg') and contains(text(),'The table is empty!')]"));
}
 
Example #20
Source File: CreateJvmRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I select the \"JVM JDK\" version \"(.*)\"$")
public void selectJdk(final String jdk) {
    jwalaUi.selectItem(By.name("jdkMediaId"), jdk);
}
 
Example #21
Source File: CreateWebServerRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I click the \"Status Path\" Refresh status button \"(.*)\"$")
public void clickRefreshButtonToUpdateStatusPath() {
    jwalaUi.click(By.xpath("//span[contains(@title,'Generate Status Path')]/span"));
}
 
Example #22
Source File: HandleResourceRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I don't see \"([^\"]*)\" node in the data tree$")
public void verifyabsenceOfNode(String nodeName) {
    assertFalse(jwalaUi.isElementExists(By.xpath("//span[contains(@class,'nodeKey') and contains(text(),'" + nodeName + "') ]/preceding-sibling::span")));
}
 
Example #23
Source File: CreateMediaRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I see the media add dialog$")
public void checkIfAddMediaDialogIsDisplayed() {
    jwalaUi.waitUntilElementIsVisible(By.xpath("//span[text()='Add Media']"));
}
 
Example #24
Source File: CreateGroupRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I see the group add dialog$")
public void checkIfAddGroupDialogBoxIsDisplayed() {
    jwalaUi.waitUntilElementIsVisible(By.xpath("//span[text()='Add Group']"));
}
 
Example #25
Source File: LoginRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I fill in the \"Password\" field with a valid password$")
public void enterPassword() {
    jwalaUi.sendKeys(By.id("password"), jwalaUi.getProperties().getProperty("jwala.user.pwd"));
}
 
Example #26
Source File: CreateMediaRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I select \"Media Type\" item \"(.*)\"$")
public void selectMediaType(final String mediaType) {
    jwalaUi.selectItem(By.name("type"), mediaType);
}
 
Example #27
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I try to generate the webapp with the following parameters:$")
public void attemptToGenerateWebapp(Map<String, String> parameters) {
    navigationRunSteps.goToOperationsTab();
    navigationRunSteps.expandGroupInOperationsTab(parameters.get("group"));
    generateWebAppRunSteps.clickGenerateWebAppBtnOfGroup(parameters.get("webAppName"), parameters.get("group"));
}
 
Example #28
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I try to generate jvm with the following parameters:$")
public void attemptToGenerateJvm(Map<String, String> parameters) {
    navigationRunSteps.goToOperationsTab();
    navigationRunSteps.expandGroupInOperationsTab(parameters.get("group"));
    generateJvmRunSteps.generateIndividualJvm(parameters.get("jvmName"), parameters.get("group"));
}
 
Example #29
Source File: CommonRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I try to generate webserver with the following parameters:$")
public void attemptToGenerateWebserver(Map<String, String> parameters) {
    navigationRunSteps.goToOperationsTab();
    navigationRunSteps.expandGroupInOperationsTab(parameters.get("group"));
    generateWebServerRunSteps.generateIndividualWebserver(parameters.get("webserverName"), parameters.get("group"));
}
 
Example #30
Source File: CreateWebAppRunSteps.java    From jwala with Apache License 2.0 4 votes vote down vote up
@And("^I see \"(.*)\" web app table$")
public void checkForWebApp(final String webAppName) {
    jwalaUi.waitUntilElementIsVisible(By.xpath("//button[text()='" + webAppName + "']"));
}