package org.adullact.iparapheur.it;

public class LoginTest extends ParapheurIntegrationTestCase {

    public void testLoginLogout() throws Exception {
        selenium.open(CONTEXT_PATH + "/faces/jsp/parapheur/parapheur.jsp");
        String loginPageTitle = selenium.getTitle();
        selenium.type("loginForm:user-name", "admin");
        selenium.type("loginForm:user-password", "admin");
        selenium.click("loginForm:submit");
        selenium.waitForPageToLoad("30000");
        selenium.click("logout");
        selenium.waitForPageToLoad("30000");
        assertEquals(loginPageTitle, selenium.getTitle());
    }

    public void testInvalidPassword() throws Exception {
        selenium.open(CONTEXT_PATH + "/faces/jsp/parapheur/parapheur.jsp");
        String loginPageTitle = selenium.getTitle();
        selenium.type("loginForm:user-name", "admin");
        selenium.type("loginForm:user-password", "wrongpassword");
        selenium.click("loginForm:submit");
        selenium.waitForPageToLoad("30000");
        assertEquals(loginPageTitle, selenium.getTitle());
    }
}
