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 edu.samplu.common.UpgradedSeleniumITBase;
019 import org.junit.Test;
020 import org.junit.Assert;
021
022 /**
023 * tests whether the "Create New Agenda" is working ok
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027 public class CreateNewAgendaIT extends UpgradedSeleniumITBase {
028 @Override
029 public String getTestUrl() {
030 return PORTAL;
031 }
032
033 @Test
034 public void testCreateNewAgenda() throws Exception {
035 selenium.click("link=Create New Agenda");
036 selenium.waitForPageToLoad("30000");
037 selenium.selectFrame("iframeportlet");
038 selenium.select("name=document.newMaintainableObject.dataObject.namespace", "label=Kuali Rules Test");
039 selenium.type("name=document.newMaintainableObject.dataObject.agenda.name", "Agenda Name 1");
040 selenium.click("id=u244");
041 Thread.sleep(2000);
042 selenium.selectFrame("relative=up");
043 for (int second = 0;; second++) {
044 if (second >= 60)
045 Assert.fail("timeout");
046 try {
047 if (selenium.isElementPresent("id=fancybox-frame"))
048 break;
049 } catch (Exception e) {}
050 Thread.sleep(1000);
051 }
052
053 selenium.selectFrame("fancybox-frame");
054 for (int second = 0;; second++) {
055 if (second >= 60)
056 Assert.fail("timeout");
057 try {
058 if (selenium.isElementPresent("id=u80"))
059 break;
060 } catch (Exception e) {}
061 Thread.sleep(1000);
062 }
063
064 selenium.click("id=u80");
065 selenium.waitForPageToLoad("30000");
066 selenium.click("link=return value");
067 Thread.sleep(2000);
068 selenium.waitForPopUp("iframeportlet", "30000");
069 for (int second = 0;; second++) {
070 if (second >= 60)
071 Assert.fail("timeout");
072 try {
073 if (selenium.isElementPresent("id=u260_attribute"))
074 break;
075 } catch (Exception e) {}
076 Thread.sleep(1000);
077 }
078
079 selenium.select("id=u260_attribute", "label=Campus Agenda");
080 Thread.sleep(2000);
081 selenium.click("id=u588");
082 selenium.selectFrame("relative=up");
083 for (int second = 0;; second++) {
084 if (second >= 60)
085 Assert.fail("timeout");
086 try {
087 if (selenium.isElementPresent("id=fancybox-frame"))
088 break;
089 } catch (Exception e) {}
090 Thread.sleep(1000);
091 }
092
093 selenium.selectFrame("id=fancybox-frame");
094 for (int second = 0;; second++) {
095 if (second >= 60)
096 Assert.fail("timeout");
097 try {
098 if (selenium.isElementPresent("id=u80"))
099 break;
100 } catch (Exception e) {}
101 Thread.sleep(1000);
102 }
103
104 selenium.click("id=u80");
105 selenium.waitForPageToLoad("30000");
106 selenium.click("link=return value");
107 Thread.sleep(2000);
108 selenium.waitForPopUp("iframeportlet", "30000");
109 for (int second = 0;; second++) {
110 if (second >= 60)
111 Assert.fail("timeout");
112 try {
113 if (selenium.isElementPresent("id=u135"))
114 break;
115 } catch (Exception e) {}
116 Thread.sleep(1000);
117 }
118
119 selenium.click("id=u135");
120 selenium.click("id=u156");
121 selenium.waitForPageToLoad("30000");
122 selenium.selectWindow("null");
123 selenium.click("xpath=(//input[@name='imageField'])[2]");
124 selenium.waitForPageToLoad("30000");
125 }
126 }