View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.krad.compview;
17  
18  import org.apache.commons.logging.Log;
19  import org.apache.commons.logging.LogFactory;
20  import org.junit.Test;
21  import org.kuali.rice.krad.uif.UifConstants;
22  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
23  import org.kuali.rice.testtools.selenium.WebDriverUtils;
24  
25  import java.util.HashMap;
26  import java.util.Map;
27  
28  import static org.junit.Assert.*;
29  
30  /**
31   *  Tests that the data attributes are rendered as expected for all controls
32   * 
33   * @author Kuali Rice Team (rice.collab@kuali.org)
34   */
35  public class UifDataAttributesNavAft extends WebDriverLegacyITBase {
36  
37      public static String BOOKMARK_URL = WebDriverUtils.getBaseUrlString()+ "/kr-krad/data-attributes-test-uif-controller?viewId=dataAttributesView_selenium&methodToCall=start";
38  
39      @Override
40      protected String getBookmarkUrl() {
41          return BOOKMARK_URL;
42      }
43  
44      /**
45       * Tests that the data attributes are rendered as expected for all controls
46       */
47      @Test
48      public void testDataAttributesPresentInControlsNav() throws Exception{
49      	open(getBookmarkUrl());
50      	waitAndTypeByName("field2","");
51      	fireMouseOverEventByName("field1");
52      	waitForTextPresent("Required");
53      	waitAndTypeByName("field1","");
54      	fireMouseOverEventByName("field2");
55      	waitForTextPresent("Required");
56      	selectByName("field88","Vegetables");
57      	waitForElementPresentByXpath("//div[@id='ui-datepicker-div' and @style='position: absolute; top: 348.1875px; width: 34em; left: 31px; z-index: 1; display: none;']");
58      	waitAndClickByName("field3");
59      	waitForElementPresentByXpath("//div[@id='ui-datepicker-div' and @style='position: absolute; top: 348.1875px; width: 34em; left: 31px; z-index: 1; display: block;']");
60      	waitForElementPresentByXpath("//input[@type='checkbox' and @name='bField1' and @checked='checked']");
61      	waitAndClickByXpath("//input[@type='radio' and @name='field5' and @value='1']");
62      	waitForElementPresentByXpath("//input[@type='file' and @name='fileUpload']");
63      	waitAndTypeByName("testPerson.principalName","fred");
64      	waitAndTypeByName("field2","");
65      	waitForTextPresent("fred, fred");
66      	waitAndTypeByName("testPerson.principalName","deep");
67      	waitAndTypeByName("field2","");
68      	waitForTextPresent("user control not found");
69      	waitForElementPresentByXpath("//a[@class='ui-spinner-button ui-spinner-up ui-corner-tr']");
70      	waitForElementPresentByXpath("//a[@class='ui-spinner-button ui-spinner-down ui-corner-br']");
71      	waitForElementPresentByXpath("//h4/span[contains(text(),'Image Caption Text')]");
72      	waitForElementPresentByXpath("//a[@id='actionLink-noImage_attrs']");
73      	waitForElementPresentByXpath("//a[@id='actionLink-imageRight_attrs']/img");
74      	waitForElementPresentByXpath("//a[@id='actionLink-imageLeft_attrs']/img");
75      	waitForElementPresentByXpath("//input[@type='image' and @id='imageAction_attrs']");
76      	waitForElementPresentByXpath("//button[@id='buttonImageBottom_attrs']/span/img");
77      	waitForElementPresentByXpath("//button[@id='buttonImageLeft_attrs']/img");
78      	waitForElementPresentByXpath("//button[@id='buttonImageRight_attrs']/img");
79      	waitForElementPresentByXpath("//button[@id='buttonImageTop_attrs']/span/img");
80      	waitForElementPresentByXpath("//a[@href='http://www.kuali.org' and contains(text(),'Kuali Website')]");
81      	waitForElementPresentByXpath("//iframe[@id='iframe_attrs']");
82      }
83  }