001/**
002 * Copyright 2005-2014 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.admin;
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 AdminTmplMthdAftNavBase extends NavTemplateMethodAftBase {
026
027    public static final String CREATE_NEW_LOCATOR = "//img[contains(@alt,'create new')]";
028//    public static final String CREATE_NEW_LOCATOR = "//a[contains(@href,'command=initiate')]"; // not with IE8
029//    public static final String CREATE_NEW_LOCATOR = "//a[@title='Create a new record']"; // not with IE8
030    public static final String ADMIN_LOCATOR = "Administration";
031    public static final String SPAN_CLASS_PAGEBANNER = "//span[@class='pagebanner']";
032
033    @Override
034    protected String getCreateNewLinkLocator() {
035        return CREATE_NEW_LOCATOR;
036    }
037
038    @Override
039    protected String getMenuLinkLocator() {
040        return ADMIN_LOCATOR;
041    }
042
043    /**
044     * tests that a getLinkLocator maintenance document can be cancelled
045     */
046    public void testCreateNewCancelNav() throws Exception {
047        gotoCreateNew();
048        testCancelConfirmation();
049    }
050
051    /**
052     * tests that a getLinkLocator maintenance document is created for an edit operation originating from a lookup screen
053     */
054    public void testEditCancel() throws Exception {
055        testSearchEditCancel();
056    }
057
058    public void testSearchEditBack(JiraAwareFailable failable) throws Exception {
059        waitAndClickSearch2();
060        waitAndClickByLinkText("edit");
061        waitFor(By.name(BLANKET_APPROVE_NAME));
062        back();
063        waitForTextPresent(getTextByXpath(SPAN_CLASS_PAGEBANNER));
064    }
065
066    public void testSearchSearchBack(JiraAwareFailable failable, String fieldName, String searchText) throws Exception {
067        waitAndClickSearch2();
068        waitAndTypeByName(fieldName, searchText);
069        waitAndClickSearch2();
070        back();
071        waitForTextPresent(getTextByXpath(SPAN_CLASS_PAGEBANNER));
072    }
073}