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