PageRenderTime 24ms CodeModel.GetById 15ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/src/test/java/org/sigmah/endtoend/EndToEndTestCase.java

http://sigma-h.googlecode.com/
Java | 60 lines | 38 code | 17 blank | 5 comment | 0 complexity | 3e46903c38548b8498fbbbfda9270324 MD5 | raw file
 1/*
 2 * All Sigmah code is released under the GNU General Public License v3
 3 * See COPYRIGHT.txt and LICENSE.txt.
 4 */
 5
 6package org.sigmah.endtoend;
 7
 8import org.openqa.selenium.firefox.FirefoxDriver;
 9import org.openqa.selenium.support.PageFactory;
10import org.sigmah.endtoend.fixture.DevModeContainer;
11import org.sigmah.endtoend.fixture.MSSQLDataSetLoader;
12import org.sigmah.endtoend.page.GxtApplication;
13import org.sigmah.endtoend.page.LoginPage;
14
15public class EndToEndTestCase {
16    protected MSSQLDataSetLoader dataLoader = new MSSQLDataSetLoader();
17    protected static final String EMAIL_ADDRESS = "alex@bertram.com";
18    protected static final String CORRECT_PASSWORD = "monday";
19
20    protected FirefoxDriver driver = new FirefoxDriver("GWT_TESTING");
21    protected final DevModeContainer container = new DevModeContainer();
22
23    public EndToEndTestCase() {
24
25    }
26
27
28    protected LoginPage getLoginPage() {
29        return PageFactory.initElements(driver, LoginPage.class);
30    }
31
32
33    protected GxtApplication getApp() {
34        return new GxtApplication(driver);
35    }
36
37    protected void navigate(String page) {
38        String url = container.getUrl(page);
39        System.err.println("Navigation to " + url);
40        driver.get(url);
41    }
42
43    protected void removeAuthCookie() {
44        driver.manage().deleteCookieNamed("authToken");
45    }
46
47    protected void login() {
48      //  removeAuthCookie();
49        navigate("/");
50
51        LoginPage loginPage = getLoginPage();
52        loginPage.login(EMAIL_ADDRESS, CORRECT_PASSWORD);
53    }
54
55
56    protected void navigateToAppWithAuthorization() {
57        navigate("/?auth=XYZ123");
58    }
59
60}