001/**
002 * Copyright 2005-2016 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 org.kuali.rice.krad.demo.uif.library.general;
017
018import org.junit.Test;
019import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
020import org.openqa.selenium.By;
021
022/**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class LibraryGeneralFeaturesFocusAndJumpToAft extends WebDriverLegacyITBase {
026
027    /**
028     * /kr-krad/kradsampleapp?viewId=Demo-FocusNJumpToView
029     */
030    public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-FocusNJumpToView";
031    
032    @Override
033    protected String getBookmarkUrl() {
034        return BOOKMARK_URL;
035    }
036
037    @Override
038    protected void navigate() throws Exception {
039        waitAndClickLibraryLink();
040        waitAndClickByLinkText("General Features");
041        waitAndClickByLinkText("Focus And JumpTo");
042    }
043
044    protected void testGeneralFeaturesFocusAndJumpTo() throws Exception {
045        waitAndClickButtonByExactText("Refresh Group");
046       // waitForTextPresent("Loading...");    Sometimes load too fast
047        waitAndClickButtonByExactText("Save");
048        waitForTextPresent("Loading...");
049        waitAndClickButtonByExactText("Refresh Field but with Server Errors");
050        // waitForTextPresent("Loading...");  Sometimes load too fast
051        waitForElementPresentByXpath("//div[@id='input4' and @class='uif-inputField uif-boxLayoutVerticalItem pull-left clearfix uif-hasError']/input");
052        waitAndClickButtonByExactText("Refresh Page");
053        waitForTextPresent("Loading...");
054        checkForIncidentReport();
055    }
056    
057    protected void testGeneralFeaturesFocusAndJumpToFocusAndCollections() throws Exception {
058        waitAndSelectByName("exampleShown","Focus and Collections");
059        waitAndClickButtonByExactText("Add");
060        waitForTextPresent("Adding Line...");
061    }
062    
063    protected void testGeneralFeaturesFocusAndJumpToAndJumpToIdAfterSubmit() throws Exception {
064        selectByName("exampleShown","JumpTo and JumpToIdAfterSubmit");
065        waitAndClickButtonByExactText("Jump to Field 20");
066        waitAndClickButtonByExactText("Jump to Top");
067        waitAndClickButtonByExactText("Jump to Bottom");
068        checkForIncidentReport();
069    }
070
071    @Test
072    public void testGeneralFeaturesFocusAndJumpToBookmark() throws Exception {
073        testGeneralFeaturesFocusAndJumpTo();
074        passed();
075    }
076
077    @Test
078    public void testGeneralFeaturesFocusAndJumpToFocusAndCollectionsBookmark() throws Exception {
079        testGeneralFeaturesFocusAndJumpToFocusAndCollections();
080        passed();
081    }
082
083    @Test
084    public void testGeneralFeaturesFocusAndJumpToAndJumpToIdAfterSubmitBookmark() throws Exception {
085        testGeneralFeaturesFocusAndJumpToAndJumpToIdAfterSubmit();
086        passed();
087    }
088
089    @Test
090    public void testGeneralFeaturesFocusAndJumpToNav() throws Exception {
091        testGeneralFeaturesFocusAndJumpTo();
092        passed();
093    }
094
095    @Test
096    public void testGeneralFeaturesFocusAndJumpToFocusAndCollectionsNav() throws Exception {
097        testGeneralFeaturesFocusAndJumpToFocusAndCollections();
098        passed();
099    }
100
101    @Test
102    public void testGeneralFeaturesFocusAndJumpToAndJumpToIdAfterSubmitNav() throws Exception {
103        testGeneralFeaturesFocusAndJumpToAndJumpToIdAfterSubmit();
104        passed();
105    }
106}