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