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 org.kuali.rice.krad.labs;
017
018import org.apache.commons.lang3.RandomStringUtils;
019import org.junit.Test;
020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021import org.kuali.rice.testtools.selenium.WebDriverUtils;
022
023/**
024 * @author Kuali Rice Team (rice.collab@kuali.org)
025 */
026public class LabsDefaultRuleEventAndBusinessRuleAft extends WebDriverLegacyITBase {
027
028    /**
029     * /kr-krad/defaultRuleEvent?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount
030     */
031    public static final String BOOKMARK_URL = "/kr-krad/defaultRuleEvent?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount";
032
033    @Override
034    protected String getBookmarkUrl() {
035        return BOOKMARK_URL;
036    }
037
038    @Override
039    protected void navigate() throws Exception {
040        waitAndClickByLinkText("Default Rule Event and Business Rule");
041    }
042
043    protected void testDefaultRuleEventAndBusinessRule() throws InterruptedException {
044         waitAndTypeByName("document.documentHeader.documentDescription","Travel Account Maintenance New Test Document");
045         String randomCode = RandomStringUtils.randomAlphabetic(9).toUpperCase();
046         waitAndTypeByName("document.newMaintainableObject.dataObject.number",randomCode);
047         waitAndTypeByName("document.newMaintainableObject.dataObject.name","Test Account Name");
048         waitAndClickByName("document.newMaintainableObject.dataObject.accountTypeCode");
049
050         saveSuccessfully();
051
052         waitAndClickSubmitByText();
053         waitAndClickConfirmSubmitOk();
054         failOnErrorMessageItem();
055         waitForTextPresent("Document was successfully submitted.", WebDriverUtils.configuredImplicityWait() * 2);
056    }
057
058    @Test
059    public void testDefaultRuleEventAndBusinessRuleBookmark() throws Exception {
060        testDefaultRuleEventAndBusinessRule();
061        passed();
062    }
063
064    @Test
065    public void testDefaultRuleEventAndBusinessRuleNav() throws Exception {
066        testDefaultRuleEventAndBusinessRule();
067        passed();
068    }
069    
070    @Test
071    public void testDemoCustomRuleEventAndDocumentEventMethodInvocationAccountTypeCheckBookmark() throws Exception {
072        testDemoCustomRuleEventAndDocumentEventMethodInvocationAccountTypeChec();
073        passed();
074    }
075
076    @Test
077    public void testDemoCustomRuleEventAndDocumentEventMethodInvocationAccountTypeChecNav() throws Exception {
078        testDemoCustomRuleEventAndDocumentEventMethodInvocationAccountTypeChec();
079        passed();
080    }
081}