001    /**
002     * Copyright 2005-2013 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     */
016    package edu.samplu.krad.demo.travel.account;
017    
018    import edu.samplu.common.SmokeTestBase;
019    import org.junit.Test;
020    
021    /**
022     * @author Kuali Rice Team (rice.collab@kuali.org)
023     */
024    public class DemoTravelAccountLookUpSmokeTest extends SmokeTestBase {
025    
026        /**
027         * /kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount&hideReturnLink=true&showMaintenanceLinks=true
028         */
029        public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount&hideReturnLink=true&showMaintenanceLinks=true";
030        
031        /**
032         * Search
033         */
034        public static final String SEARCH = "Search";
035        
036        /**
037         * Clear Values
038         */
039        public static final String CLEAR_VALUES = "Clear Values";
040        
041        @Override
042        public String getBookmarkUrl() {
043            return BOOKMARK_URL;
044        }
045    
046        @Override
047        protected void navigate() throws Exception {
048            waitAndClickById("Demo-DemoLink", "");
049            waitAndClickByLinkText("Account Lookup");
050        }
051    
052        protected void testTravelAccountLookUp() throws Exception {
053            waitAndTypeByName("lookupCriteria[number]","a1");
054            waitAndClickButtonByText(SEARCH);
055            waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
056            waitAndClickButtonByText(CLEAR_VALUES);
057            Thread.sleep(3000);
058            waitAndClickButtonByText(SEARCH);
059            Thread.sleep(3000);
060            assertElementPresentByXpath("//a[contains(text(), 'a1')]");
061            assertElementPresentByXpath("//a[contains(text(), 'a2')]");
062        }
063    
064        @Test
065        public void testTravelAccountLookUpBookmark() throws Exception {
066            testTravelAccountLookUp();
067            passed();
068        }
069    
070        @Test
071        public void testTravelAccountLookUpNav() throws Exception {
072            testTravelAccountLookUp();
073            passed();
074        }
075    }