01: package info.jtrac.selenium;
02:
03: public class AllTest extends SeleniumTestCase {
04:
05: static {
06: clazz = AllTest.class;
07: }
08:
09: public AllTest(String name) {
10: super (name);
11: }
12:
13: public void testGetLoginPage() {
14: selenium.open("http://localhost:8080/jtrac/app/login");
15: assertEquals("JTrac Login", selenium.getTitle());
16: }
17:
18: public void testSuccessfulLogin() {
19: selenium.type("loginName", "admin");
20: selenium.type("password", "admin");
21: selenium.clickAndWait("//input[@value='Submit']");
22: assertTextPresent("DASHBOARD");
23: }
24:
25: public void testCreateNewSpaceAndAllocateAdmin() throws Exception {
26: selenium.clickAndWait("link=OPTIONS");
27: assertTextPresent("Options Menu");
28: selenium.clickAndWait("link=Manage Spaces");
29: assertTextPresent("Space List");
30: selenium.clickAndWait("link=Create New Space");
31: assertTextPresent("Space Details");
32: selenium.type("space.name", "Test Space");
33: selenium.type("space.prefixCode", "TEST");
34: selenium.clickAndWait("//input[@value='Next']");
35: assertTextPresent("Custom Fields for Space:");
36: selenium.clickAndWait("//input[@value='Next']");
37: assertTextPresent("Space Roles");
38: selenium.clickAndWait("//input[@value='Save']");
39: assertTextPresent("Users Allocated To Space");
40: selenium.clickAndWait("//input[@value='Allocate']");
41: assertTextPresent("Admin");
42: }
43:
44: public void testCreateNewItem() throws Exception {
45: selenium.clickAndWait("link=DASHBOARD");
46: assertTextPresent("Test Space");
47: selenium.clickAndWait("link=NEW");
48: assertTextPresent("Summary");
49: selenium.type("summary", "Test Summary");
50: selenium.type("detail", "Test Detail");
51: selenium.select("hideAssignedTo:border:assignedTo", "Admin");
52: selenium.clickAndWait("//input[@value='Submit']");
53: assertTextPresent("TEST-1");
54: }
55:
56: public void testSearchAllContainsItem() throws Exception {
57: selenium.clickAndWait("link=SEARCH");
58: assertTextPresent("Show History");
59: selenium.clickAndWait("//input[@value='Search']");
60: assertTextPresent("1 Record Found");
61: selenium.clickAndWait("link=TEST-1");
62: assertTextPresent("History");
63: }
64:
65: public void testUpdateHistoryForItem() throws Exception {
66: selenium.select("status", "Closed");
67: selenium.type("comment", "Test Comment");
68: selenium.clickAndWait("//input[@value='Submit']");
69: assertTextPresent("Test Comment");
70:
71: }
72:
73: public void testCreateNewUser() throws Exception {
74: selenium.clickAndWait("link=OPTIONS");
75: selenium.clickAndWait("link=Manage Users");
76: assertTextPresent("Users and allocated Spaces");
77: selenium.clickAndWait("link=Create New User");
78: assertTextPresent("User Details");
79: selenium.type("user.loginName", "testuser");
80: selenium.type("user.name", "Test User");
81: selenium.type("user.email", "foo@bar.com");
82: selenium.clickAndWait("//input[@value='Submit']");
83: selenium.clickAndWait("//input[@value='Search']");
84: assertTextPresent("Test User");
85: }
86:
87: public void testLogout() throws Exception {
88: selenium.clickAndWait("link=LOGOUT");
89: assertTextPresent("Logout Successful");
90: stopSelenium();
91: }
92:
93: }
|