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