1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.main;
17
18 import org.apache.commons.lang.RandomStringUtils;
19 import org.codehaus.plexus.util.StringUtils;
20 import org.junit.Test;
21 import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
22 import org.kuali.rice.testtools.selenium.WebDriverUtils;
23
24
25
26
27 public class TermMaintenanceEditCopyAft extends MainTmplMthdSTNavBase {
28
29
30
31
32
33
34 public static final String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Term%20Lookup&channelUrl=" + WebDriverUtils.getBaseUrlString()
35 + "/kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krms.impl.repository.TermBo&returnLocation="
36 + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
37
38 @Override
39 protected String getBookmarkUrl() {
40 return BOOKMARK_URL;
41 }
42
43
44
45
46
47
48 @Override
49 protected String getLinkLocator() {
50 return "Term Lookup";
51 }
52
53 protected void testCopyEditExistingTermWithParameter() throws InterruptedException {
54
55 copyExistingTermWithParameter();
56
57
58 selectTopFrame();
59 waitAndClickByLinkText("Main Menu", "");
60 waitAndClickByLinkText("Term Lookup", "");
61 selectFrameIframePortlet();
62 waitAndTypeByName("lookupCriteria[id]", "1*");
63 waitAndClickByXpath("//button[contains(text(),'Search')]");
64 waitAndClickEdit();
65
66 waitForTextPresent("campusSize");
67 waitForTextPresent("java.lang.Integer");
68 waitForElementPresentByXpath("//label[contains(text(),'Specification Description')]/span[contains(text(),'Size in # of students of the campus')]");
69 clearTextByName("document.newMaintainableObject.dataObject.description");
70 String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
71 waitAndTypeByName("document.newMaintainableObject.dataObject.description", "Edit Term - New ID "
72 + StringUtils.substring(randomCode, 0, 4));
73 clearTextByName("document.newMaintainableObject.dataObject.parametersMap[Campus Code]");
74 waitAndTypeByName("document.newMaintainableObject.dataObject.parametersMap[Campus Code]",randomCode);
75 submitSuccessfully();
76 waitForTextPresent(randomCode);
77 }
78
79 protected void copyExistingTermWithParameter() throws InterruptedException {
80 selectFrameIframePortlet();
81 waitAndTypeByName("lookupCriteria[id]", "T1000");
82 waitAndClickByXpath("//button[contains(text(),'Search')]");
83 waitAndClickCopy();
84 waitForTextPresent("BL");
85 String newRandomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
86 clearTextByName("document.newMaintainableObject.dataObject.description");
87 waitAndTypeByName("document.newMaintainableObject.dataObject.description", "Copy Term - Short ID "
88 + StringUtils.substring(newRandomCode, 0, 4));
89 clearTextByName("document.newMaintainableObject.dataObject.parametersMap[Campus Code]");
90 waitAndTypeByName("document.newMaintainableObject.dataObject.parametersMap[Campus Code]", newRandomCode);
91 submitSuccessfully();
92 waitForTextPresent(newRandomCode);
93 }
94
95 @Test
96 public void testCopyEditExistingTermWithParameterBookmark() throws Exception {
97 testCopyEditExistingTermWithParameter();
98 passed();
99 }
100
101 @Test
102 public void testCopyEditExistingTermWithParameterNav() throws Exception {
103 testCopyEditExistingTermWithParameter();
104 passed();
105 }
106 }