1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.library.controls;
17
18 import org.junit.Test;
19 import org.kuali.rice.testtools.selenium.SmokeTestBase;
20
21
22
23
24 public class DemoLibraryControlTextAreaSmokeTest extends SmokeTestBase {
25
26
27
28
29 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-TextAreaControl-View";
30
31 @Override
32 protected String getBookmarkUrl() {
33 return BOOKMARK_URL;
34 }
35
36 @Override
37 protected void navigate() throws Exception {
38 waitAndClickById("Demo-LibraryLink", "");
39 waitAndClickByLinkText("Controls");
40 waitAndClickByLinkText("Text Area");
41 }
42
43 protected void testLibraryControlTextAreaDefault() throws Exception {
44 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example1']/textarea[@name='inputField2' and @rows='3' and @cols='40']");
45 }
46
47 protected void testLibraryControlTextAreaColsAndRowsSet() throws Exception {
48 waitAndClickByLinkText("Cols and Rows set");
49 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example2']/textarea[@name='inputField2' and @rows='5' and @cols='60']");
50 }
51
52 protected void testLibraryControlTextAreaTextExpand() throws Exception {
53 waitAndClickByLinkText("Text expand");
54 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example3']/textarea[@name='inputField2' and @rows='3' and @cols='40']");
55 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example3']/a[@title='Expand']");
56 }
57
58 protected void testLibraryControlTextAreaDisabled() throws Exception {
59 waitAndClickByLinkText("Disabled");
60 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example4']/textarea[@name='inputField2' and @rows='3' and @cols='40' and @disabled]");
61 }
62
63 protected void testLibraryControlTextAreaWatermarkText() throws Exception {
64 waitAndClickByLinkText("WatermarkText");
65 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example7']/textarea[@name='inputField2' and @rows='3' and @cols='40' and @placeholder='watermark text ']");
66 }
67
68 protected void testLibraryControlTextAreaDisableOnKeyEvent() throws Exception {
69 waitAndClickByLinkText("Disable on Key event");
70 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example8']/textarea[@name='inputField2' and @rows='3' and @cols='40' and @disabled]");
71 waitAndTypeByXpath("//div[@data-parent='Demo-TextAreaControl-Example8']/textarea[@name='inputField1']","a");
72 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example8']/textarea[@name='inputField2' and @rows='3' and @cols='40']");
73 }
74
75 protected void testLibraryControlTextAreaEnableWhenChanged() throws Exception {
76 waitAndClickByLinkText("Enable when changed");
77 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example9']/textarea[@name='inputField4' and @rows='3' and @cols='40' and @disabled]");
78 waitAndTypeByXpath("//div[@data-parent='Demo-TextAreaControl-Example9']/textarea[@name='inputField3']","a");
79 waitAndClickByLinkText("Usage");
80 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example9']/textarea[@name='inputField4' and @rows='3' and @cols='40']");
81 }
82
83 protected void testLibraryControlTextAreaDisableWhenChanged() throws Exception {
84 waitAndClickByLinkText("Disable when changed");
85 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example10']/textarea[@name='inputField6' and @rows='3' and @cols='40']");
86 waitAndTypeByXpath("//div[@data-parent='Demo-TextAreaControl-Example10']/textarea[@name='inputField5']","a");
87 waitAndClickByLinkText("Usage");
88 assertElementPresentByXpath("//div[@data-parent='Demo-TextAreaControl-Example10']/textarea[@name='inputField6' and @rows='3' and @cols='40' and @disabled]");
89 }
90
91 @Test
92 public void testControlTextAreaBookmark() throws Exception {
93 testLibraryControlTextAreaDefault();
94 testLibraryControlTextAreaColsAndRowsSet();
95 testLibraryControlTextAreaTextExpand();
96 testLibraryControlTextAreaDisabled();
97 testLibraryControlTextAreaWatermarkText();
98 testLibraryControlTextAreaDisableOnKeyEvent();
99 testLibraryControlTextAreaEnableWhenChanged();
100 testLibraryControlTextAreaDisableWhenChanged();
101 passed();
102 }
103
104 @Test
105 public void testControlTextAreaNav() throws Exception {
106 testLibraryControlTextAreaDefault();
107 testLibraryControlTextAreaColsAndRowsSet();
108 testLibraryControlTextAreaTextExpand();
109 testLibraryControlTextAreaDisabled();
110 testLibraryControlTextAreaWatermarkText();
111 testLibraryControlTextAreaDisableOnKeyEvent();
112 testLibraryControlTextAreaEnableWhenChanged();
113 testLibraryControlTextAreaDisableWhenChanged();
114 passed();
115 }
116 }