// Make sure we can lookup server component by name
HtmlToolTip tt = (HtmlToolTip)server.findComponent(_FOLLOWMOUSE_TOOLTIP);
assertNotNull("Unable to find server-side HtmlToolTip component",tt);
// 1) Find client-side tooltip span
HtmlSpan tooltip1 = (HtmlSpan)((HtmlPage)client.getContentPage()).getElementById(_FOLLOWMOUSE_TOOLTIP); // Required because name collision
assertNotNull("Unable to find client-side span named \""+_FOLLOWMOUSE_TOOLTIP+"\"",tooltip1);
// 2) Find Richpanel div to perform mouse-over (parent element)
HtmlDivision parentDiv = (HtmlDivision)client.getElement(_FOLLOWMOUSE_PANEL);
assertNotNull("Unable to find \"sample1\" control",parentDiv);
// 3) Find Richpanel internal div (also needed)
HtmlDivision parentSubDiv = (HtmlDivision)client.getElement(_FOLLOWMOUSE_PANEL+"_body");
assertNotNull("Unable to find \"sample1_body\" control",parentSubDiv);
// 4) Make sure tooltip is currently hidden (style contains 'display: none')
String hiddenStyle = tooltip1.getStyleAttribute();
assertTrue("Tooltip not hidden as expected: ["+hiddenStyle+"]",
hiddenStyle.contains("display:none") || hiddenStyle.contains("display: none"));
// 5) Move mouse over div to make tooltip display
// Yes, all three of these are required.
parentDiv.mouseOver();
parentDiv.mouseMove();
parentSubDiv.mouseOver();
// 0.5 delay on tooltip - so wait a sec
Thread.sleep(1000);
// 6) Make sure tooltip is currently visible (style does not contain 'display: none')
String visibleStyle = tooltip1.getStyleAttribute();
assertFalse("Tooltip not visible as expected: ["+visibleStyle+"]",
visibleStyle.contains("display:none") || visibleStyle.contains("display: none"));
}