1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.demo.uif.library;
17
18 import com.thoughtworks.selenium.SeleneseTestBase;
19 import edu.samplu.krad.demo.uif.library.DemoLibraryBase;
20 import org.junit.Test;
21 import edu.samplu.common.SmokeTestBase;
22 import org.kuali.rice.krad.uif.UifConstants;
23 import org.openqa.selenium.By;
24 import org.openqa.selenium.WebElement;
25 import org.openqa.selenium.interactions.Actions;
26
27 import java.text.SimpleDateFormat;
28 import java.util.Date;
29 import java.util.List;
30
31
32
33
34 public class DemoLibraryWidgetsDatePickerSmokeTest extends DemoLibraryBase {
35
36
37
38
39 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DatePicker-View&methodToCall=start";
40
41 @Override
42 protected String getBookmarkUrl() {
43 return BOOKMARK_URL;
44 }
45
46 @Override
47 protected void navigate() throws Exception {
48 waitAndClickById("Demo-LibraryLink", "");
49 waitAndClickByLinkText("Widgets");
50 waitAndClickByLinkText("DatePicker");
51 }
52
53 protected void testWidgetsDatePickerDefault() throws Exception {
54
55
56 waitAndClick(By.cssSelector("img.ui-datepicker-trigger"));
57
58
59 waitAndClick(By.cssSelector(".ui-datepicker-current"));
60
61
62 String today = new SimpleDateFormat("MM/dd/yyyy").format(new Date());
63 String populatedDate = driver.findElement(By.id("u100085_control")).getAttribute("value");
64 if (!populatedDate.equals(today)) {
65 fail("DatePicker did not populate correct value.");
66 }
67
68 }
69
70 protected void testWidgetsDatePickerWidget() throws Exception {
71 waitAndClickByLinkText(">> Open Library Navigation");
72 waitAndClickByLinkText("Suggest");
73 waitAndClickByLinkText("Tooltip");
74 select(By.id("Demo-LargeExampleDropdown_control"), "Tooltip On Focus");
75
76
77 fireMouseOverEvent(By.id("u100101_label"));
78 Thread.sleep(1000);
79 WebElement tooltipFocusLabel = driver.findElement(By.xpath("//div[@data-for=\"u100101_label\"]")).findElement(
80 By.className("jquerybubblepopup-innerHtml"));
81 if (!tooltipFocusLabel.isDisplayed()) {
82 fail("Tooltip help for label not displayed.");
83 }
84 if (!tooltipFocusLabel.getText().equals("Click on the text box for a tool tip")) {
85 fail("Incorrect inner html text for label focus tooltip.");
86 }
87
88
89 waitAndClickById("u100101_control");
90 Thread.sleep(1000);
91 WebElement tooltipFocusControl = driver.findElement(By.xpath("//div[@data-for=\"u100101_control\"]"))
92 .findElement(By.className("jquerybubblepopup-innerHtml"));
93 if (!tooltipFocusControl.isDisplayed()) {
94 fail("Tooltip help for control not displayed.");
95 }
96 if (!tooltipFocusControl.getText().equals("This tooltip appears when the field receives focus")) {
97 fail("Incorrect inner html text for tooltip focus control.");
98 }
99 }
100
101 @Test
102 public void testWidgetsDatePickerBookmark() throws Exception {
103 testWidgetsDatePickerDefault();
104 driver.close();
105 passed();
106 }
107
108 @Test
109 public void testWidgetsDatePickerNav() throws Exception {
110 testWidgetsDatePickerDefault();
111 driver.close();
112 passed();
113 }
114 }