1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.mainmenu.test;
17
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertTrue;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.junit.After;
23 import org.junit.Before;
24 import org.junit.Test;
25
26 import com.thoughtworks.selenium.DefaultSelenium;
27 import com.thoughtworks.selenium.Selenium;
28
29
30
31
32
33
34 public class WorkFlowRouteRulesBlanketAppIT {
35 private Selenium selenium;
36 @Before
37 public void setUp() throws Exception {
38 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
39 selenium.start();
40 }
41
42 @Test
43 public void testUntitled() throws Exception {
44 String remotePublicUrl = System.getProperty("remote.public.url");
45
46 if (StringUtils.endsWith(remotePublicUrl, "/")) {
47 remotePublicUrl = StringUtils.removeEnd(remotePublicUrl, "/");
48 }
49 selenium.open(remotePublicUrl);
50 assertEquals("Login", selenium.getTitle());
51 selenium.type("__login_user", "admin");
52 selenium.click("//input[@value='Login']");
53 selenium.waitForPageToLoad("30000");
54 assertEquals("Kuali Portal Index", selenium.getTitle());
55 selenium.click("link=Routing Rules");
56 selenium.waitForPageToLoad("30000");
57 assertEquals("Kuali Portal Index", selenium.getTitle());
58 selenium.selectFrame("iframeportlet");
59 selenium.click("//img[@alt='create new']");
60 selenium.waitForPageToLoad("30000");
61 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.kew.doctype.bo.DocumentType!!).(((name:documentTypeName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
62 selenium.waitForPageToLoad("30000");
63 selenium.type("name", "RoutingRuleDocument");
64 selenium.click("//input[@name='methodToCall.search' and @value='search']");
65 selenium.waitForPageToLoad("30000");
66 selenium.click("link=return value");
67 selenium.waitForPageToLoad("30000");
68 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.kew.rule.bo.RuleTemplateBo!!).(((name:ruleTemplateName))).((``)).((<>)).(([])).((**)).((^^)).((&&)).((//)).((~~)).(::::;;::::).anchor");
69 selenium.waitForPageToLoad("30000");
70 selenium.type("name", "RuleRoutingTemplate");
71 selenium.click("//input[@name='methodToCall.search' and @value='search']");
72 selenium.waitForPageToLoad("30000");
73 selenium.click("link=return value");
74 selenium.waitForPageToLoad("30000");
75 selenium.click("methodToCall.createRule");
76 selenium.waitForPageToLoad("30000");
77 String docId = selenium.getText("//div[@id='headerarea']/div/table/tbody/tr[1]/td[1]");
78 assertTrue(selenium.isElementPresent("methodToCall.cancel"));
79 selenium.type("//input[@id='document.documentHeader.documentDescription']", "Test Routing Rule");
80 selenium.click("//input[@id='document.newMaintainableObject.forceAction']");
81 selenium.type("//textarea[@id='document.newMaintainableObject.description']", "Test Routing Rule1");
82 selenium.type("//input[@id='document.newMaintainableObject.fieldValues(1321:docTypeFullName)']", "DocumentTypeDocument");
83 selenium.click("methodToCall.performLookup.(!!org.kuali.rice.kim.impl.identity.PersonImpl!!).(((principalName:document.newMaintainableObject.add.personResponsibilities.principalName,))).((`document.newMaintainableObject.add.personResponsibilities.principalName:principalName,`)).((<>)).(([])).((**)).((^^)).((&&)).((/personImpl/)).((~~)).(::::;" + remotePublicUrl + "/kr/lookup.do;::::).anchor15");
84 selenium.waitForPageToLoad("30000");
85 selenium.click("//input[@name='methodToCall.search' and @value='search']");
86 selenium.waitForPageToLoad("30000");
87 selenium.click("link=return value");
88 selenium.waitForPageToLoad("30000");
89 selenium.select("//select[@id='document.newMaintainableObject.add.personResponsibilities.actionRequestedCd']", "label=ACKNOWLEDGE");
90 selenium.type("//input[@id='document.newMaintainableObject.add.personResponsibilities.priority']", "1");
91 selenium.click("methodToCall.addLine.personResponsibilities.(!!org.kuali.rice.kew.rule.PersonRuleResponsibility!!)");
92 selenium.waitForPageToLoad("30000");
93 selenium.click("methodToCall.blanketApprove");
94 selenium.waitForPageToLoad("30000");
95 selenium.selectWindow("null");
96 selenium.click("//img[@alt='doc search']");
97 selenium.waitForPageToLoad("30000");
98 assertEquals("Kuali Portal Index", selenium.getTitle());
99 selenium.selectFrame("iframeportlet");
100 selenium.click("//input[@name='methodToCall.search' and @value='search']");
101 selenium.waitForPageToLoad("30000");
102
103 docId= "link=" + docId;
104 assertTrue(selenium.isElementPresent(docId));
105 if(selenium.isElementPresent(docId)){
106 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
107 }else{
108 assertEquals(docId, selenium.getText("//table[@id='row']/tbody/tr[1]/td[1]"));
109 assertEquals("FINAL", selenium.getText("//table[@id='row']/tbody/tr[1]/td[4]"));
110 }
111 }
112
113 @After
114 public void tearDown() throws Exception {
115 selenium.stop();
116 }
117 }