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
17 package edu.samplu.krad.validationmessagesview;
18
19 import com.thoughtworks.selenium.Selenium;
20 import junit.framework.Assert;
21
22 /**
23 * @author Kuali Rice Team (rice.collab@kuali.org)
24 */
25
26 public class SeUtil {
27 public static String getBaseUrlString() {
28 String baseUrl = System.getProperty("remote.public.url");
29 if (baseUrl == null) {
30 baseUrl = "http://localhost:8080";
31 } else if (baseUrl.endsWith("/")) {
32 baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
33 } else if (!baseUrl.startsWith("http")) {
34 baseUrl = "http://" + baseUrl;
35 }
36 return baseUrl;
37 }
38
39 public static void login(Selenium selenium) {
40 Assert.assertEquals("Login", selenium.getTitle());
41 selenium.type("__login_user", "admin");
42 selenium.click("//input[@value='Login']");
43 selenium.waitForPageToLoad("30000");
44 }
45 }
46
47