Skip to content

Instantly share code, notes, and snippets.

@krimple
Created January 8, 2012 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krimple/1579611 to your computer and use it in GitHub Desktop.
Save krimple/1579611 to your computer and use it in GitHub Desktop.
package org.rooinaction.coursemanager.web;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class ITCourseSelenium {
private WebDriver webDriver;
@Before
public void setUp() throws Exception {
webDriver = new FirefoxDriver();
}
@Test
public void testCourseCreate() throws Exception {
webDriver.get("http://localhost:8080/coursemanager/courses?form");
// implicitly wait 10 seconds for anything needed
// to appear...
webDriver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
webDriver.findElement(By.id("_name_id")).sendKeys("someName1");
webDriver.findElement(By.id("_description_id")).sendKeys("someDescription1");
webDriver.findElement(By.id("_maxiumumCapacity_id")).sendKeys("1");
webDriver.findElement(By.id("_createdDate_id")).sendKeys("5/1/11");
webDriver.findElement(By.id("proceed")).click();
Assert.assertEquals(true, 0 < webDriver.getPageSource().indexOf("Show Course"));
}
@After
public void tearDown() throws Exception {
webDriver.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment