001 /**
002 * Copyright 2005-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/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
017 package edu.samplu.admin.test;
018
019 import static org.junit.Assert.assertEquals;
020
021 import org.junit.Test;
022
023 import edu.samplu.common.AdminMenuLegacyITBase;
024 import edu.samplu.common.ITUtil;
025
026 /**
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 */
029 public class PersonLegacyIT extends AdminMenuLegacyITBase {
030
031 String docId;
032 String personName;
033
034 @Override
035 protected String getLinkLocator() {
036 return "Person";
037 }
038
039 @Test
040 public void testPerson() throws Exception {
041 super.gotoCreateNew();
042 waitForPageToLoad();
043 Thread.sleep(2000);
044 /*assertElementPresentByXpath("//*[@name='methodToCall.route' and @alt='submit']",
045 "save button does not exist on the page");*/
046 waitForElementPresentByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
047 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
048 waitAndTypeByXpath("//input[@id='document.documentHeader.documentDescription']", "Adding Charlie Brown");
049 waitAndTypeByName("document.documentHeader.explanation", "I want to add Charlie Brown to test KIM");
050 //here You should also check for lower case validation for principalName, but it is skipped for now as there is an incident report error there.
051 personName = "cbrown" + ITUtil.DTS_TWO;
052 waitAndTypeByName("document.principalName", personName);
053 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
054 waitForPageToLoad();
055 assertElementPresentByXpath("//div[contains(div,'Document was successfully saved.')]");
056 assertEquals("SAVED", getTextByXpath("//table[@class='headerinfo']//tr[1]/td[2]"));
057 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
058 waitForPageToLoad();
059 assertElementPresentByXpath("//div[contains(.,'At least one affiliation must be entered.')]/img[@alt='error']");
060 assertElementPresentByXpath("//div[contains(.,'At least one name must be entered.')]/img[@alt='error']");
061 System.out.println("------------------------------------Validation Test Successful--------------------------");
062
063 selectOptionByName("newAffln.affiliationTypeCode", "STDNT");
064 selectOptionByName("newAffln.campusCode", "BL");
065 checkByName("newAffln.dflt");
066 waitAndClickByName("methodToCall.addAffln.anchor");
067 waitForPageToLoad();
068 //waitAndClickByName("methodToCall.toggleTab.tabContact");
069 waitForPageToLoad();
070 Thread.sleep(3000);
071 selectOptionByName("newName.nameCode", "PRM");
072 selectOptionByName("newName.namePrefix", "Mr");
073 waitAndTypeByName("newName.firstName", "Charlie");
074 waitAndTypeByName("newName.lastName", "Brown");
075 checkByName("newName.dflt");
076 waitAndClickByName("methodToCall.addName.anchor");
077 waitForPageToLoad();
078 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
079 waitForPageToLoad();
080 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]",
081 "Document is not submitted successfully");
082 assertEquals("ENROUTE", getTextByXpath("//table[@class='headerinfo']//tr[1]/td[2]"));
083 System.out.println("------------------------------------Person document submitted successfully--------------------------");
084
085 selectTopFrame();
086 super.gotoMenuLinkLocator();
087 waitForPageToLoad();
088 waitAndTypeByName("principalName", personName);
089 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
090 isElementPresentByLinkText(personName);
091 waitAndClickByName("methodToCall.clearValues");
092 waitAndTypeByName("firstName","Charlie");
093 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
094 isElementPresentByLinkText(personName);
095 waitAndClickByName("methodToCall.clearValues");
096 waitAndTypeByName("lastName", "Brown");
097 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
098 isElementPresentByLinkText(personName);
099 waitAndClickByName("methodToCall.clearValues");
100 waitAndTypeByName("campusCode", "BL");
101 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
102 isElementPresentByLinkText(personName);
103 System.out.println("----------------------------------Lookup successful-----------------------------");
104
105 waitAndClickByLinkText(personName);
106 waitForPageToLoad();
107 Thread.sleep(5000);
108 switchToWindow("Kuali :: Person");
109 Thread.sleep(2000);
110 assertEquals(personName, getTextByXpath("//div[@class='tab-container']/table//tr[2]/td[1]/div").trim());
111 assertEquals("BL - BLOOMINGTON", getTextByXpath("//div[@class='tab-container']/table[3]//tr[2]/td[2]/div").trim());
112 assertEquals("Student", getTextByXpath("//select/option[@selected]").trim());
113 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Overview']");
114 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Contact']");
115 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Privacy Preferences']");
116 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Membership']");
117 waitAndClickByName("methodToCall.showAllTabs");
118 Thread.sleep(3000);
119 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Overview']");
120 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Contact']");
121 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Privacy Preferences']");
122 assertElementPresentByXpath("//table[@class='tab']//input[@title='close Membership']");
123 waitAndClickByName("methodToCall.hideAllTabs");
124 Thread.sleep(3000);
125 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Overview']");
126 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Contact']");
127 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Privacy Preferences']");
128 assertElementPresentByXpath("//table[@class='tab']//input[@title='open Membership']");
129 waitAndClickByXpath("//*[@title='close this window']");
130 switchToWindow("null");
131 System.out.println("------------------------------------Viewing from Inquiry Framework Test Successful--------------------------");
132
133 }
134
135 }