back to nexaweb
search
Close source view

  1. ' get the app object
  2. Set appObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").Object.getScriptObject()
  3.  
  4. ' get the buttons in the app
  5. Set objButtons = appObj.findObjects("//button")
  6.  
  7. ' get the first button
  8. Set buttonObj = objButtons.elementAt( 0 )
  9.  
  10. ' perform mouse over to create tooltip
  11. buttonObj.simulateMouseOver
  12.  
  13. ' verify that a tooltip is visible
  14. if( appObj.isTooltipVisible() ) then
  15.     ' get the tooltip
  16.     Set tooltip = appObj.getTootlip()
  17.     '  check to see if this is a text tooltip as expected
  18.     if( tooltip.isTextTooltip() ) then
  19.  
  20.         ' verify the background color, of the tooltip
  21.         Set bgColor = tooltip.getBackgroundColor()
  22.         color = bgColor.getHTMLString()
  23.         if( color <> "#FFFFE6" )then
  24.             Reporter.ReportEvent micFail,"TextTooltip Background Color", "Expected color #FFFFE6.   Acutal is "+ color
  25.         else
  26.             Reporter.ReportEvent micPass,"TextTooltip Background Color", "Color was as expected :"+color
  27.         End if
  28.  
  29.         ' verify the text of the tooltip
  30.         text = tooltip.getTooltipText()
  31.         if( text <> "This is a button tooltip.") then
  32.             Reporter.ReportEvent micFail,"TextTooltip", "Expected text 'This is a button tooltip.'.   Acutal was "+text
  33.         else
  34.             Reporter.ReportEvent micPass,"TextTooltip", "Got Expected text "+text
  35.         End if
  36.     Else
  37.             Reporter.ReportEvent micFail,"TextTooltip", "Tooltip is not a text tooltip"
  38.     end if
  39. Else
  40.             Reporter.ReportEvent micFail,"TextTooltip", "No tooltip visible."
  41. end if
  42.  
  43. ' perform mouse exited to clear the tooltip
  44. buttonObj.simulateMouseExited
  45.  
  46. ' get the second button
  47. Set buttonObj = objButtons.elementAt( 1 )
  48.  
  49. ' perform mouse over to create tooltip
  50. buttonObj.simulateMouseOver
  51.  
  52. Dim textArray
  53. textArray = Array("east", "north", "south", "west")
  54.  
  55.  
  56. ' verify that a tooltip is visible
  57. if( appObj.isTooltipVisible() ) then
  58.     Set tooltip = appObj.getTootlip()
  59.     numChildren = tooltip.getChildObjectCount()
  60.     For i = 0 to numChildren -1
  61.  
  62.         ' get  the label text
  63.         Set label = tooltip.getChildObjectAt( i )
  64.         text = label.getText()
  65.  
  66.         ' get the expected value
  67.         checkText = textArray( i )
  68.  
  69.         ' verify the text
  70.         if( text <> checkText ) then
  71.             errorString = "Expected label "+ CStr(i) + " to be " + checkText + " actual value was " + text
  72.             Reporter.ReportEvent micFail,"PopupTooltip", errorString
  73.         Else
  74.             passString = "Label "+ CStr(i) + " actual expected value " + text
  75.             Reporter.ReportEvent micPass,"PopupTooltip", passString
  76.         End if
  77.     Next
  78. Else
  79.             Reporter.ReportEvent micFail,"PopupTooltip", "No tooltip visible."
  80. end if
  81.  
  82. ' perform mouse exited to clear the tooltip
  83. buttonObj.simulateMouseExited
  84.  

© Copyright 2005-2008 Nexaweb Technologies Inc. All Rights Reserved.