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.uif.library;
017    
018    import org.junit.Test;
019    import org.openqa.selenium.By;
020    import org.openqa.selenium.WebElement;
021    
022    /**
023     * @author Kuali Rice Team (rice.collab@kuali.org)
024     */
025    public class DemoLibraryWidgetsHelpSmokeTest extends DemoLibraryBase {
026    
027        /**
028         * /kr-krad/kradsampleapp?viewId=Demo-Help-View&methodToCall=start
029         */
030        public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-Help-View&methodToCall=start";
031    
032        @Override
033        protected String getBookmarkUrl() {
034            return BOOKMARK_URL;
035        }
036    
037        @Override
038        protected void navigate() throws Exception {
039            navigateToLibraryDemo("Widgets", "Help");
040        }
041    
042        protected void testWidgetsTooltipHelp() throws Exception {
043    
044            fireMouseOverEvent(By.id("Demo-Help-Field1_label"));
045            WebElement helpExample1 = driver.findElement(By.xpath("//div[@data-for=\"Demo-Help-Field1_label\"]"))
046                    .findElement(By.className("jquerybubblepopup-innerHtml"));
047            if (!helpExample1.isDisplayed()) {
048                fail("Example 1 help not displayed.");
049            }
050            if (!helpExample1.getText().equals("Sample text for field help - label left")) {
051                fail("Incorrect inner html text.");
052            }
053        }
054    
055        @Test
056        public void testWidgetsHelpBookmark() throws Exception {
057            testWidgetsTooltipHelp();
058    
059            driver.close();
060            passed();
061        }
062    
063        @Test
064        public void testWidgetsHelpNav() throws Exception {
065            testWidgetsTooltipHelp();
066    
067            driver.close();
068            passed();
069        }
070    }