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 edu.sampleu.krad.compview;
017
018import org.apache.commons.logging.Log;
019import org.apache.commons.logging.LogFactory;
020import org.junit.Test;
021import org.kuali.rice.krad.uif.UifConstants;
022import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
023import org.kuali.rice.testtools.selenium.WebDriverUtils;
024
025import java.util.HashMap;
026import java.util.Map;
027
028import static org.junit.Assert.*;
029
030/**
031 *  Tests that the data attributes are rendered as expected for all controls
032 * 
033 * @author Kuali Rice Team (rice.collab@kuali.org)
034 */
035public class UifDataAttributesNavAft extends WebDriverLegacyITBase {
036
037    public static String BOOKMARK_URL = WebDriverUtils.getBaseUrlString()+ "/kr-krad/data-attributes-test-uif-controller?viewId=dataAttributesView_selenium&methodToCall=start";
038
039    @Override
040    protected String getBookmarkUrl() {
041        return BOOKMARK_URL;
042    }
043
044    /**
045     * Tests that the data attributes are rendered as expected for all controls
046     */
047    @Test
048    public void testDataAttributesPresentInControlsNav() throws Exception{
049        open(getBookmarkUrl());
050        waitAndTypeByName("field2","");
051        fireMouseOverEventByName("field1");
052        waitForTextPresent("Required");
053        waitAndTypeByName("field1","");
054        fireMouseOverEventByName("field2");
055        waitForTextPresent("Required");
056        selectByName("field88","Vegetables");
057        waitForElementPresentByXpath("//div[@id='ui-datepicker-div' and @style='position: absolute; top: 348.1875px; width: 34em; left: 31px; z-index: 1; display: none;']");
058        waitAndClickByName("field3");
059        waitForElementPresentByXpath("//div[@id='ui-datepicker-div' and @style='position: absolute; top: 348.1875px; width: 34em; left: 31px; z-index: 1; display: block;']");
060        waitForElementPresentByXpath("//input[@type='checkbox' and @name='bField1' and @checked='checked']");
061        waitAndClickByXpath("//input[@type='radio' and @name='field5' and @value='1']");
062        waitForElementPresentByXpath("//input[@type='file' and @name='fileUpload']");
063        waitAndTypeByName("testPerson.principalName","fred");
064        waitAndTypeByName("field2","");
065        waitForTextPresent("fred, fred");
066        waitAndTypeByName("testPerson.principalName","deep");
067        waitAndTypeByName("field2","");
068        waitForTextPresent("user control not found");
069        waitForElementPresentByXpath("//a[@class='ui-spinner-button ui-spinner-up ui-corner-tr']");
070        waitForElementPresentByXpath("//a[@class='ui-spinner-button ui-spinner-down ui-corner-br']");
071        waitForElementPresentByXpath("//h4/span[contains(text(),'Image Caption Text')]");
072        waitForElementPresentByXpath("//a[@id='actionLink-noImage_attrs']");
073        waitForElementPresentByXpath("//a[@id='actionLink-imageRight_attrs']/img");
074        waitForElementPresentByXpath("//a[@id='actionLink-imageLeft_attrs']/img");
075        waitForElementPresentByXpath("//input[@type='image' and @id='imageAction_attrs']");
076        waitForElementPresentByXpath("//button[@id='buttonImageBottom_attrs']/span/img");
077        waitForElementPresentByXpath("//button[@id='buttonImageLeft_attrs']/img");
078        waitForElementPresentByXpath("//button[@id='buttonImageRight_attrs']/img");
079        waitForElementPresentByXpath("//button[@id='buttonImageTop_attrs']/span/img");
080        waitForElementPresentByXpath("//a[@href='http://www.kuali.org' and contains(text(),'Kuali Website')]");
081        waitForElementPresentByXpath("//iframe[@id='iframe_attrs']");
082    }
083}