1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.library.clientresponsiveness;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.SmokeTestBase;
21
22
23
24
25 public class DemoLibraryClientResponsivenessDisableSmokeTest extends SmokeTestBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-Disable-View&methodToCall=start";
31
32 @Override
33 protected String getBookmarkUrl() {
34 return BOOKMARK_URL;
35 }
36
37 @Override
38 protected void navigate() throws Exception {
39 waitAndClickById("Demo-LibraryLink", "");
40 waitAndClickByLinkText("Client Responsiveness");
41 waitAndClickByLinkText("Disable");
42 }
43
44 protected void testClientResponsivenessDisable() throws Exception {
45
46 waitAndClickByXpath("//input[@type='radio' and @value='enable']");
47 waitAndTypeByName("inputField2","a");
48 waitAndTypeByName("inputField3","b");
49 selectByName("inputField4", "Option 2");
50 selectByName("multiSelectField1","Option 3");
51 waitAndClickByXpath("//input[@type='radio' and @value='1']");
52 waitAndClickByName("checkboxesField1");
53
54
55 waitAndClickByXpath("//input[@type='radio' and @value='disable']");
56 if(isEnabledByName("inputField2") && isEnabledByName("inputField3") && isEnabledByName("inputField4") && isEnabledByName("inputField6") &&
57 isEnabledByName("inputField7") && isEnabledByName("multiSelectField1")) {
58 fail("Field Not Disabled Properly.");
59 }
60 }
61
62 protected void testClientResponsivenessDisableOnChange() throws Exception {
63 selectByName("exampleShown","On change");
64
65
66 assertElementPresentByXpath("//button[@class='btn btn-primary uif-primaryActionButton uif-boxLayoutHorizontalItem disabled']");
67 waitAndTypeByName("inputField10","a");
68 waitAndTypeByName("inputField11","a");
69 waitAndTypeByName("inputField10", "");
70 assertElementPresentByXpath("//button[@class='btn btn-primary uif-primaryActionButton uif-boxLayoutHorizontalItem disabled']");
71 }
72
73 protected void testClientResponsivenessDisableOnKeyUp() throws Exception {
74 selectByName("exampleShown","On keyup");
75 waitAndTypeByName("inputField13","disable");
76 assertElementPresentByXpath("//button[contains(text(),'Action Button (keyUp)') and @class='btn btn-primary uif-primaryActionButton uif-boxLayoutHorizontalItem disabled']");
77 waitAndClickByLinkText("Usage");
78 assertElementPresentByXpath("//button[contains(text(),'Action Button (change)') and @class='btn btn-primary uif-primaryActionButton uif-boxLayoutHorizontalItem disabled']");
79 }
80
81 protected void testClientResponsivenessDisableInCollections() throws Exception {
82 selectByName("exampleShown","In Collections");
83 assertElementPresentByXpath("//input[@class='uif-textControl ignoreValid']");
84 selectByName("newCollectionLines['collection1'].field1","Disable");
85 Thread.sleep(1000);
86 assertElementPresentByXpath("//input[@disabled]");
87 }
88
89 protected void testClientResponsivenessDisableColl() throws Exception {
90 selectByName("exampleShown","Coll. SpringEL Functions");
91 waitAndClickByXpath("//input[@name='checkboxesField2' and @value='1']");
92 assertElementPresentByXpath("//input[@name='inputField20' and @class='uif-textControl disabled']");
93 waitAndClickByXpath("//input[@name='checkboxesField2' and @value='2']");
94 waitAndClickByXpath("//input[@name='checkboxesField2' and @value='3']");
95 assertElementPresentByXpath("//input[@name='inputField21' and @class='uif-textControl disabled']");
96 }
97
98 @Test
99 public void testClientResponsivenessDisableBookmark() throws Exception {
100 testClientResponsivenessDisable();
101 testClientResponsivenessDisableOnChange();
102 testClientResponsivenessDisableOnKeyUp();
103 testClientResponsivenessDisableInCollections();
104 testClientResponsivenessDisableColl();
105 passed();
106 }
107
108 @Test
109 public void testClientResponsivenessDisableNav() throws Exception {
110 testClientResponsivenessDisable();
111 testClientResponsivenessDisableOnChange();
112 testClientResponsivenessDisableOnKeyUp();
113 testClientResponsivenessDisableInCollections();
114 testClientResponsivenessDisableColl();
115 passed();
116 }
117 }