' get the app object
Set appObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").Object.getScriptObject()
' get the buttons in the app
Set objButtons = appObj.findObjects("//button")
' get the first button
Set buttonObj = objButtons.elementAt( 0 )
' perform mouse over to create tooltip
buttonObj.simulateMouseOver
' verify that a tooltip is visible
if( appObj.isTooltipVisible() ) then
' get the tooltip
Set tooltip = appObj.getTootlip()
' check to see if this is a text tooltip as expected
if( tooltip.isTextTooltip() ) then
' verify the background color, of the tooltip
Set bgColor = tooltip.getBackgroundColor()
color = bgColor.getHTMLString()
if( color <> "#FFFFE6" )then
Reporter.ReportEvent micFail,"TextTooltip Background Color", "Expected color #FFFFE6. Acutal is "+ color
else
Reporter.ReportEvent micPass,"TextTooltip Background Color", "Color was as expected :"+color
End if
' verify the text of the tooltip
text = tooltip.getTooltipText()
if( text <> "This is a button tooltip.") then
Reporter.ReportEvent micFail,"TextTooltip", "Expected text 'This is a button tooltip.'. Acutal was "+text
else
Reporter.ReportEvent micPass,"TextTooltip", "Got Expected text "+text
End if
Else
Reporter.ReportEvent micFail,"TextTooltip", "Tooltip is not a text tooltip"
end if
Else
Reporter.ReportEvent micFail,"TextTooltip", "No tooltip visible."
end if
' perform mouse exited to clear the tooltip
buttonObj.simulateMouseExited
' get the second button
Set buttonObj = objButtons.elementAt( 1 )
' perform mouse over to create tooltip
buttonObj.simulateMouseOver
Dim textArray
textArray = Array("east", "north", "south", "west")
' verify that a tooltip is visible
if( appObj.isTooltipVisible() ) then
Set tooltip = appObj.getTootlip()
numChildren = tooltip.getChildObjectCount()
For i = 0 to numChildren -1
' get the label text
Set label = tooltip.getChildObjectAt( i )
text = label.getText()
' get the expected value
checkText = textArray( i )
' verify the text
if( text <> checkText ) then
errorString = "Expected label "+ CStr(i) + " to be " + checkText + " actual value was " + text
Reporter.ReportEvent micFail,"PopupTooltip", errorString
Else
passString = "Label "+ CStr(i) + " actual expected value " + text
Reporter.ReportEvent micPass,"PopupTooltip", passString
End if
Next
Else
Reporter.ReportEvent micFail,"PopupTooltip", "No tooltip visible."
end if
' perform mouse exited to clear the tooltip
buttonObj.simulateMouseExited