1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.admin.test;
17
18 import static org.junit.Assert.assertEquals;
19
20 import org.apache.commons.lang.RandomStringUtils;
21 import org.junit.Test;
22
23 import edu.samplu.common.AdminMenuLegacyITBase;
24 import edu.samplu.common.ITUtil;
25
26
27
28
29
30
31 public class ParameterTypeLegacyIT extends AdminMenuLegacyITBase {
32
33
34
35
36
37 String docId;
38 String parameterType;
39 String parameterCode;
40 @Override
41 protected String getLinkLocator() {
42 return "Parameter Type";
43 }
44 @Test
45 public void testParameterType() throws Exception {
46
47 super.gotoCreateNew();
48 waitForPageToLoad();
49 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
50
51 waitAndTypeByName("document.documentHeader.documentDescription", "Adding Test Parameter Type");
52 parameterCode = RandomStringUtils.randomAlphabetic(4).toLowerCase();
53 waitAndTypeByName("document.newMaintainableObject.code", parameterCode);
54 parameterType = "testing " + ITUtil.DTS_TWO;
55 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
56
57 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
58 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
59 waitForPageToLoad();
60 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully");
61 selectTopFrame();
62 waitAndClickByXpath("//a[@title='Document Search']");
63 waitForPageToLoad();
64 selectFrame("iframeportlet");
65 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
66 Thread.sleep(2000);
67 assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a"));
68 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
69 selectTopFrame();
70 System.out.println("--------------------------------New Parameter Type Created-------------------------");
71
72
73 super.gotoMenuLinkLocator();
74 waitAndTypeByName("name", parameterType);
75 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
76 isElementPresentByLinkText(parameterType);
77 waitAndClickByLinkText(parameterType);
78 waitForPageToLoad();
79 Thread.sleep(2000);
80 switchToWindow("Kuali :: Inquiry");
81 Thread.sleep(2000);
82 assertEquals(parameterCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim().toLowerCase());
83 assertEquals(parameterType, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim().toLowerCase());
84 waitAndClickByXpath("//*[@title='close this window']");
85 switchToWindow("null");
86 System.out.println("--------------------------------Lookup And View Successful-------------------------");
87
88
89 selectFrame("iframeportlet");
90 waitAndClickByLinkText("edit");
91 waitForPageToLoad();
92 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
93 waitAndTypeByName("document.documentHeader.documentDescription", "Editing Test Parameter");
94 clearTextByName("document.newMaintainableObject.name");
95 parameterType = "testing " + ITUtil.DTS_TWO;
96 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
97 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
98 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
99 waitForPageToLoad();
100 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully");
101 selectTopFrame();
102 waitAndClickByXpath("//a[@title='Document Search']");
103 waitForPageToLoad();
104 selectFrame("iframeportlet");
105 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
106 Thread.sleep(2000);
107 assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a"));
108 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
109 selectTopFrame();
110 System.out.println("-----------------------------------Parameter Type Edited-------------------------");
111
112
113 super.gotoMenuLinkLocator();
114 waitAndTypeByName("name", parameterType);
115 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
116 isElementPresentByLinkText(parameterType);
117 waitAndClickByLinkText(parameterType);
118 waitForPageToLoad();
119 Thread.sleep(2000);
120 switchToWindow("Kuali :: Inquiry");
121 Thread.sleep(2000);
122 assertEquals(parameterCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim().toLowerCase());
123 assertEquals(parameterType, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim().toLowerCase());
124 waitAndClickByXpath("//*[@title='close this window']");
125 switchToWindow("null");
126
127
128
129 selectFrame("iframeportlet");
130 waitAndClickByLinkText("copy");
131 waitForPageToLoad();
132 docId = getTextByXpath("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
133 waitAndTypeByName("document.documentHeader.documentDescription", "Copying Test Parameter");
134 parameterCode = RandomStringUtils.randomAlphabetic(4).toLowerCase();
135 waitAndTypeByName("document.newMaintainableObject.code", parameterCode);
136 clearTextByName("document.newMaintainableObject.name");
137 parameterType = "testing " + ITUtil.DTS_TWO;
138 waitAndTypeByName("document.newMaintainableObject.name", parameterType);
139 waitAndClickByXpath("//input[@name='methodToCall.save' and @alt='save']");
140 waitAndClickByXpath("//input[@name='methodToCall.route' and @alt='submit']");
141 waitForPageToLoad();
142 assertElementPresentByXpath("//div[contains(div,'Document was successfully submitted.')]", "Document is not submitted successfully");
143 selectTopFrame();
144 waitAndClickByXpath("//a[@title='Document Search']");
145 waitForPageToLoad();
146 selectFrame("iframeportlet");
147 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
148 Thread.sleep(2000);
149 assertEquals(docId, getTextByXpath("//table[@id='row']/tbody/tr[1]/td[1]/a"));
150 assertEquals("FINAL", getTextByXpath("//table[@id='row']/tbody/tr[1]/td[4]"));
151 selectTopFrame();
152 System.out.println("-----------------------------------Parameter Type Edited-------------------------");
153
154
155 super.gotoMenuLinkLocator();
156 waitAndTypeByName("name", parameterType);
157 waitAndClickByXpath("//input[@name='methodToCall.search' and @value='search']");
158 isElementPresentByLinkText(parameterType);
159 waitAndClickByLinkText(parameterType);
160 waitForPageToLoad();
161 Thread.sleep(2000);
162 switchToWindow("Kuali :: Inquiry");
163 Thread.sleep(2000);
164 assertEquals(parameterCode, getTextByXpath("//div[@class='tab-container']/table//span[@id='code.div']").trim().toLowerCase());
165 assertEquals(parameterType, getTextByXpath("//div[@class='tab-container']/table//span[@id='name.div']").trim().toLowerCase());
166 waitAndClickByXpath("//*[@title='close this window']");
167 switchToWindow("null");
168 }
169
170
171 }