1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.controls;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21
22
23
24
25 public class LibraryControlPasswordAft extends WebDriverLegacyITBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-PasswordControlView&methodToCall=start";
31
32
33
34
35 private static final String DEFAULT_PWD_FIELD_XPATH = "//section[@id='Demo-PasswordControl-Example1']/div/input[@type='password' and @name='inputField2']";
36
37
38
39
40 private static final String SIZE_PWD_FIELD_XPATH = "//section[@id='Demo-PasswordControl-Example2']/div/input[@type='password' and @name='inputField2']";
41
42
43
44
45 private static final String DISABLED_PWD_FIELD_XPATH = "//section[@id='Demo-PasswordControl-Example3']/div/input[@type='password' and @name='inputField2' and @disabled='disabled']";
46
47
48
49
50 private static final String EVAL_DISABLED_ON_KEY_UP_PWD_FIELD_XPATH_BEFORE = "//section[@id='Demo-PasswordControl-Example4']/div/input[@type='password' and @name='inputField2' and @disabled='disabled']";
51
52
53
54
55 private static final String EVAL_DISALBED_ON_KEY_UP_PWD_FIELD_XPATH_AFTER = "//section[@id='Demo-PasswordControl-Example4']/div/input[@type='password' and @name='inputField2']";
56
57
58
59
60 private static final String ENABLE_WHEN_CHANGED_PWD_FIELD_XPATH_BEFORE = "//section[@id='Demo-PasswordControl-Example5']/div/input[@type='password' and @name='inputField4' and @disabled='disabled']";
61
62
63
64
65 private static final String ENABLE_WHEN_CHANGED_PWD_FIELD_XPATH_AFTER = "//section[@id='Demo-PasswordControl-Example5']/div/input[@type='password' and @name='inputField4']";
66
67
68
69
70 private static final String DISABLE_WHEN_CHANGED_PWD_FIELD_XPATH_AFTER = "//section[@id='Demo-PasswordControl-Example6']/div/input[@type='password' and @name='inputField6' and @disabled]";
71
72
73
74
75 private static final String DISABLE_WHEN_CHANGED_PWD_FIELD_XPATH_BEFORE = "//section[@id='Demo-PasswordControl-Example6']/div/input[@type='password' and @name='inputField6']";
76
77 @Override
78 protected String getBookmarkUrl() {
79 return BOOKMARK_URL;
80 }
81
82 @Override
83 protected void navigate() throws Exception {
84 waitAndClickLibraryLink();
85 waitAndClickByLinkText("Controls");
86 waitAndClickByLinkText("Password");
87 }
88
89 protected void testLibraryControlPasswordDefault() throws Exception {
90 waitForElementPresentByXpath(DEFAULT_PWD_FIELD_XPATH);
91 waitAndTypeByXpath(DEFAULT_PWD_FIELD_XPATH,"HiPassword!");
92 }
93
94 protected void testLibraryControlPasswordSize() throws Exception {
95 waitAndClickByLinkText("Size");
96 waitForElementPresentByXpath(SIZE_PWD_FIELD_XPATH);
97 waitAndTypeByXpath(SIZE_PWD_FIELD_XPATH,"HiPasswordHiPasswordHiPasswordHiPasswordHiPasswordHiPassword!");
98 }
99
100 protected void testLibraryControlPasswordDisabled() throws Exception {
101 waitAndClickByLinkText("Disabled");
102 waitForElementPresentByXpath(DISABLED_PWD_FIELD_XPATH);
103 }
104
105 protected void testLibraryControlPasswordEvaluateDisabledOnKeyUp() throws Exception {
106 waitAndClickByLinkText("Evaluate disabled on key up");
107 assertElementPresentByXpath(EVAL_DISABLED_ON_KEY_UP_PWD_FIELD_XPATH_BEFORE);
108 waitAndTypeByName("inputField1","a");
109 assertElementPresentByXpath(EVAL_DISALBED_ON_KEY_UP_PWD_FIELD_XPATH_AFTER);
110 }
111
112 protected void testLibraryControlPasswordEnableWhenChanged() throws Exception {
113 waitAndClickByLinkText("Enable when changed");
114 assertElementPresentByXpath(ENABLE_WHEN_CHANGED_PWD_FIELD_XPATH_BEFORE);
115 waitAndTypeByName("inputField3","a");
116 typeTab();
117 assertElementPresentByXpath(ENABLE_WHEN_CHANGED_PWD_FIELD_XPATH_AFTER);
118 }
119
120 protected void testLibraryControlPasswordDisableWhenChanged() throws Exception {
121 waitAndClickByLinkText("Disable when changed");
122 assertElementPresentByXpath(DISABLE_WHEN_CHANGED_PWD_FIELD_XPATH_BEFORE);
123 waitAndTypeByName("inputField5","a");
124 typeTab();
125 assertElementPresentByXpath(DISABLE_WHEN_CHANGED_PWD_FIELD_XPATH_AFTER);
126 }
127
128 @Test
129 public void testControlPasswordBookmark() throws Exception {
130 testLibraryControlPasswordDefault();
131 testLibraryControlPasswordSize();
132 testLibraryControlPasswordDisabled();
133 testLibraryControlPasswordEvaluateDisabledOnKeyUp();
134 testLibraryControlPasswordEnableWhenChanged();
135 testLibraryControlPasswordDisableWhenChanged();
136 passed();
137 }
138
139 @Test
140 public void testControlPasswordNav() throws Exception {
141 testLibraryControlPasswordDefault();
142 testLibraryControlPasswordSize();
143 testLibraryControlPasswordDisabled();
144 testLibraryControlPasswordEvaluateDisabledOnKeyUp();
145 testLibraryControlPasswordEnableWhenChanged();
146 testLibraryControlPasswordDisableWhenChanged();
147 passed();
148 }
149 }