类cucumber.api.java.en.And源码实例Demo

下面列出了怎么用cucumber.api.java.en.And的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: galeb   文件: StepDefs.java
@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;
    }
}
 
源代码2 项目: demo-java   文件: StepDefinitions.java
@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();
}
 
源代码3 项目: jwala   文件: CreateWebAppRunSteps.java
@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")));
    }
}
 
@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);
}
 
源代码5 项目: akita   文件: WebPageInteractionSteps.java
/**
 *  Производится сохранение заголовка страницы в переменную
 */
@И("^заголовок страницы сохранен в переменную \"([^\"]*)\"$")
@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 + "]");
}
 
源代码6 项目: akita   文件: ApiSteps.java
/**
 * Посылается 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));
}
 
源代码7 项目: akita   文件: ApiSteps.java
/**
 * Посылается 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));
}
 
源代码8 项目: akita   文件: RoundUpSteps.java
/**
 * Устанавливается значение переменной в хранилище переменных. Один из кейсов: установка login пользователя
 */
@И("^установлено значение переменной \"([^\"]*)\" равным \"(.*)\"$")
@And("^value of the variable \"([^\"]*)\" has been set to \"(.*)\"$")
public void setVariable(String variableName, String value) {
    value = getPropertyOrValue(value);
    akitaScenario.setVar(variableName, value);
}
 
源代码9 项目: ibm-cos-sdk-java   文件: AWSCucumberStepdefs.java
@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()));
}
 
源代码10 项目: jwala   文件: CommonRunSteps.java
@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"));
}
 
源代码11 项目: jwala   文件: CommonRunSteps.java
@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"));
}
 
源代码12 项目: jwala   文件: CommonRunSteps.java
@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"));

}
 
源代码13 项目: jwala   文件: CommonRunSteps.java
@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();
}
 
源代码14 项目: jwala   文件: CommonRunSteps.java
@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");
}
 
源代码15 项目: jwala   文件: CommonRunSteps.java
@And("^I attempt to deploy the resource \"(.*)\"$")
public void deployFile(String file) {
    handleResourceRunSteps.selectFile(file);
    handleResourceRunSteps.rightClickFile(file);
    handleResourceRunSteps.clickDeploy();
    handleResourceRunSteps.confirmDeployPopup();
}
 
源代码16 项目: jwala   文件: CommonRunSteps.java
@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);
}
 
源代码17 项目: jwala   文件: HandleResourceRunSteps.java
@And("^I click resource deploy option$")
public void clickDeploy() {
    jwalaUi.click(By.xpath("//*[text()='deploy']"));
}
 
@And("return Product details with name (.*) and category (\\d+)$")
public void theResponseShouldContainTheMessage(String prodName, int categoryId) {
	Product product = productResponse.getBody() ;
	Assert.assertEquals(prodName, product.getName());
	Assert.assertEquals(categoryId, product.getCatId());      
}
 
@And("return Product details with name (.*) and category (\\d+)$")
public void theResponseShouldContainTheMessage(String prodName, int categoryId) {
	Product product = productResponse.getBody() ;
	Assert.assertEquals(prodName, product.getName());
	Assert.assertEquals(categoryId, product.getCatId());      
}
 
源代码20 项目: galeb   文件: StepDefs.java
@And("^property (.*) contains (.*)$")
public void andPropertyContains(String property, String value) {
    if (property!=null && !"".equals(property)) {
        response.body(property, hasToString(value));
    }
}
 
源代码21 项目: jwala   文件: CreateWebAppRunSteps.java
@And("^I see the following web app details in the web app table:$")
public void checkForWebApp(final Map<String, String> webAppDetails) {
    jwalaUi.waitUntilElementIsVisible(By.xpath("//button[text()='" + webAppDetails.get("name") + "']"));
    assertTrue(jwalaUi.isElementExists(By.xpath("//td[text()='" + webAppDetails.get("context") + "']")));
    assertTrue(jwalaUi.isElementExists(By.xpath("//td[text()='" + webAppDetails.get("group") + "']")));
}
 
源代码22 项目: samples   文件: Ios_web.java
@And("^User inputs username ([^\"]*)$")
public void user_input_username(String username) {
	WebDriverWait wait = new WebDriverWait(driver, 30);
	wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username")));
	driver.findElementById("username").sendKeys(username);
}
 
源代码23 项目: samples   文件: Ios_web.java
@And("^User inputs password ([^\"]*)$")
public void user_input_password(String password) {
	driver.findElementById("password").sendKeys(password);
}
 
源代码24 项目: samples   文件: Ios_web.java
@And("^User clicks login button$")
public void user_click_login() {
	driver.findElementByXPath("//button/i[contains(text(), 'Login')]").click();
}
 
源代码25 项目: samples   文件: Android_web.java
@And("^User inputs username ([^\"]*)$")
public void input_username(String username) {
	WebDriverWait wait = new WebDriverWait(driver, 30);
	wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username")));
	driver.findElementById("username").sendKeys(username);
}
 
源代码26 项目: samples   文件: Android_web.java
@And("^User inputs password ([^\"]*)$")
public void input_password(String password) {
	driver.findElementById("password").sendKeys(password);
}
 
源代码27 项目: jwala   文件: ResourceErrorHandlingRunSteps.java
@And("^I confirm to unable to save error popup$")
public void verifyUnableToSave() {
    jwalaUi.isElementExists(By.xpath("//*[contains(text(),'Unable to save changes until the meta data errors are fixed: Unexpected token')]"));
    jwalaUi.clickOk();
}
 
源代码28 项目: samples   文件: Ios_app.java
@And("^User clicks on Acura category$")
public void click_on_Acura_cateogry() {
	driver.findElementByXPath("//*[@name='Acura']").click();
	Utils.sleep(2);
}
 
源代码29 项目: samples   文件: Ios_app.java
@And("^User waits for Navigation Bar$")
public void wait_for_Navigation_bar() {
	(new WebDriverWait(driver, 60))
      .until(ExpectedConditions.elementToBeClickable(By.xpath("//XCUIElementTypeNavigationBar")));
}
 
源代码30 项目: jwala   文件: CreateWebServerRunSteps.java
@And("^I click the add web server dialog ok button$")
public void clickAddWebServerDialogOkBtn() throws InterruptedException {
    jwalaUi.clickOkWithSpan();
}