1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.samplu.admin.test;
18
19 import static org.junit.Assert.assertEquals;
20
21 import org.junit.Test;
22
23 import edu.samplu.common.AdminMenuLegacyITBase;
24 import edu.samplu.common.ITUtil;
25
26
27
28
29 public class PersonLegacyIT extends AdminMenuLegacyITBase {
30
31 String docId;
32 String personName;
33
34 @Override
35 protected String getLinkLocator() {
36 return "Person";
37 }
38
39 @Test
40 public void testPerson() throws Exception {
41 super.gotoCreateNew();
42 waitForPageToLoad();
43 Thread.sleep(2000);
44
45
46 waitForElementPresentByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
47 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
48 waitAndTypeByXpath("//input[@id='document.documentHeader.documentDescription']", "Adding Charlie Brown");
49 waitAndTypeByName("document.documentHeader.explanation", "I want to add Charlie Brown to test KIM");
50
51 personName = "cbrown" + ITUtil.DTS_TWO;
52 waitAndTypeByName("document.principalName", personName);
53 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
54 waitForPageToLoad();
55 assertElementPresentByXpath("//div[contains(div,'Document was successfully saved.')]");
56 assertEquals("SAVED", getTextByXpath("//table[@class='headerinfo']//tr[1]/td[2]"));
57 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
58 waitForPageToLoad();
59 assertElementPresentByXpath("//div[contains(.,'At least one affiliation must be entered.')]/img[@alt='error']");
60 assertElementPresentByXpath("//div[contains(.,'At least one name must be entered.')]/img[@alt='error']");
61 System.out.println("------------------------------------Validation Test Successful--------------------------");
62
63 selectOptionByName("newAffln.affiliationTypeCode", "STDNT");
64 selectOptionByName("newAffln.campusCode", "BL");
65 checkByName("newAffln.dflt");
66 waitAndClickByName("methodToCall.addAffln.anchor");
67 waitForPageToLoad();
68
69 waitForPageToLoad();
70 Thread.sleep(3000);
71 selectOptionByName("newName.nameCode", "PRM");
72 selectOptionByName("newName.namePrefix", "Mr");
73 waitAndTypeByName("newName.firstName", "Charlie");
74 waitAndTypeByName("newName.lastName", "Brown");
75 checkByName("newName.dflt");
76 waitAndClickByName("methodToCall.addName.anchor");
77 waitForPageToLoad();
78 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
79 waitForPageToLoad();
80 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]",
81 "Document is not submitted successfully");
82 assertEquals("ENROUTE", getTextByXpath("//table[@class='headerinfo']//tr[1]/td[2]"));
83 System.out.println("------------------------------------Person document submitted successfully--------------------------");
84
85 selectTopFrame();
86 super.gotoMenuLinkLocator();
87 waitForPageToLoad();
88 waitAndTypeByName("principalName", personName);
89 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
90 isElementPresentByLinkText(personName);
91 waitAndClickByName("methodToCall.clearValues");
92 waitAndTypeByName("firstName","Charlie");
93 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
94 isElementPresentByLinkText(personName);
95 waitAndClickByName("methodToCall.clearValues");
96 waitAndTypeByName("lastName", "Brown");
97 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
98 isElementPresentByLinkText(personName);
99 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 }