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