/**
   * Test functionality of the ForgotUsername page:
   *
   * <ul>
   *   <li>A user can be found using correct email
   *   <li>No user is found using wrong email
   *   <li>Email text is properly escaped
   * </ul>
   */
  @Test
  public void testForgotUsername() {
    String space = "Test";
    String page = "SQLTestPage";
    String mail = "*****@*****.**"; // default Admin mail
    String user = "******";
    String badMail = "*****@*****.**";

    // Ensure there is a page we will try to find using HQL injection
    editInWikiEditor(space, page);
    setFieldValue("title", page);
    setFieldValue("content", page);
    clickEditSaveAndView();

    // test that it finds the correct user
    open("XWiki", "ForgotUsername");
    setFieldValue("e", mail);
    submit("//input[@type='submit']"); // there are no other buttons
    assertTextNotPresent("No account is registered using this email address");
    assertElementPresent("//div[@id='xwikicontent']//strong[text()='" + user + "']");

    // test that bad mail results in no results
    open("XWiki", "ForgotUsername");
    setFieldValue("e", badMail);
    submit("//input[@type='submit']"); // there are no other buttons
    assertTextPresent("No account is registered using this email address");
    assertElementNotPresent("//div[@id='xwikicontent']//strong[@value='" + user + "']");

    // XWIKI-4920 test that the email is properly escaped
    open("XWiki", "ForgotUsername");
    setFieldValue("e", "a' synta\\'x error");
    submit("//input[@type='submit']"); // there are no other buttons
    assertTextPresent("No account is registered using this email address");
    assertTextNotPresent("Error");
  }
Beispiel #2
0
 @Test
 public void tamagotchiIsDisplayedTest() {
   goTo("http://localhost:4567/");
   fill("#name").with("lil dragon");
   submit(".btn");
   assertThat(pageSource()).contains("Hello, my name is lil dragon");
 }
 @Test
 public void returnTie() {
   goTo("http://localhost:4567/");
   find("#oneRock").click();
   find("#twoRock").click();
   submit(".btn");
   assertThat(pageSource()).contains("Tie");
 }
 @Test
 public void returnCorrectWinner() {
   goTo("http://localhost:4567/");
   find("#oneRock").click();
   find("#twoPaper").click();
   submit(".btn");
   assertThat(pageSource()).contains("Paper");
 }
 @Test
 public void submitArticle() {
   goTo("http://localhost:" + serverPort + "/articles/new");
   fill("#author").with("Santeri");
   fill("#title").with("Eeppinen kandi");
   fill("#citation").with("artsu");
   fill("#journal").with("test");
   fill("#year").with("1999");
   fill("#volume").with("1");
   submit("button[type=submit]");
   assertTrue(pageSource().contains("New article created"));
 }
  @Ignore
  @Test
  public void test() {
    // try to type correct login and password.
    beginAt("logOn.jsp"); // start on logOn.jsp
    clickLink("enLocale"); // switch on ru locale
    setTextField("login", "user6");
    setTextField("password", "12341234");
    submit();
    assertTitleEquals("Manager home page");

    clickLink("showWorkers");
    assertTitleEquals("Workers list");
  }
Beispiel #7
0
  @Test
  public void testLogin() {
    beginAt("/default.jsp"); // Open the browser on
    // http://localhost:8080/test/home.xhtml

    assertTitleEquals("Movies");
    assertElementPresent("janrainModal");
    String element = getElementAttributeByXPath("//div[@id='janrainModal']", "style");
    assertTrue(element.contains("display: none"));
    clickLink("login");
    element = getElementAttributeByXPath("//div[@id='janrainModal']", "style");
    assertTrue(element.contains("display: block"));

    assertElementPresent("janrain-yahoo");
    clickElementByXPath("//li[@id='janrain-yahoo']");
    assertWindowCountEquals(2);
    assertWindowPresentWithTitle("Sign in to Yahoo!");
    gotoWindowByTitle("Sign in to Yahoo!");
    setTextField("login", "*****@*****.**");
    setTextField("passwd", "Test12345");

    submit(".save");

    try {
      Thread.sleep(20000);
    } catch (InterruptedException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    // beginAt("/default.jsp");
    // gotoWindowByTitle("Movies");

    assertTextPresent("Logout");
    assertElementPresent("username");
    IElement username = getElementById("username");

    assertTrue(username.getTextContent().contains("movie hunter"));

    assertElementNotPresent("login");

    assertElementPresent("logout");
    clickLink("logout");
    assertElementPresent("login");
  }