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 static org.junit.Assert.*;
019
020 import java.util.Calendar;
021
022 import org.junit.After;
023 import org.junit.Assert;
024 import org.junit.Before;
025 import org.junit.Ignore;
026 import org.junit.Test;
027 import org.openqa.selenium.By;
028 import org.openqa.selenium.support.ui.Select;
029
030 import com.thoughtworks.selenium.Selenium;
031
032 import edu.samplu.common.AdminMenuITBase;
033 import edu.samplu.common.ITUtil;
034 import edu.samplu.common.MainMenuLookupITBase;
035 import edu.samplu.common.MainMenuLookupLegacyITBase;
036 import edu.samplu.common.MenuITBase;
037 import edu.samplu.common.UpgradedSeleniumITBase;
038
039 /**
040 * TODO vchauhan don't forget to fill this in.
041 *
042 * @author Kuali Rice Team (rice.collab@kuali.org)
043 */
044 public class PeopleFlowCreateNewLegacyIT extends MainMenuLookupLegacyITBase {
045
046
047
048 @Test
049 public void testPeopleFlow() throws Exception {
050
051 //Click Main Menu and Create New
052 gotoMenuLinkLocator();
053 waitAndClick(By.linkText(getCreateNewLinkLocator()));
054 //Save docId
055 waitForElementPresent("div[data-headerfor='PeopleFlow-MaintenanceView'] div[data-label='Document Number'] > span");
056 String docId = getText("div[data-headerfor='PeopleFlow-MaintenanceView'] div[data-label='Document Number'] > span");
057
058
059 driver.findElement(By.name("document.documentHeader.documentDescription")).clear();
060 driver.findElement(By.name("document.documentHeader.documentDescription")).sendKeys("Description for Document");
061 new Select(driver.findElement(By.name("document.newMaintainableObject.dataObject.namespaceCode"))).selectByVisibleText("KUALI - Kuali Systems");
062 driver.findElement(By.name("document.newMaintainableObject.dataObject.name")).clear();
063 driver.findElement(By.name("document.newMaintainableObject.dataObject.name")).sendKeys("Document Name" + ITUtil.DTS);
064
065 //Add Row1
066 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
067 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).sendKeys("kr");
068 driver.findElement(By.cssSelector("button[data-loadingmessage='Adding Line...']")).click();
069 Thread.sleep(3000);
070 //Add Row2
071 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).clear();
072 driver.findElement(By.name("newCollectionLines['document.newMaintainableObject.dataObject.members'].memberName")).sendKeys("admin");
073 driver.findElement(By.cssSelector("button[data-loadingmessage='Adding Line...']")).click();
074 Thread.sleep(3000);
075
076 //Blanket approve
077 driver.findElement(By.cssSelector("div[data-parent='PeopleFlow-MaintenanceView'] > div.uif-footer button~button~button")).click();
078 Thread.sleep(5000);
079 //Close the Doc
080 driver.findElement(By.id("uif-close")).click();
081 Thread.sleep(3000);
082
083
084 driver.switchTo().window(driver.getWindowHandles().toArray()[0].toString());
085 driver.findElement(By.cssSelector("img[alt=\"doc search\"]")).click();
086 Thread.sleep(5000);
087 driver.switchTo().frame("iframeportlet");
088
089 driver.findElement(By.cssSelector("td.infoline > input[name=\"methodToCall.search\"]")).click();
090 Thread.sleep(5000);
091 assertEquals("FINAL", driver.findElement(By.xpath("//table[@id='row']/tbody/tr/td[4]")).getText());
092 driver.switchTo().defaultContent();
093 driver.findElement(By.name("imageField")).click();
094
095 }
096
097 /**
098 * This overridden method ...
099 *
100 * @see edu.samplu.common.MainMenuLookupITBase#lookupAssertions()
101 */
102 @Override
103 public void lookupAssertions() {
104 // nothing
105
106 }
107
108 /**
109 * This overridden method ...
110 *
111 * @see edu.samplu.common.MenuITBase#getLinkLocator()
112 */
113 @Override
114 protected String getLinkLocator() {
115 return "People Flow";
116 }
117
118
119 @Ignore // No Need to
120 @Test
121 @Override
122 public void testLookUp() throws Exception {}
123 }