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.lookupviews.lookup;
017    
018    import edu.samplu.common.Failable;
019    import edu.samplu.common.SmokeTestBase;
020    
021    /**
022     * @author Kuali Rice Team (rice.collab@kuali.org)
023     */
024    public class DemoLookUpAbstractSmokeTestBase extends SmokeTestBase {
025    
026        /**
027         * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleView&hideReturnLink=true
028         */
029        public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleView&hideReturnLink=true";
030    
031        /**
032         *  lookupCriteria[number]
033         */
034        private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
035        
036        /**
037         *  Search
038         */
039        private static final String SEARCH="Search";
040        
041        /**
042         * Clear Values
043         */
044        private static final String CLEAR_VALUES="Clear Values";
045        
046        @Override
047        public String getBookmarkUrl() {
048            return BOOKMARK_URL;
049        }
050    
051        @Override
052        protected void navigate() throws Exception {
053            waitAndClickById("Demo-DemoLink", "");
054            waitAndClickByLinkText("Lookup");
055        }
056    
057        protected void testLookUp() throws InterruptedException {
058            waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a1");
059            waitAndClickButtonByText(SEARCH);
060            Thread.sleep(3000);
061            assertElementPresentByXpath("//a[contains(text(), 'a1')]");
062            waitAndClickButtonByText(CLEAR_VALUES);
063            waitAndClickButtonByText(SEARCH);
064            Thread.sleep(3000);
065            assertElementPresentByXpath("//a[contains(text(), 'a1')]");
066            assertElementPresentByXpath("//a[contains(text(), 'a2')]");
067        }
068    
069        public void testLookUpBookmark(Failable failable) throws Exception {
070            testLookUp();
071            passed();
072        }
073    
074        public void testLookUpNav(Failable failable) throws Exception {
075            testLookUp();
076            passed();
077        }
078    }