001 /* 002 * Copyright 2011 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/ecl1.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.mainmenu.test; 017 018 import org.junit.After; 019 import org.junit.Before; 020 import org.junit.Test; 021 import org.junit.Assert; 022 023 import com.thoughtworks.selenium.*; 024 025 /** 026 * tests whether the "Create New Agenda" is working ok 027 * 028 * @author Kuali Rice Team (rice.collab@kuali.org) 029 */ 030 public class CreateNewAgendaIT { 031 032 private Selenium selenium; 033 034 @Before 035 public void setUp() throws Exception { 036 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url")); 037 selenium.start(); 038 } 039 040 @Test 041 public void testCreateNewAgenda() throws Exception { 042 selenium.open(System.getProperty("remote.public.url")); 043 selenium.type("name=__login_user", "admin"); 044 selenium.click("css=input[type=\"submit\"]"); 045 selenium.waitForPageToLoad("30000"); 046 selenium.click("link=Create New Agenda"); 047 selenium.waitForPageToLoad("30000"); 048 selenium.selectFrame("iframeportlet"); 049 selenium.select("name=document.newMaintainableObject.dataObject.namespace", "label=Kuali Rules Test"); 050 selenium.type("name=document.newMaintainableObject.dataObject.agenda.name", "Agenda Name 1"); 051 selenium.click("id=u244"); 052 Thread.sleep(2000); 053 selenium.selectFrame("relative=up"); 054 for (int second = 0;; second++) { 055 if (second >= 60) 056 Assert.fail("timeout"); 057 try { 058 if (selenium.isElementPresent("id=fancybox-frame")) 059 break; 060 } catch (Exception e) {} 061 Thread.sleep(1000); 062 } 063 064 selenium.selectFrame("fancybox-frame"); 065 for (int second = 0;; second++) { 066 if (second >= 60) 067 Assert.fail("timeout"); 068 try { 069 if (selenium.isElementPresent("id=u80")) 070 break; 071 } catch (Exception e) {} 072 Thread.sleep(1000); 073 } 074 075 selenium.click("id=u80"); 076 selenium.waitForPageToLoad("30000"); 077 selenium.click("link=return value"); 078 Thread.sleep(2000); 079 selenium.waitForPopUp("iframeportlet", "30000"); 080 for (int second = 0;; second++) { 081 if (second >= 60) 082 Assert.fail("timeout"); 083 try { 084 if (selenium.isElementPresent("id=u260_attribute")) 085 break; 086 } catch (Exception e) {} 087 Thread.sleep(1000); 088 } 089 090 selenium.select("id=u260_attribute", "label=Campus Agenda"); 091 Thread.sleep(2000); 092 selenium.click("id=u588"); 093 selenium.selectFrame("relative=up"); 094 for (int second = 0;; second++) { 095 if (second >= 60) 096 Assert.fail("timeout"); 097 try { 098 if (selenium.isElementPresent("id=fancybox-frame")) 099 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 }