View Javadoc

1   /*
2    * Copyright 2006-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.samplu.krad.travelview;
17  
18  import com.thoughtworks.selenium.DefaultSelenium;
19  import com.thoughtworks.selenium.Selenium;
20  import org.junit.After;
21  import org.junit.Before;
22  import org.junit.Test;
23  
24  import static org.junit.Assert.*;
25  
26  public class MaintenanceDisclosuresIT {
27      private Selenium selenium;
28  
29      @Before
30      public void setUp() throws Exception {
31          selenium = new DefaultSelenium("localhost", 4444, "*chrome", System.getProperty("remote.public.url"));
32          selenium.start();
33      }
34  
35      @Test
36      /**
37       * Verify disclosures are present and functional
38       */
39      public void testVerifyDisclosures() throws Exception {
40          selenium.open("/kr-dev/portal.do");
41          selenium.type("name=__login_user", "admin");
42          selenium.click("css=input[type=\"submit\"]");
43          selenium.waitForPageToLoad("30000");
44          selenium.click("link=KRAD");
45          selenium.waitForPageToLoad("50000");
46          selenium.click("link=Travel Account Maintenance (New)");
47          selenium.waitForPageToLoad("100000");
48          selenium.selectFrame("iframeportlet");
49  
50          assertTrue(selenium.isElementPresent("css=#u93_exp"));
51          assertTrue(selenium.isElementPresent("css=#u779_exp"));
52          assertTrue(selenium.isElementPresent("css=#u955_exp"));
53          assertTrue(selenium.isElementPresent("css=#u168_col"));
54          assertTrue(selenium.isElementPresent("css=#u416_col"));
55          assertTrue(selenium.isElementPresent("css=#u755_col"));
56          selenium.click("id=u93_exp");
57  
58          for (int second = 0;; second++) {
59              if (second >= 15) {
60                  fail("timeout");
61              }
62  
63              if (!selenium.isVisible("css=#u116_label")) {
64                  break;
65              }
66  
67              Thread.sleep(1000);
68          }
69  
70          selenium.click("id=u93_col");
71  
72          for (int second = 0;; second++) {
73              if (second >= 15) {
74                  fail("timeout");
75              }
76  
77              if (selenium.isVisible("css=#u116_label")) {
78                  break;
79              }
80  
81              Thread.sleep(1000);
82          }
83  
84          selenium.click("id=u779_exp");
85  
86          for (int second = 0;; second++) {
87              if (second >= 15) {
88                  fail("timeout");
89              }
90  
91              if (!selenium.isVisible("css=#u802_label")) {
92                  break;
93              }
94  
95              Thread.sleep(1000);
96          }
97  
98          selenium.click("id=u779_col");
99  
100         for (int second = 0;; second++) {
101             if (second >= 15) {
102                 fail("timeout");
103             }
104 
105             if (selenium.isVisible("css=#u802_label")) {
106                 break;
107             }
108 
109             Thread.sleep(1000);
110         }
111 
112         selenium.click("css=#u955_toggle > span.uif-headerText-span");
113 
114         for (int second = 0;; second++) {
115             if (second >= 15) {
116                 fail("timeout");
117             }
118 
119             if (!selenium.isVisible("css=h4.uif-headerText > span.uif-headerText-span")) {
120                 break;
121             }
122 
123             Thread.sleep(1000);
124         }
125 
126         selenium.click("css=#u955_toggle > span.uif-headerText-span");
127 
128         for (int second = 0;; second++) {
129             if (second >= 15) {
130                 fail("timeout");
131             }
132 
133             if (selenium.isVisible("css=h4.uif-headerText > span.uif-headerText-span")) {
134                 break;
135             }
136 
137             Thread.sleep(1000);
138         }
139 
140         selenium.click("css=#u168_toggle > span.uif-headerText-span");
141 
142         for (int second = 0;; second++) {
143             if (second >= 15) {
144                 fail("timeout");
145             }
146 
147             if (selenium.isVisible("css=#u221_add")) {
148                 break;
149             }
150 
151             Thread.sleep(1000);
152         }
153 
154         selenium.click("css=#u168_toggle > span.uif-headerText-span");
155 
156         for (int second = 0;; second++) {
157             if (second >= 15) {
158                 fail("timeout");
159             }
160 
161             if (!selenium.isVisible("css=#u221_add")) {
162                 break;
163             }
164 
165             Thread.sleep(1000);
166         }
167 
168         selenium.click("css=#u416_toggle > span.uif-headerText-span");
169 
170         for (int second = 0;; second++) {
171             if (second >= 15) {
172                 fail("timeout");
173             }
174 
175             if (selenium.isVisible("css=#u440 > h4.uif-headerText > span.uif-headerText-span")) {
176                 break;
177             }
178 
179             Thread.sleep(1000);
180         }
181 
182         selenium.click("css=#u416_toggle > span.uif-headerText-span");
183 
184         for (int second = 0;; second++) {
185             if (second >= 15) {
186                 fail("timeout");
187             }
188 
189             if (!selenium.isVisible("css=#u440 > h4.uif-headerText > span.uif-headerText-span")) {
190                 break;
191             }
192 
193             Thread.sleep(1000);
194         }
195 
196         selenium.click("css=#u755_toggle > span.uif-headerText-span");
197 
198         for (int second = 0;; second++) {
199             if (second >= 15) {
200                 fail("timeout");
201             }
202 
203             if (selenium.isVisible("id=routeLogIFrame")) {
204                 break;
205             }
206 
207             Thread.sleep(1000);
208         }
209 
210         selenium.click("css=#u755_toggle > span.uif-headerText-span");
211 
212         for (int second = 0;; second++) {
213             if (second >= 15) {
214                 fail("timeout");
215             }
216 
217             if (!selenium.isVisible("id=routeLogIFrame")) {
218                 break;
219             }
220 
221             Thread.sleep(1000);
222         }
223     }
224 
225     @After
226     public void tearDown() throws Exception {
227         selenium.stop();
228     }
229 }