001/** 002 * Copyright 2005-2015 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.sampleu.admin; 017 018import org.apache.commons.lang.RandomStringUtils; 019 020/** 021 * @author Kuali Rice Team (rice.collab@kuali.org) 022 */ 023public abstract class CampusAftBase extends AdminTmplMthdAftNavCreateNewBase { 024 025 protected void createNewEnterDetails() throws InterruptedException { 026 waitAndTypeByName("document.documentHeader.documentDescription",RandomStringUtils.randomAlphabetic(30)); 027 String randomAlphabetic = RandomStringUtils.randomAlphabetic(10); 028 waitAndTypeByName("document.newMaintainableObject.code",RandomStringUtils.randomAlphanumeric(2)); 029 waitAndTypeByName("document.newMaintainableObject.name",randomAlphabetic); 030 waitAndTypeByName("document.newMaintainableObject.shortName",randomAlphabetic); 031 selectByName("document.newMaintainableObject.campusTypeCode","B - BOTH"); 032 } 033 034 /**document.documentHeader.documentDescription 035 * {@inheritDoc} 036 * Campus 037 * @return 038 */ 039 @Override 040 protected String getLinkLocator() { 041 return "Campus"; 042 } 043 044 protected void saveAndClose() throws InterruptedException { 045 checkForDocError(); 046 waitAndClickByXpath(SAVE_XPATH); 047 waitForTextPresent("Document was successfully saved"); 048 waitAndClickByName("methodToCall.close"); 049// waitAndClickByName("methodToCall.processAnswer.button1"); 050 } 051 052 protected void saveAndReload() throws InterruptedException { 053 checkForDocError(); 054 waitAndClickByXpath(SAVE_XPATH); 055 waitForTextPresent("Document was successfully saved"); 056 waitAndClickByName("methodToCall.reload"); 057// waitAndClickByName("methodToCall.processAnswer.button1"); 058 } 059 060 protected void submitAndClose() throws InterruptedException { 061 checkForDocError(); 062 waitAndClickByName("methodToCall.route"); 063 waitForProgress("Submitting..."); 064 waitForTextPresent("Document was successfully submitted"); 065 waitAndClickByName("methodToCall.close"); 066// waitAndClickByName("methodToCall.processAnswer.button1"); 067 } 068 069 /** 070 * submits the doc and asserts that it was successfully submitted 071 * does not close the document 072 * 073 * @throws InterruptedException 074 */ 075 protected void submit() throws InterruptedException { 076 checkForDocError(); 077 waitAndClickByName("methodToCall.route"); 078 waitForTextPresent("Document was successfully submitted"); 079 } 080 081 /** 082 * recalls a document. 083 * closes the page when done. 084 * 085 * @param cancel if true, performs recall and cancel. if false, performs recall to action list 086 * 087 * @throws InterruptedException 088 */ 089 protected void recall(boolean cancel) throws InterruptedException { 090 waitAndClickByName("methodToCall.recall"); 091 waitForTextPresent("the reason below"); 092 waitAndTypeByName("reason", "Oops!"); 093 if (cancel){ 094 // recall and cancel 095 waitAndClickByName("methodToCall.processAnswer.button1"); 096 waitForTextPresent("RECALLED"); 097 waitAndClickByName("methodToCall.close"); 098 } else { 099 // recall to action list 100 waitAndClickByName("methodToCall.processAnswer.button0"); 101 waitForTextPresent("SAVED"); 102 waitAndClickByName("methodToCall.close"); 103 waitAndClickByName("methodToCall.processAnswer.button1"); 104 } 105 } 106}