1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.widgets;
17
18 import org.junit.Test;
19 import org.kuali.rice.krad.demo.uif.library.DemoLibraryBase;
20 import org.openqa.selenium.By;
21 import org.openqa.selenium.WebElement;
22
23
24
25
26 public class DemoWidgetsHelpAft extends DemoLibraryBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-HelpView&methodToCall=start";
32
33 @Override
34 protected String getBookmarkUrl() {
35 return BOOKMARK_URL;
36 }
37
38 @Override
39 protected void navigate() throws Exception {
40 navigateToLibraryDemo("Widgets", "Help");
41 }
42
43 protected void testWidgetsTooltipHelp() throws Exception {
44 fireMouseOverEvent(By.id("Demo-Help-Field1_label"));
45 WebElement helpExample1 = driver.findElement(By.xpath("//div[@data-for=\"Demo-Help-Field1_label\"]"))
46 .findElement(By.className("jquerybubblepopup-innerHtml"));
47 if (!helpExample1.isDisplayed()) {
48 fail("Example 1 help not displayed.");
49 }
50 if (!helpExample1.getText().equals("Sample text for field help - label left")) {
51 fail("Incorrect inner html text. Actual text: " + helpExample1.getText());
52 }
53 }
54
55 protected void testMissingTooltipHelp() throws Exception {
56 selectByName("exampleShown","Missing Tooltip Help");
57 fireEvent("dataField1", "focus");
58 waitForElementNotPresent(By.xpath("//div[@class='jquerybubblepopup-innerHtml']"));
59 }
60
61 protected void testExternalHelp() throws Exception {
62 selectByName("exampleShown","External Help");
63 waitForElementPresentByXpath("//input[@type='image' and @title='Help for Field Label']");
64 waitForElementPresentByXpath("//input[@type='image' and @title='Help']");
65 waitForElementPresentByXpath("//input[@type='image' and @title='Help for Display only fields']");
66 }
67
68 private void testAllHelp() throws Exception {
69 testWidgetsTooltipHelp();
70 testMissingTooltipHelp();
71 testExternalHelp();
72 passed();
73 }
74
75 @Test
76 public void testWidgetsHelpBookmark() throws Exception {
77 testAllHelp();
78 }
79
80 @Test
81 public void testWidgetsHelpNav() throws Exception {
82 testAllHelp();
83 }
84 }