back to nexaweb
search
Close source view

  1. Set textFieldObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").JavaObject("TextField").Object.getScriptObject()
  2.  
  3. Set menuBarObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").JavaObject("MenuBar").Object.getScriptObject()
  4.  
  5. itemCount = menuBarObj.getMenuBarItemCount()
  6.  
  7. 'verify the menu item text
  8. if( itemCount <> 5 ) then
  9.         Reporter.ReportEvent micFail,"Menu Bar", "Expected menu count to be 5.   Acutal was "+ Cstr( itemCount )
  10. else
  11.     Reporter.ReportEvent micPass,"Menu Bar", "Got Expected menu count of  "+ Cstr( itemCount )
  12. End if
  13.  
  14. ' get the first menu
  15. Set menuObj = menuBarObj.getMenuBarItemAt( 0 )
  16.  
  17. 'verify the menu text
  18. text = menuObj.getText()
  19. if( text <> "Menu 1" ) then
  20.         Reporter.ReportEvent micFail,"MenuText", "Expected text 'Menu 1'.   Acutal was "+text
  21. else
  22.     Reporter.ReportEvent micPass,"Menu Text", "Got Expected text "+text
  23. End if
  24.  
  25.  
  26. ' select the menu
  27. Set popupMenu = menuObj.select()
  28.  
  29. ' get the first menu item of the popup
  30. Set menuItemObj = popupMenu.getMenuItemAt( 0 )
  31.  
  32. 'verify the menu item text
  33. text = menuItemObj.getText()
  34. if( text <> "Menu 1 MenuItem 1" ) then
  35.         Reporter.ReportEvent micFail,"Menu Item Text", "Expected text 'Menu 1 MenuItem 1'.   Acutal was "+text
  36. else
  37.     Reporter.ReportEvent micPass,"Menu Item Text", "Got Expected text "+text
  38. End if
  39.  
  40. ' select the menu item to fire its onCommand
  41. menuItemObj.select
  42.  
  43. 'verify the text field was set correctly
  44. text = textFieldObj.getText()
  45. if( text <> "Menu 1 MenuItem 1") then
  46.         Reporter.ReportEvent micFail,"TextField Text", "Expected text 'Menu 1 MenuItem 1'.   Acutal was "+text
  47. else
  48.     Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
  49. End if
  50.  
  51. ' reselect the first menu
  52. Set popupMenu = menuObj.select()
  53.  
  54. ' get the second menu item
  55. Set menuItemObj = popupMenu.getMenuitemAt( 2 )
  56.  
  57. 'verify the menu item text
  58. text = menuItemObj.getText()
  59. if( text <> "Menu 1 MenuItem 2" ) then
  60.         Reporter.ReportEvent micFail,"Menu Item Text", "Expected text 'Menu 1 MenuItem 1'.   Acutal was "+text
  61. else
  62.     Reporter.ReportEvent micPass,"Menu Item Text", "Got Expected text "+text
  63. End if
  64.  
  65. ' select the menu item to fire its onCommand
  66. menuItemObj.select
  67.  
  68.  
  69. 'verify the text field was set correctly
  70. text = textFieldObj.getText()
  71. if( text <> "Menu 1 MenuItem 2") then
  72.         Reporter.ReportEvent micFail,"TextField Text", "Expected text ''Menu 1 MenuItem 2'.   Acutal was "+text
  73. else
  74.     Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
  75. End if
  76.  
  77.  
  78. ' get the third menu item (second menu item is a separator)
  79. Set menuObj = menuBarObj.getMenuBarItemAt( 2 )
  80.  
  81. 'verify the menu text
  82. text = menuObj.getText()
  83. if( text <> "Menu 2" ) then
  84.         Reporter.ReportEvent micFail,"MenuText", "Expected text 'Menu 2'.   Acutal was "+text
  85. else
  86.     Reporter.ReportEvent micPass,"Menu Text", "Got Expected text "+text
  87. End if
  88.  
  89. ' select the second menu
  90. Set popupMenu = menuObj.select()
  91.  
  92. ' select the second menu item which is a submenu
  93. Set subMenuObj = popupMenu.getMenuItemAt( 1 )
  94. Set subPopupMenu = subMenuObj.select()
  95.  
  96. ' select the menu item of the sub menu
  97. Set menuItemObj = subPopupMenu.getMenuItemAt( 0 )
  98. menuItemObj.select
  99.  
  100. 'verify the text field was set correctly
  101. text = textFieldObj.getText()
  102. if( text <> "Menu2 SubMenu MenuItem") then
  103.         Reporter.ReportEvent micFail,"TextField Text", "Expected text 'Menu2 SubMenu MenuItem'.   Acutal was "+text
  104. else
  105.     Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
  106. End if
  107.  
  108.  
  109. ' select the fourth item of the menu bar (the third is a separator)
  110. Set menuObj = menuBarObj.getMenuBarItemAt( 4 )
  111. Set popupMenu = menuObj.select()
  112.  
  113. ' select the checkbox menu item
  114. Set menuItemObj = popupMenu.getMenuitemAt( 1 )
  115. menuItemObj.select
  116.  
  117. 'verify the text field was set correctly
  118. text = textFieldObj.getText()
  119. if( text <> "CheckBox MenuItem State true") then
  120.         Reporter.ReportEvent micFail,"TextField Text", "Expected text 'CheckBox MenuItem State true'.   Acutal was "+text
  121. else
  122.     Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
  123. End if
  124.  
  125. Set popupMenu = menuObj.select()
  126. Set menuItemObj = popupMenu.getMenuitemAt( 1 )
  127. menuItemObj.select
  128.  
  129. 'verify the text field was set correctly
  130. text = textFieldObj.getText()
  131. if( text <> "CheckBox MenuItem State false") then
  132.         Reporter.ReportEvent micFail,"TextField Text", "Expected text 'CheckBox MenuItem State false'.   Acutal was "+text
  133. else
  134.     Reporter.ReportEvent micPass,"TextField Text", "Got Expected text "+text
  135. End if
  136.  

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