' get the menu bar object
Set appObj = Browser("Welcome To Nexaweb").Page("Welcome To Nexaweb").JavaApplet("DefaultJvmDetector").Object.getScriptObject()
' get the tabpane
Set tabPaneObj = appObj.findObject( "//tabPane" )
' get the number of tabs in the tabpane
tabCount = tabPaneObj.getTabCount()
' verify the number of tabs in the tabpane to be 3
if( tabCount <>3 ) then
failString = "Expected tab count was 3. Actual tab count was " + CStr( tabCount )
Reporter.ReportEvent micFail,"Tab Count", failString
Else
Reporter.ReportEvent micPass,"Tab Count", "Got expected tab count 3"
End If
' get the tabs as a vector
Set tabVector = tabPaneObj.getTabs()
' test the text of the first tab
Set tabObj = tabVector.elementAt( 0 )
tabText = tabObj.getText()
if( tabText <> "Tab 1" ) then
Reporter.ReportEvent micFail,"Tab 1 Text", "Expected text to be 'Tab1' Actual text was " + tabText
Else
Reporter.ReportEvent micPass,"Tab 1 Text", "Got expected text "+tabText
End If
' test the text of the second tab
Set tabObj = tabVector.elementAt( 1 )
tabText = tabObj.getText()
if( tabText <> "Tab 2" ) then
Reporter.ReportEvent micFail,"Tab 2 Text", "Expected text to be 'Tab2' Actual text was " + tabText
Else
Reporter.ReportEvent micPass,"Tab 2 Text", "Got expected text "+tabText
End If
' test the text of the third tab
Set tabObj = tabVector.elementAt( 2 )
tabText = tabObj.getText()
if( tabText <> "Tab 3" ) then
Reporter.ReportEvent micFail,"Tab 2 Text", "Expected text to be 'Tab3' Actual text was " + tabText
Else
Reporter.ReportEvent micPass,"Tab 2 Text", "Got expected text "+tabText
End If
' select the second tab
tabPaneObj.selectTab( 1 )
' verify that the selected tab was the second tab
Set tabObj = tabPaneObj.getSelectedTab()
tabText = tabObj.getText()
if( tabText <> "Tab 2" ) then
Reporter.ReportEvent micFail,"Selected Tab Text", "Expected text to be 'Tab2' Actual text was " + tabText
Else
Reporter.ReportEvent micPass,"Selected Tab Text", "Got expected text "+tabText
End If
' get the contents of the tab
Set content = tabObj.getView()
objCount = content.getChildObjectCount()
' verify the number of objects that make up the tab
if( objCount <> 5 ) then
failString = "Expected object count was 5. Actual tab count was " + CStr( objCount )
Reporter.ReportEvent micFail,"Tab View Object Count", failString
Else
Reporter.ReportEvent micPass,"Tab View Object Count", "Got expected tab count 5"
End If
' verify the text of the first object in the tab
Set labelObj = content.getChildObjectAt( 0 )
labelText = labelObj.getText()
if( labelText <> "Tab 2 Child 1" ) then
Reporter.ReportEvent micFail,"Child 1 Text", "Expected text to be 'Tab 2 Child 1' Actual text was " + labelText
Else
Reporter.ReportEvent micPass,"Child 1 Text", "Got expected text "+labelText
End If
' verify the text of the second object in the tab
Set labelObj = content.getChildObjectAt( 1 )
labelText = labelObj.getText()
if(labelText <> "Tab 2 Child 2" ) then
Reporter.ReportEvent micFail,"Child 2 Text", "Expected text to be 'Tab 2 Child 2' Actual text was " + labelText
Else
Reporter.ReportEvent micPass,"Child 2 Text", "Got expected text "+labelText
End If
' verify the text of the third object in the tab
Set labelObj = content.getChildObjectAt( 2 )
labelText = labelObj.getText()
if( labelText <> "Tab 2 Child 3" ) then
Reporter.ReportEvent micFail,"Child 3 Text", "Expected text to be 'Tab2 Child 3' Actual text was " + labelText
Else
Reporter.ReportEvent micPass,"Child 3 Text", "Got expected text "+labelText
End If
' verify the text of the fourth object in the tab
Set labelObj = content.getChildObjectAt( 3 )
labelText = labelObj.getText()
if( labelText <> "Tab 2 Child 4" ) then
Reporter.ReportEvent micFail,"Child 4 Text", "Expected text to be 'Tab2 Child 4' Actual text was " + labelText
Else
Reporter.ReportEvent micPass,"Child 4 Text", "Got expected text "+labelText
End If
' verify the text of the fifith object in the tab
Set labelObj = content.getChildObjectAt( 4 )
labelText = labelObj.getText()
if( labelText <> "Tab 2 Child 5" ) then
Reporter.ReportEvent micFail,"Child 5 Text", "Expected text to be 'Tab2 Child 5' Actual text was " + labelText
Else
Reporter.ReportEvent micPass,"Child 5 Text", "Got expected text "+labelText
End If
' select the third tab
tabPaneObj.selectTab( 2 )
' verify that the selected tab was the second tab
Set tabObj = tabPaneObj.getSelectedTab()
tabText = tabObj.getText()
if( tabText <> "Tab 3" ) then
Reporter.ReportEvent micFail,"Selected Tab Text", "Expected text to be 'Tab 3' Actual text was " + tabText
Else
Reporter.ReportEvent micPass,"Selected Tab Text", "Got expected text "+tabText
End If
' get the contents of the tab
Set content = tabObj.getView()
' verify the conent of the first tab
labelText = content.getText()
if( labelText <> "third tab" ) then
Reporter.ReportEvent micFail,"Tab 3 Content", "Expected text to be 'third tab' Actual text was " + labelText
Else
Reporter.ReportEvent micPass,"Tab 3 Content", "Got expected text "+labelText
End If