01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.rice.transactiondocument;
17:
18: import org.junit.Test;
19: import org.kuali.rice.TestBase;
20: import org.kuali.rice.testharness.HtmlUnitUtil;
21:
22: import com.gargoylesoftware.htmlunit.html.HtmlForm;
23: import com.gargoylesoftware.htmlunit.html.HtmlInput;
24: import com.gargoylesoftware.htmlunit.html.HtmlPage;
25: import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
26:
27: public class BaseTransactionDocumentTest extends TestBase {
28:
29: @Test
30: public void testTransactionDocumentRoute() throws Exception {
31: HtmlPage transDocPage = HtmlUnitUtil
32: .gotoPageAndLogin(HtmlUnitUtil.BASE_URL
33: + "/travelDocument2.do?methodToCall=docHandler&command=initiate&docTypeName=TravelRequest");
34: HtmlForm form = transDocPage.getFormByName("KualiForm");
35: form.getInputByName(
36: "document.documentHeader.financialDocumentDescription")
37: .setValueAttribute("description");
38: ((HtmlTextArea) form.getTextAreasByName(
39: "document.documentHeader.explanation").get(0))
40: .setText("justification");
41: form.getInputByName("document.traveler").setValueAttribute(
42: "traveler");
43: form.getInputByName("document.origin").setValueAttribute(
44: "origin");
45: form.getInputByName("document.destination").setValueAttribute(
46: "destination");
47: form.getSelectByName("document.requestType")
48: .setSelectedAttribute("TRT1", true);
49: form.getInputByName("travelAccount.number").setValueAttribute(
50: "a1");
51: transDocPage = (HtmlPage) ((HtmlInput) form
52: .getInputByName("methodToCall.insertAccount")).click();
53: HtmlPage resultsPage = (HtmlPage) ((HtmlInput) transDocPage
54: .getFormByName("KualiForm").getInputByName(
55: "methodToCall.route")).click();
56:
57: assertTrue("Document was not successfully Routed", HtmlUnitUtil
58: .pageContainsText(resultsPage,
59: "Document was successfully submitted"));
60:
61: }
62:
63: }
|