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 edu.sampleu.main;
017
018import edu.sampleu.common.NavTemplateMethodAftBase;
019import org.kuali.rice.testtools.common.JiraAwareFailable;
020import org.openqa.selenium.By;
021
022/**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public abstract class MainTmplMthdSTNavBase extends NavTemplateMethodAftBase {
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(JiraAwareFailable 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("https://jira.kuali.org/browse/KULRICE-9709 Search Edit Back does not show search results in Firefox");
049        }
050    }
051
052    protected void testSearchSearchBack(JiraAwareFailable 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        acceptAlertIfPresent();
061        waitForElementsPresentByClassName(DATA_TABLES_INFO, "Going back from Search to Search results not available");
062        assertTextPresent("https://jira.kuali.org/browse/KULRICE-9710 Search Search back does not display first search results in Firefox", pageBannerText);
063    }
064}