Package com.thoughtworks.inproctester.webdriver

Examples of com.thoughtworks.inproctester.webdriver.InProcessHtmlUnitDriver



    @Test
    public void shouldSupportGetAndPostRequests() {

        WebDriver htmlUnitDriver = new InProcessHtmlUnitDriver(httpAppTester);

        htmlUnitDriver.get("http://localhost/contacts/add");

        assertThat(htmlUnitDriver.getTitle(), is("Test Application"));
        assertThat(htmlUnitDriver.findElement(By.tagName("h3")).getText(), is("Contact Details"));
        WebElement contactNameElement = htmlUnitDriver.findElement(By.name("contactName"));

        assertThat(contactNameElement.getAttribute("value"), isEmptyString());
        contactNameElement.sendKeys("My Contact");

        htmlUnitDriver.findElement(By.tagName("form")).submit();

        assertThat(htmlUnitDriver.getCurrentUrl(), is("http://localhost/contacts/1"));
        assertThat(htmlUnitDriver.findElement(By.name("contactName")).getAttribute("value"), is("My Contact"));

    }
View Full Code Here


    }

    @Test
    public void shouldSupportCookies() {
        WebDriver htmlUnitDriver = new InProcessHtmlUnitDriver(httpAppTester);
        htmlUnitDriver.manage().deleteAllCookies();

        htmlUnitDriver.get("http://localhost/contacts/add");
        htmlUnitDriver.findElement(By.name("contactName")).sendKeys("My Contact");
        htmlUnitDriver.findElement(By.tagName("form")).submit();

        assertThat(htmlUnitDriver.findElement(By.className("message")).getText(), is("Success"));

        htmlUnitDriver.get("http://localhost/contacts/1");

        Cookie flashMessageCookie = htmlUnitDriver.manage().getCookieNamed("FLASH_MESSAGE");
        assertThat(flashMessageCookie, is(nullValue()));


         assertThat(htmlUnitDriver.findElements(By.className("message")), is(Matchers.<WebElement>empty()));
    }
View Full Code Here

        httpAppTester.stop();
    }

    @Test
    public void shouldSupportGetAndPostRequests() {
        WebDriver htmlUnitDriver = new InProcessHtmlUnitDriver(httpAppTester);

        htmlUnitDriver.get("http://localhost/contacts/add");

        assertThat(htmlUnitDriver.getTitle(), is("Test Application"));
        assertThat(htmlUnitDriver.findElement(By.tagName("h3")).getText(), is("Contact Details"));
        WebElement contactNameElement = htmlUnitDriver.findElement(By.name("contactName"));

        contactNameElement.clear();
        contactNameElement.sendKeys("My Contact");

        htmlUnitDriver.findElement(By.tagName("form")).submit();

        assertThat(htmlUnitDriver.getCurrentUrl(), is("http://localhost/contacts/1"));
        assertThat(htmlUnitDriver.findElement(By.name("contactName")).getAttribute("value"), is("My Contact"));

    }
View Full Code Here

    }

    @Test
    public void shouldSupportUtfEncodedData() {

        WebDriver htmlUnitDriver = new InProcessHtmlUnitDriver(httpAppTester);

        htmlUnitDriver.get("http://localhost/contacts/add");
        WebElement contactNameElement = htmlUnitDriver.findElement(By.name("contactName"));
        contactNameElement.clear();
        contactNameElement.sendKeys("Имя Контакта");
        htmlUnitDriver.findElement(By.tagName("form")).submit();

        assertThat(htmlUnitDriver.findElement(By.name("contactName")).getAttribute("value"), is("Имя Контакта"));

    }
View Full Code Here

    }


    @Test
    public void shouldSupportCookies() {
        WebDriver htmlUnitDriver = new InProcessHtmlUnitDriver(httpAppTester);
        htmlUnitDriver.manage().deleteAllCookies();

        htmlUnitDriver.get("http://localhost/contacts/add");
        htmlUnitDriver.findElement(By.name("contactName")).sendKeys("My Contact");
        htmlUnitDriver.findElement(By.tagName("form")).submit();

        assertThat(htmlUnitDriver.findElement(By.className("message")).getText(), is("Success"));

        htmlUnitDriver.get("http://localhost/contacts/1");

        Cookie flashMessageCookie = htmlUnitDriver.manage().getCookieNamed("FLASH_MESSAGE");
        assertThat(flashMessageCookie, is(nullValue()));


        assertThat(htmlUnitDriver.findElements(By.className("message")), is(Matchers.<WebElement>empty()));
    }
View Full Code Here

TOP

Related Classes of com.thoughtworks.inproctester.webdriver.InProcessHtmlUnitDriver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.