1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.mainmenu.test;
17
18 import org.junit.After;
19 import org.junit.Before;
20 import org.junit.Test;
21 import org.junit.Assert;
22
23 import com.thoughtworks.selenium.*;
24
25
26
27
28
29
30 public class CreateNewAgendaIT {
31
32 private Selenium selenium;
33
34 @Before
35 public void setUp() throws Exception {
36 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
37 selenium.start();
38 }
39
40 @Test
41 public void testCreateNewAgenda() throws Exception {
42 selenium.open(System.getProperty("remote.public.url"));
43 selenium.type("name=__login_user", "admin");
44 selenium.click("css=input[type=\"submit\"]");
45 selenium.waitForPageToLoad("30000");
46 selenium.click("link=Create New Agenda");
47 selenium.waitForPageToLoad("30000");
48 selenium.selectFrame("iframeportlet");
49 selenium.select("name=document.newMaintainableObject.dataObject.namespace", "label=Kuali Rules Test");
50 selenium.type("name=document.newMaintainableObject.dataObject.agenda.name", "Agenda Name 1");
51 selenium.click("id=u244");
52 Thread.sleep(2000);
53 selenium.selectFrame("relative=up");
54 for (int second = 0;; second++) {
55 if (second >= 60)
56 Assert.fail("timeout");
57 try {
58 if (selenium.isElementPresent("id=fancybox-frame"))
59 break;
60 } catch (Exception e) {}
61 Thread.sleep(1000);
62 }
63
64 selenium.selectFrame("fancybox-frame");
65 for (int second = 0;; second++) {
66 if (second >= 60)
67 Assert.fail("timeout");
68 try {
69 if (selenium.isElementPresent("id=u80"))
70 break;
71 } catch (Exception e) {}
72 Thread.sleep(1000);
73 }
74
75 selenium.click("id=u80");
76 selenium.waitForPageToLoad("30000");
77 selenium.click("link=return value");
78 Thread.sleep(2000);
79 selenium.waitForPopUp("iframeportlet", "30000");
80 for (int second = 0;; second++) {
81 if (second >= 60)
82 Assert.fail("timeout");
83 try {
84 if (selenium.isElementPresent("id=u260_attribute"))
85 break;
86 } catch (Exception e) {}
87 Thread.sleep(1000);
88 }
89
90 selenium.select("id=u260_attribute", "label=Campus Agenda");
91 Thread.sleep(2000);
92 selenium.click("id=u588");
93 selenium.selectFrame("relative=up");
94 for (int second = 0;; second++) {
95 if (second >= 60)
96 Assert.fail("timeout");
97 try {
98 if (selenium.isElementPresent("id=fancybox-frame"))
99 break;
100 } catch (Exception e) {}
101 Thread.sleep(1000);
102 }
103
104 selenium.selectFrame("id=fancybox-frame");
105 for (int second = 0;; second++) {
106 if (second >= 60)
107 Assert.fail("timeout");
108 try {
109 if (selenium.isElementPresent("id=u80"))
110 break;
111 } catch (Exception e) {}
112 Thread.sleep(1000);
113 }
114
115 selenium.click("id=u80");
116 selenium.waitForPageToLoad("30000");
117 selenium.click("link=return value");
118 Thread.sleep(2000);
119 selenium.waitForPopUp("iframeportlet", "30000");
120 for (int second = 0;; second++) {
121 if (second >= 60)
122 Assert.fail("timeout");
123 try {
124 if (selenium.isElementPresent("id=u135"))
125 break;
126 } catch (Exception e) {}
127 Thread.sleep(1000);
128 }
129
130 selenium.click("id=u135");
131 selenium.click("id=u156");
132 selenium.waitForPageToLoad("30000");
133 selenium.selectWindow("null");
134 selenium.click("xpath=(//input[@name='imageField'])[2]");
135 selenium.waitForPageToLoad("30000");
136 }
137
138 @After
139 public void tearDown() throws Exception {
140 selenium.stop();
141 }
142 }