View Javadoc
1   /**
2    * Copyright 2005-2015 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 org.kuali.rice.krad.labs.kitchensink;
17  
18  import org.junit.Test;
19  
20  /**
21   * @author Kuali Rice Team (rice.collab@kuali.org)
22   */
23  public class LabsInputFieldsAft extends LabsKitchenSinkBase {
24  
25      /**
26       * /kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page1#UifCompView-Page1
27       */
28      public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page1#UifCompView-Page1";
29     
30      @Override
31      protected String getBookmarkUrl() {
32          return BOOKMARK_URL;
33      }
34  
35  	@Override
36  	protected void navigate() throws Exception {
37  		navigateToKitchenSink("Input Fields");
38  	}
39  	
40  	@Test
41      public void testInputFieldsBookmark() throws Exception {
42          testInputFields();
43          passed();
44      }
45  
46      @Test
47      public void testInputFieldsNav() throws Exception {
48          testInputFields();
49          passed();
50      }
51      
52      protected void testInputFields() throws InterruptedException {
53      	//Label
54      	waitForElementPresentByXpath("//label[@class='uif-label uif-labelBlock uif-tooltip' and contains(text(),'Field Label')]");
55      	waitForElementPresentByXpath("//label[@class='uif-label uif-labelBlock' and contains(text(),'Field Label:')]");
56      	waitForElementPresentByXpath("//label[@class='uif-label uif-labelBlock' and contains(text(),'Field Label:')]");
57      	waitForElementPresentByXpath("//p[contains(text(),'Constraint text')]");
58      	
59      	//TextBox
60      	waitForElementPresentByXpath("//input[@placeholder and @size='30' and @maxlength='40']");
61      	waitForElementPresentByXpath("//input[@size='60']");
62      	waitAndClickByXpath("//a[@title='Expand']");
63      	waitForElementPresentByXpath("//textarea[@id='textarea_popout_control']");
64      	waitAndClickByXpath("//input[@id='done_btn']");
65      	waitForElementPresentByXpath("//input[@disabled and @name='field109']");
66      	waitForElementPresentByXpath("//input[@style='text-transform: uppercase;']");
67      	
68      	//TextArea
69      	waitForElementPresentByXpath("//textarea[@placeholder='Watermark... ' and @rows='5' and @cols='40']");
70      	waitForElementPresentByXpath("//textarea[@rows='10' and @cols='50']");
71      	
72      	//Date Input
73      	waitAndTypeByName("date1","");
74      	waitAndTypeByName("date2","asd");
75      	assertElementPresentByXpath("//input[@name='date2' and @placeholder='mm/dd/yyyy ']");
76      	assertElementPresentByXpath("//input[@name='field132' and @placeholder='mm-dd-yy ']");
77      	assertElementPresentByXpath("//input[@name='field133' and @placeholder='mm-dd-yyyy ']");
78      	waitAndTypeByName("field133","asd");
79      	waitAndTypeByName("date5","2");
80      	waitForElementPresentByXpath("//input[@name='field133' and @class='form-control input-sm uif-dateControl validChar-field1330 hasDatepicker dirty error']");
81      	waitAndClickByXpath("//input[@name='date6']");
82      	waitForElementPresentByXpath("//div[@class='ui-datepicker-group ui-datepicker-group-first']");
83      	waitForElementPresentByXpath("//div[@class='ui-datepicker-group ui-datepicker-group-last']");
84      	waitAndClickByXpath("//button[@class='ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all']");//Today
85      	waitForElementPresentByXpath("//input[@class='form-control input-sm uif-dateControl validChar-date50 hasDatepicker dirty error' and @name='date5']");
86      	waitForElementPresentByXpath("//input[@name='date7' and @disabled]");
87      	
88      	//Selection Control
89      	//Checkbox and Radio
90      	assertElementPresentByXpath("//input[@type='checkbox' and @name='bField1']");
91      	waitAndClickByXpath("//input[@type='checkbox' and @name='field114' and @value='1']");
92      	waitAndClickByXpath("//input[@type='checkbox' and @name='field116' and @disabled]");
93      	waitAndClickByXpath("//input[@type='radio' and @name='field117' and @value='1']");
94      	
95      	//Select and Dropdown
96      	selectByName("field119","Option 1");
97      	waitForElementPresentByXpath("//select[@name='field119']");
98      	waitForElementPresentByXpath("//div[@data-label='Dropdown Navigation']/select[@class='uif-dropdownControl valid']");
99      	waitForElementPresentByXpath("//ul/li/a[contains(text(),'Kuali.org')]");
100     	waitForElementPresentByXpath("//div[@data-label='Option List Nav - UrlInfo configured']/ul/li/a[contains(text(),'Other Fields')]");
101     	waitForElementPresentByXpath("//ul/li/a[contains(text(),'Kuali.org')]");
102     	assertElementPresentByXpath("//select[@name='field120' and @multiple and @size='3']");
103     	
104     	//Others
105     	assertElementPresentByXpath("//input[@type='file']");
106     	waitAndTypeByName("testPerson.principalName","fred");
107     	waitAndTypeByName("field131","1");
108     	Thread.sleep(3000);//Needed as the text wont appears else
109     	waitForTextPresent("fred, fred");
110     	clearTextByName("testPerson.principalName");
111     	waitAndTypeByName("testPerson.principalName","deep");
112     	waitAndTypeByName("field131","1");
113        	Thread.sleep(3000);//Needed as the text wont appears else
114     	waitForTextPresent("user control not found");
115     	assertElementPresentByXpath("//a[@class='ui-spinner-button ui-spinner-up ui-corner-tr']");
116     	assertElementPresentByXpath("//a[@class='ui-spinner-button ui-spinner-down ui-corner-br']");
117     	
118     	//Page Navigation links
119     	waitAndClickByXpath("//a[@data-onclick='jumpToBottom();' and contains(text(),'Jump To Bottom Demo')]");
120     	waitAndClickByXpath("//a[@id='ActionLinkField_JumpToField119' and contains(text(),'Jump to field with property name field119 (drop down)')]");
121     	waitAndClickByXpath("//a[@id='ActionLinkField_FocusOnField107' and contains(text(),'Focus on field with property name field107 (size 60 text field)')]");
122     	waitAndClickByXpath("//a[@id='ActionLinkField_FocusOnIdMyDate' and contains(text(),'Focus on field with id myDate (Date2 field)')]");
123     }
124 }