View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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 edu.sampleu.admin;
17  
18  import org.apache.commons.lang.RandomStringUtils;
19  
20  /**
21   * @author Kuali Rice Team (rice.collab@kuali.org)
22   */
23  public abstract class CampusAftBase extends AdminTmplMthdAftNavCreateNewBase {
24  
25      protected void createNewEnterDetails() throws InterruptedException {
26          waitAndTypeByName("document.documentHeader.documentDescription",RandomStringUtils.randomAlphabetic(30));
27          String randomAlphabetic = RandomStringUtils.randomAlphabetic(10);
28          waitAndTypeByName("document.newMaintainableObject.code",RandomStringUtils.randomAlphanumeric(2));
29          waitAndTypeByName("document.newMaintainableObject.name",randomAlphabetic);
30          waitAndTypeByName("document.newMaintainableObject.shortName",randomAlphabetic);
31          selectByName("document.newMaintainableObject.campusTypeCode","B - BOTH");
32      }
33  
34      /**document.documentHeader.documentDescription
35       * {@inheritDoc}
36       * Campus
37       * @return
38       */
39      @Override
40      protected String getLinkLocator() {
41          return "Campus";
42      }
43  
44      protected void saveAndClose() throws InterruptedException {
45          checkForDocError();
46          waitAndClickByXpath(SAVE_XPATH);
47          waitForTextPresent("Document was successfully saved");
48          waitAndClickByName("methodToCall.close");
49  //         waitAndClickByName("methodToCall.processAnswer.button1");
50      }
51  
52      protected void saveAndReload() throws InterruptedException {
53          checkForDocError();
54          waitAndClickByXpath(SAVE_XPATH);
55          waitForTextPresent("Document was successfully saved");
56          waitAndClickByName("methodToCall.reload");
57  //         waitAndClickByName("methodToCall.processAnswer.button1");
58      }
59  
60      protected void submitAndClose() throws InterruptedException {
61          checkForDocError();
62          waitAndClickByName("methodToCall.route");
63          waitForProgress("Submitting...");
64          waitForTextPresent("Document was successfully submitted");
65          waitAndClickByName("methodToCall.close");
66  //         waitAndClickByName("methodToCall.processAnswer.button1");
67      }
68  
69      /**
70       * submits the doc and asserts that it was successfully submitted
71       * does not close the document
72       *
73       * @throws InterruptedException
74       */
75      protected void submit() throws InterruptedException {
76          checkForDocError();
77          waitAndClickByName("methodToCall.route");
78          waitForTextPresent("Document was successfully submitted");
79      }
80  
81      /**
82       * recalls a document.
83       * closes the page when done.
84       *
85       * @param cancel if true, performs recall and cancel. if false, performs recall to action list
86       *
87       * @throws InterruptedException
88       */
89      protected void recall(boolean cancel) throws InterruptedException {
90          waitAndClickByName("methodToCall.recall");
91          waitForTextPresent("the reason below");
92          waitAndTypeByName("reason", "Oops!");
93          if (cancel){
94              // recall and cancel
95              waitAndClickByName("methodToCall.processAnswer.button1");
96              waitForTextPresent("RECALLED");
97              waitAndClickByName("methodToCall.close");
98          } else {
99              // recall to action list
100             waitAndClickByName("methodToCall.processAnswer.button0");
101             waitForTextPresent("SAVED");
102             waitAndClickByName("methodToCall.close");
103             waitAndClickByName("methodToCall.processAnswer.button1");
104         }
105     }
106 }