Ejemplo n.º 1
0
  public void testFailure() {
    selenium.setContext(
        "A real negative test, using the real Selenium on the browser side served by Jetty, driven from Java",
        SeleniumLogLevels.DEBUG);
    selenium.open("/selenium-server/tests/html/test_click_page1.html");
    String badElementName = "This element doesn't exist, so Selenium should throw an exception";
    try {
      selenium.getText(badElementName);
      fail("No exception was thrown!");
    } catch (SeleniumException se) {
      assertTrue(
          "Exception message isn't as expected: " + se.getMessage(),
          se.getMessage().indexOf(badElementName + " not found") != -1);
    }

    try {
      assertTrue(
          "Negative test", selenium.isTextPresent("Negative test: verify non-existent text"));
      fail("No exception was thrown!");
    } catch (AssertionFailedError se) {
      assertTrue(
          "Exception message isn't as expected: " + se.getMessage(),
          se.getMessage().indexOf("Negative test") != -1);
    }
  }
 public void testLookFileNoValidES() throws Throwable {
   selenium.open("/nootes/index.html?lang=es");
   selenium.type("user", "javier");
   selenium.type("password", "javier");
   selenium.click("Submit");
   selenium.waitForPageToLoad("30000");
   selenium.open("/nootes/search.html?lang=es");
   selenium.type("w", "perro");
   selenium.click("BSearch3");
   selenium.waitForPageToLoad("30000");
   selenium.isTextPresent("Upps!! No se han encontrado resultados para esta busqueda.");
 }
Ejemplo n.º 3
0
 protected void setUp() throws Exception {
   super.setUp();
   selenium =
       new DefaultSelenium(
           "localhost",
           SeleniumServer.DEFAULT_PORT,
           "*firefox",
           "http://localhost:" + SeleniumServer.DEFAULT_PORT);
   selenium.start();
 }
Ejemplo n.º 4
0
 public void testWithJavaScript() {
   selenium.setContext(
       "A real test, using the real Selenium on the browser side served by Jetty, driven from Java",
       SeleniumLogLevels.DEBUG);
   selenium.open("/selenium-server/tests/html/test_click_page1.html");
   assertTrue(
       "link 'link' doesn't contain expected text",
       selenium.getText("link").indexOf("Click here for next page") != -1);
   String[] links = selenium.getAllLinks();
   assertTrue(links.length > 3);
   assertEquals("linkToAnchorOnThisPage", links[3]);
   selenium.click("link");
   selenium.waitForPageToLoad("10000");
   assertTrue(
       selenium.getLocation().endsWith("/selenium-server/tests/html/test_click_page2.html"));
   selenium.click("previousPage");
   selenium.waitForPageToLoad("10000");
   assertTrue(
       selenium.getLocation().endsWith("/selenium-server/tests/html/test_click_page1.html"));
 }
Ejemplo n.º 5
0
 public void testMinimal() {
   selenium.setContext(
       "minimal 'test' -- to see how little I need to do to repro firefox hang",
       SeleniumLogLevels.DEBUG);
 }
Ejemplo n.º 6
0
 protected void tearDown() throws Exception {
   selenium.stop();
 }
 public void setUp() throws Exception {
   String url = "http://localhost:8080";
   selenium = new DefaultSelenium("localhost", 4444, "*firefox", url);
   selenium.start();
 }