001    /*
002     * Copyright 2006-2012 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package edu.samplu.krad.travelview;
017    
018    import com.thoughtworks.selenium.DefaultSelenium;
019    import com.thoughtworks.selenium.Selenium;
020    import org.junit.After;
021    import org.junit.Before;
022    import org.junit.Test;
023    
024    import static org.junit.Assert.*;
025    
026    public class MaintenanceDisclosuresIT {
027        private Selenium selenium;
028    
029        @Before
030        public void setUp() throws Exception {
031            selenium = new DefaultSelenium("localhost", 4444, "*chrome", System.getProperty("remote.public.url"));
032            selenium.start();
033        }
034    
035        @Test
036        /**
037         * Verify disclosures are present and functional
038         */
039        public void testVerifyDisclosures() throws Exception {
040            selenium.open("/kr-dev/portal.do");
041            selenium.type("name=__login_user", "admin");
042            selenium.click("css=input[type=\"submit\"]");
043            selenium.waitForPageToLoad("30000");
044            selenium.click("link=KRAD");
045            selenium.waitForPageToLoad("50000");
046            selenium.click("link=Travel Account Maintenance (New)");
047            selenium.waitForPageToLoad("100000");
048            selenium.selectFrame("iframeportlet");
049    
050            assertTrue(selenium.isElementPresent("css=#u93_exp"));
051            assertTrue(selenium.isElementPresent("css=#u779_exp"));
052            assertTrue(selenium.isElementPresent("css=#u955_exp"));
053            assertTrue(selenium.isElementPresent("css=#u168_col"));
054            assertTrue(selenium.isElementPresent("css=#u416_col"));
055            assertTrue(selenium.isElementPresent("css=#u755_col"));
056            selenium.click("id=u93_exp");
057    
058            for (int second = 0;; second++) {
059                if (second >= 15) {
060                    fail("timeout");
061                }
062    
063                if (!selenium.isVisible("css=#u116_label")) {
064                    break;
065                }
066    
067                Thread.sleep(1000);
068            }
069    
070            selenium.click("id=u93_col");
071    
072            for (int second = 0;; second++) {
073                if (second >= 15) {
074                    fail("timeout");
075                }
076    
077                if (selenium.isVisible("css=#u116_label")) {
078                    break;
079                }
080    
081                Thread.sleep(1000);
082            }
083    
084            selenium.click("id=u779_exp");
085    
086            for (int second = 0;; second++) {
087                if (second >= 15) {
088                    fail("timeout");
089                }
090    
091                if (!selenium.isVisible("css=#u802_label")) {
092                    break;
093                }
094    
095                Thread.sleep(1000);
096            }
097    
098            selenium.click("id=u779_col");
099    
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    }