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 ResponsibilityAftBase extends AdminTmplMthdAftNavCreateNewBase {
024
025    protected void createNewEnterDetails() throws InterruptedException {
026        waitAndTypeByName("document.documentHeader.documentDescription",RandomStringUtils.randomAlphabetic(30));
027        String randomAlphabetic = RandomStringUtils.randomAlphabetic(10);
028        selectByName("document.newMaintainableObject.namespaceCode","KR-BUS - Service Bus");
029        waitAndTypeByName("document.newMaintainableObject.name",randomAlphabetic);
030        waitAndTypeByName("document.newMaintainableObject.documentTypeName","RoutingRuleDocument");
031        waitAndTypeByName("document.newMaintainableObject.routeNodeName",randomAlphabetic);
032        waitAndClickByName("document.newMaintainableObject.actionDetailsAtRoleMemberLevel");
033        waitAndClickByName("document.newMaintainableObject.required");
034    }
035
036    /**document.documentHeader.documentDescription
037     * {@inheritDoc}
038     * Responsibility
039     * @return
040     */
041    @Override
042    protected String getLinkLocator() {
043        return "Responsibility";
044    }
045
046    protected void saveAndClose() throws InterruptedException {
047        checkForDocError();
048        waitAndClickByXpath(SAVE_XPATH);
049        waitForTextPresent("Document was successfully saved");
050        waitAndClickByName("methodToCall.close");
051//         waitAndClickByName("methodToCall.processAnswer.button1");
052    }
053
054    protected void saveAndReload() throws InterruptedException {
055        checkForDocError();
056        waitAndClickByXpath(SAVE_XPATH);
057        waitForTextPresent("Document was successfully saved");
058        waitAndClickByName("methodToCall.reload");
059//         waitAndClickByName("methodToCall.processAnswer.button1");
060    }
061
062    protected void submitAndClose() throws InterruptedException {
063        checkForDocError();
064        waitAndClickByName("methodToCall.route");
065        waitForTextPresent("Document was successfully submitted");
066        waitAndClickByName("methodToCall.close");
067//         waitAndClickByName("methodToCall.processAnswer.button1");
068    }
069
070    /**
071     * submits the doc and asserts that it was successfully submitted
072     * does not close the document
073     *
074     * @throws InterruptedException
075     */
076    protected void submit() throws InterruptedException {
077        checkForDocError();
078        waitAndClickByName("methodToCall.route");
079        waitForTextPresent("Document was successfully submitted");
080    }
081}