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.lookup.autosearch;
017    
018    import edu.samplu.common.Failable;
019    import edu.samplu.common.ITUtil;
020    import edu.samplu.common.WebDriverLegacyITBase;
021    
022    /**
023     * @author Kuali Rice Team (rice.collab@kuali.org)
024     */
025    public abstract class DemoTravelAccountLookUpAutoSearchAbstractSmokeTestBase extends WebDriverLegacyITBase {
026    
027        /**
028         * /kr-krad/lookup?methodToCall=search&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount&lookupCriteria['number']=a*&readOnlyFields=number&hideReturnLink=true&showMaintenanceLinks=true
029         */
030        public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=search&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount&lookupCriteria['number']=a*&readOnlyFields=number&hideReturnLink=true&showMaintenanceLinks=true";
031        
032        /**
033         * Search
034         */
035        public static final String SEARCH = "Search";
036        
037        /**
038         * Clear Values
039         */
040        public static final String CLEAR_VALUES = "Clear Values";
041        
042        @Override
043        public String getTestUrl() {
044            return ITUtil.KRAD_PORTAL;
045        }
046    
047        protected void navigation() throws Exception {
048            waitAndClickById("Demo-DemoLink", "");
049            waitAndClickByLinkText("Account Lookup Auto Search");
050        }
051    
052        protected void testDemoTravelAccountLookUpAutoSearch() throws Exception {
053            assertElementPresentByXpath("//a[contains(text(), 'a1')]");
054            assertElementPresentByXpath("//a[contains(text(), 'a2')]");
055            assertElementPresentByXpath("//a[contains(text(), 'a3')]");
056            waitAndTypeByName("lookupCriteria[foId]","1");
057            waitAndClickButtonByText(SEARCH);
058            Thread.sleep(3000);
059            assertElementPresentByXpath("//a[contains(text(), 'a1')]");
060            if(isElementPresentByLinkText("a2") || isElementPresentByLinkText("a3"))
061            {
062                fail("Search Functionality not working properly.");
063            }
064        }
065    
066        public void testDemoTravelAccountLookUpAutoSearchBookmark(Failable failable) throws Exception {
067            testDemoTravelAccountLookUpAutoSearch();
068            passed();
069        }
070    
071        public void testDemoTravelAccountLookUpAutoSearchNav(Failable failable) throws Exception {
072            navigation();
073            testDemoTravelAccountLookUpAutoSearch();
074            passed();
075        }
076    }