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.mainmenu.test;
017    
018    import edu.samplu.common.Failable;
019    import edu.samplu.common.NavTemplateMethodSTBase;
020    import org.openqa.selenium.By;
021    
022    /**
023     * @author Kuali Rice Team (rice.collab@kuali.org)
024     */
025    public abstract class MainTmplMthdSTNavBase extends NavTemplateMethodSTBase {
026    
027        public static final String DATA_TABLES_INFO = "dataTables_info";
028    
029        @Override
030        protected String getCreateNewLinkLocator() {
031            return "Create New";
032        }
033    
034        @Override
035        protected String getMenuLinkLocator() {
036            return "Main Menu";
037        }
038    
039        protected void testSearchEditBack(Failable failable) throws Exception {
040            waitAndClickSearch3();
041            waitForElementPresentByClassName(DATA_TABLES_INFO);
042            String pageBannerText = getText(By.className(DATA_TABLES_INFO));
043            waitAndClickEdit();
044            waitForElementPresentByClassName("uif-headerText-span");
045            back();
046            waitForElementPresentByClassName(DATA_TABLES_INFO);
047            if (!pageBannerText.equals(getText(By.className(DATA_TABLES_INFO)))) {
048                failable.fail("Going back from Search to Edit results not available");
049            }
050        }
051    
052        protected void testSearchSearchBack(Failable failable, String fieldName, String searchText) throws Exception {
053            waitAndClickSearch3();
054            waitForElementPresentByClassName(DATA_TABLES_INFO);
055            String pageBannerText = getText(By.className(DATA_TABLES_INFO));
056            waitAndTypeByName(fieldName, searchText);
057            waitAndClickSearch3();
058            waitForElementPresentByClassName(DATA_TABLES_INFO, "Problem with second search");
059            back();
060            waitForElementsPresentByClassName(DATA_TABLES_INFO, "Going back from Search to Search results not available");
061            assertTextPresent("Going back from Search to Search results not available", pageBannerText);
062        }
063    }