001/**
002 * Copyright 2005-2016 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 GroupAftBase extends AdminTmplMthdAftNavCreateNewBase {
024
025    protected void createNewEnterDetails() throws InterruptedException {
026        waitAndTypeByName("document.documentHeader.documentDescription", RandomStringUtils.randomAlphanumeric(9));
027        selectByName("document.groupNamespace","KR-BUS - Service Bus");
028        waitAndTypeByName("document.groupName",RandomStringUtils.randomAlphanumeric(9));
029    }
030
031    /**document.documentHeader.documentDescription
032     * {@inheritDoc}
033     * Component
034     * @return
035     */
036    @Override
037    protected String getLinkLocator() {
038        return "Group";
039    }
040
041    protected void saveAndClose() throws InterruptedException {
042        checkForDocError();
043        waitAndClickByXpath(SAVE_XPATH);
044        waitForTextPresent("Document was successfully saved");
045        waitAndClickByName("methodToCall.close");
046//         waitAndClickByName("methodToCall.processAnswer.button1");
047    }
048
049    protected void saveAndReload() throws InterruptedException {
050        checkForDocError();
051        waitAndClickByXpath(SAVE_XPATH);
052        waitForTextPresent("Document was successfully saved");
053        waitAndClickByName("methodToCall.reload");
054//         waitAndClickByName("methodToCall.processAnswer.button1");
055    }
056
057    protected void submitAndClose() throws InterruptedException {
058        checkForDocError();
059        waitAndClickByName("methodToCall.route");
060        waitForTextPresent("Document was successfully submitted");
061        waitAndClickByName("methodToCall.close");
062//         waitAndClickByName("methodToCall.processAnswer.button1");
063    }
064
065    /**
066     * submits the doc and asserts that it was successfully submitted
067     * does not close the document
068     *
069     * @throws InterruptedException
070     */
071    protected void submit() throws InterruptedException {
072        checkForDocError();
073        waitAndClickByName("methodToCall.route");
074        waitForTextPresent("Document was successfully submitted");
075    }
076}