Anonymous avatar Anonymous committed 8e85982

CWS-TOOLING: integrate CWS jskhgpilot
2009-07-31 skotti #i96753 - added just another 500ms wait - sad, that is
2009-07-31 skotti #i96753 - cleanup, documentation
2009-07-31 skotti #i96753 - fix
2009-07-31 skotti #i96753 - OK, another approach for testing on different hardware...
2009-07-31 skotti #i96753 - small adjustments, back to .click() method
2009-07-29 skotti #i96753 - invented new dynamic function to deal with the menubutton which - as a nice sideefect allows to disable all sleep() statements within the test. This is good for -330 seconds of sleeping and in combination with a few optimizations makes the test run less than 20 minutes, about 8 minutes faster than before
2009-07-28 skotti #i96753 - use MenuBtn.OpenMenu() instead of .click() as this appears to work better and is used in other places successfully as well
2009-07-28 skotti #i103065 - fileopen dialog shows Mercurial and SVN directories which must be skipped
2009-07-28 skotti #i103065 - Added mercurial hidden directory to the excludes list in global routine
2009-07-28 skotti Rebase oder so...
2009-07-28 skotti #i96753 - insert wait statements

Comments (0)

Files changed (5)

testautomation/extensions/optional/includes/fileopen.inc

     
     printlog( "Reopen Extension Manager UI, click Add.. and check the directory" )
     ToolsPackageManager
+    
     kontext "PackageManager"
     if ( PackageManager.exists( 3 ) ) then
         Add.click()
+        
         Kontext "OeffnenDlg"
         if ( OeffnenDlg.exists( 2 ) ) then
-            DateiAuswahl.select( DateiAuswahl.getItemCount() ) 
+
+            printlog( "Select the last item in the list which should be the extension" )            
+            DateiAuswahl.select( Dateiauswahl.getItemCount() )
             cString = DateiAuswahl.getSelText()
             if ( cString <> EXTENSION_NAME ) then
                 warnlog( "Incorrect extension listed. Please check path and filename" )
             else
                 printlog( "Found correct extension, the dialog remembers the path" )
             endif
+
             kontext "OeffnenDlg"
             OeffnenDlg.cancel()
         else
             warnlog( "Could not access Add Extensions Dialog" )
         endif
+        
         kontext "PackageManager"
         PackageManager.close()
     else

testautomation/framework/required/f_tools_customize.bas

 
 sub main
 
+    GLOBAL_USE_NEW_SLEEP = TRUE
+
     use "framework\required\includes\tools_customize.inc"
     
     dim cApp as string

testautomation/framework/required/includes/tools_customize.inc

 
 testcase tUpdtCustomize( cApp as string )
 
-	'///<h1>Update test for the Tools/Customize Dialog</h1>
-	'///<ul>
-    const CANCEL_BUTTON = 1
-    dim brc as boolean
-    
-    '///+<li>Open a new document (abort test on failure)</li>
-    brc = hCreateDocument()
-    if ( not brc ) then
-        warnlog( "Abort: Failed to create requested document: " & gApplication )
-        goto endsub
+    printlog( "Tools/Customize dialog" )
+    const CLOSE_METHOD = 1 ' 1 = Cancel button
+
+    if ( hCreateDocument() ) then    
+        if ( hToolsCustomizeOpen() ) then
+            hUpdtToolsCustomizeKeyboard()
+            hUpdtToolsCustomizeMenu()
+            hUpdtToolsCustomizeToolbars()
+            hUpdtToolsCustomizeEvents()
+            hToolsCustomizeClose( CLOSE_METHOD )
+        else
+            warnlog( "Tools/Customize dialog did not open" )
+        endif
+        hDestroyDocument
+    else
+        warnlog( "Failed to create initial document" )
     endif
     
-    '///+<li>Open Tools Customize</li>
-    brc = hToolsCustomizeOpen()
-    
-    '///+<li>Look at the Keyboard-Tabpage</li>
-    hUpdtToolsCustomizeKeyboard()
-    
-    '///+<li>Look at the Menu-Tabpage</li>
-    hUpdtToolsCustomizeMenu()
-    
-    '///+<li>Look at the Toolbars-Tabpage</li>
-    hUpdtToolsCustomizeToolbars()
-    
-    '///+<li>Look at the Events-Tabpage</li>
-    hUpdtToolsCustomizeEvents()
-    
-    '///+<li>Close Tools Customize</li>
-    brc = hToolsCustomizeClose( CANCEL_BUTTON )
-    
-    '///+<li>Close the document</li>
-    brc = hDestroyDocument
-    
-    '///</ul>
-    
 endcase
 
 '*******************************************************************************
     '///+<li>Click the Menu List-Button</li>
     printlog( CFN & "Click the menu listbutton" )
     kontext "TabCustomizeMenu"
-    MenuBtn.click()
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
     
     '///+<li>Select the first entry (Move...) to open the Menu Organiser</li>
     printlog( CFN & "Select Move..." )
     '///+<li>Click the Menu List-Button</li>
     printlog( CFN & "Click the menu listbutton" )
     kontext "TabCustomizeMenu"
-    MenuBtn.click()
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
     
     '///+<li>Select the second entry (Rename...) to open the Rename dialog</li>
     printlog( CFN & "Select Rename..." )
     '///+<li>Click the Menu List-Button</li>
     printlog( CFN & "Click the menu listbutton" )
     kontext "TabCustomizeMenu"
-    MenuBtn.click()
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
     
     '///+<li>Select the third entry (Delete) to delete the new menu<br>
     '///+Note that there will be no warning as the menu is empty</li>
     '///+<li>Access the &quot;Toolbar&quot;-Button and rename the toolbar</li>
     printlog( CFN & "Rename the toolbar via Toolbar-Button" )
     kontext "TabCustomizeToolbars"
-    MenuBtn.click()
-    waitslot
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
+    
+    printlog( "Select rename" )
     hMenuSelectNr( 1 )
     
     '///+<li>Cancel the renaming-dialog</li>
     '///+Note that there will be no deletion warning</li>
     printlog( CFN & "Delete the toolbar via Toolbar-Button" )
     kontext "TabCustomizeToolbars"
-    MenuBtn.click()
-    waitslot
+    hOpenMenuButton( MenuBtn ) ' MenuBtn.OpenMenu()
+    
+    printlog( "Select delete" )
     hMenuSelectNr( 2 )
        
     '///+<li>Click the &quot;Add Commands...&quot; button</li>
     endif
     
     '///+<li>Click &quot;Down&quot;</li>
-    WaitSlot()
     printlog( CFN & "Down..." )
     if ( BtnDown.isEnabled() ) then
         BtnDown.click()
 
 end function
 
+'*******************************************************************************
 
+function hOpenMenuButton( oControl as object ) as integer
+
+    ' This function is very evil.
+    ' It was written to hopefully workaround the infamous menubutton which is a button 
+    ' that - when clicked - opens a menu. This feature is shaky and depends on 
+    ' a lot of factors. There is a simple working implemantation in t_menu.inc 
+    ' which has the drawback of being absolutely slow, costing the tools_customize
+    ' test a lot of time waiting for the control (30% of testtime spent waiting).
+    ' This approach tries to be dynamic: Machines that can do it the fast way
+    ' use it automatically, machines that are too slow get two retries with the 
+    ' slower approach.
+    ' The menubutton is one of the last remaining places where none of the
+    ' speed optmizations and enhancements apply, so neither WaitSlot() nor 
+    ' synchronous slot execution help here.
+
+    dim iClick as integer
+    dim bUseSlowMethod as boolean : bUseSlowMethod = false
+    
+    const CFN = "hOpenMenuButton: "
+    
+    hOpenMenuButton() = -1 ' this is the general failure returnvalue
+    
+    for iClick = 1 to 3
+    
+        if ( bUseSlowMethod ) then 
+            wait( 1000 )
+            oControl.OpenMenu()
+            wait( 3000 )
+        else
+            oControl.click()
+        endif
+            
+        try
+            hOpenMenuButton() = MenuGetItemCount
+            printlog( CFN & "Success on " & iClick & ". attempt" )
+            exit function
+        catch
+            qaerrorlog( CFN & "#i96753 - Failed to retrieve itemcount from Menu-/Command-button" )
+            bUseSlowMethod = true
+        endcatch
+        
+    next iClick
+    
+end function
+
+'*******************************************************************************
+
+function hClickCommandButton( iItemToClick as integer ) as boolean
+
+    const CFN = "hClickCommandButton::"
+    printlog( CFN & "Enter" )
+    
+    dim brc as boolean 'a multi purpose boolean returnvalue
+    dim iMenuItems as integer
+
+    iMenuItems = hOpenMenuButton( Command )
+    
+    ' exit on error
+    if ( iMenuItems < 0 ) then
+        warnlog( CFN & "Menu apparently not open, giving up." )
+    	hClickCommandButton() = false
+    	exit function
+    endif        
+    
+    hMenuSelectNr( iItemToClick ) 
+    wait( 500 )
+    ' check for the rename dialog (menu)
+    kontext "CustomizeMenuReName"
+    if ( CustomizeMenuReName.exists() ) then
+    	printlog( CFN & "Opened dialog: Rename Menu" )
+    	hClickCommandButton() = true
+    	exit function
+    endif
+    
+    ' check for the rename dialog (toolbar)    
+    kontext "CustomizeToolbarsRename"
+    if ( CustomizeToolbarsRename.exists() ) then
+    	printlog( CFN & "Opened dialog: Rename Toolbar" )
+    	hClickCommandButton() = true
+    	exit function
+    endif
+
+    printlog( CFN & "Exit" )
+    hClickCommandButton() = true
+
+end function

testautomation/framework/tools/includes/customize_tools.inc

     const CFN = "hDeselectSeparator::"
     
     kontext "ToolsCustomizeToolbars"
-    iCurrentItem = ToolbarContents.getSelIndex()
-    cString = ToolbarContents.getSelText()
+    if ( ToolbarContents.getItemCount > 0 ) then
     
-    '///+<li>Check whether the selected item contains a number of minus-chars (---)</li>
-    if ( instr( cString , "----" ) ) then
-    
-        '///+<li>If we are at the beginning of the list: Move up</li>
-        if ( iCurrentItem = 1 ) then
-            irc = 2
-            ToolbarContents.select( irc )
-            printlog( CFN & " Moved away from separator (up)" )
-        else
-        '///+<li>If we are somewhere else in the list, move down</li>
-            irc = iCurrentItem - 1
-            ToolbarContents.select( irc )
-            printlog( CFN & " Moved away from separator (down)" )
+        iCurrentItem = ToolbarContents.getSelIndex()
+        cString = ToolbarContents.getSelText()
+        
+        '///+<li>Check whether the selected item contains a number of minus-chars (---)</li>
+        if ( instr( cString , "----" ) ) then
+        
+            '///+<li>If we are at the beginning of the list: Move up</li>
+            if ( iCurrentItem = 1 ) then
+                irc = 2
+                ToolbarContents.select( irc )
+                printlog( CFN & " Moved away from separator (up)" )
+            else
+            '///+<li>If we are somewhere else in the list, move down</li>
+                irc = iCurrentItem - 1
+                ToolbarContents.select( irc )
+                printlog( CFN & " Moved away from separator (down)" )
+            endif
+            
         endif
-        
+    else
+        irc = 0
     endif
     
     hDeselectSeparator() = irc
     
 end function
 
-
 '*******************************************************************************
 
-function hClickCommandButton( iItemToClick as integer ) as boolean
-
-
-    '///<h3>Click a given entry on the command button</h3><br>
-
-    '///<u>Parameter(s):</u><br>
-    '///<ol>
-
-    '///+<li>Position of the item to click (Integer)</li>
-    '///<ul>
-    '///+<li>Only active items are selectable</li>
-    '///+<li>Position must be &gt; than 0 and &le; number of active items in menu</li>
-    '///+<li>Set context (kontext) before calling this function</li>
-    '///</ul>
-
-    '///</ol>
-
-
-    '///<u>Returns:</u><br>
-    '///<ol>
-    '///+<li>Success or failure (Boolean)</li>
-    '///<ul>
-    '///+<li>TRUE on success</li>
-    '///+<li>FALSE on failure or unknown status</li>
-    '///</ul>
-    '///</ol>
-
-    const CFN = "hClickCommandButton::"
-    printlog( CFN & "Enter" )
-    
-    dim brc as boolean 'a multi purpose boolean returnvalue
-    dim iMenuItems as integer
-
-    '///<u>Description:</u>
-    '///<ul>
-    '///+<li>Click the command button</li>
-    command.click()
-    
-    '///+<li>Verify that the menu is open</li>
-    try
-	    iMenuItems = hMenuItemGetCount()
-	catch
-		qaerrorlog( CFN & "Menu not open" )
-		hClickCommandButton() = false
-		exit function
-    endcatch
-    
-    '///+<li>Verify that the selected menuitem is valid</li>
-    printlog( CFN & "Found items: " & iMenuItems )
-    if ( iItemToClick > iMenuItems ) then
-    	warnlog( CFN & "#i90134# Selected item is not available: " & iItemToClick )
-		hClickCommandButton() = false
-		exit function
-    endif
-    
-    '///+<li>Now click on the requested item</li>
-    hMenuSelectNr( iItemToClick )
-    
-    '///+<li>Look for the Menu renaming dialog</li>
-    kontext "CustomizeMenuReName"
-    if ( CustomizeMenuReName.exists( 1 ) ) then
-    	printlog( CFN & "Opened dialog: Rename Menu" )
-    	hClickCommandButton() = true
-    	exit function
-    endif
-    
-    '///+<li>Look for the Toolbar renaming dialog</li>
-    kontext "CustomizeToolbarsRename"
-    if ( CustomizeToolbarsRename.exists() ) then
-    	printlog( CFN & "Opened dialog: Rename Toolbar" )
-    	hClickCommandButton() = true
-    	exit function
-    endif
-    '///</ul>
-
-    printlog( CFN & "Exit" )
-    hClickCommandButton() = true
-
-end function

testautomation/global/tools/includes/required/t_dir.inc

     '/// Get Subdirectories from a directory and append them to a list (<b>with</b> path)
     '/// <u>Input</u>: Directory with complete path; Search Pattern, e.g *; List
     '/// <u>Return</u>: count of appended entries; updated list
-    Dim Count%
-    Dim i as Integer
-    Dim Verzeichnis as String
+    Dim iFolderCount as integer
+    Dim Folder as String
     ' at the end of the string has to be teh path seperator, else the dir-command doesn't work
     if right ( sPath$, 1 ) <> gPathSigne then sPath$ = sPath$ + gPathSigne
-    Verzeichnis = app.Dir( sPath$ + sMatch$ , 16)
-    Count% = 0
+    Folder = app.Dir( sPath$ + sMatch$ , 16)
+    iFolderCount = 0
 
-    do until Len(Verzeichnis) = 0
-        if Verzeichnis <> "." AND Verzeichnis <> ".." AND Lcase(Verzeichnis) <> ".svn" then
+    do until Len( Folder ) = 0
+        select case ( lcase( Folder ) )
+        case "."
+        case ".."
+        case ".svn"
+        case ".hg"
+        case default
             lsFile(0) = Val(lsFile(0)) + 1
-            lsFile( lsFile(0) ) = sPath$  + Verzeichnis + gPathSigne
-            Count% = Count% + 1
-        end if
-        Verzeichnis = app.Dir
+            lsFile( lsFile(0) ) = sPath$  + Folder + gPathSigne
+            iFolderCount = iFolderCount + 1
+        end select
+        Folder = app.Dir
     loop
-    GetDirList = Count%
+    GetDirList = iFolderCount
 end function
 '
 '-------------------------------------------------------------------------------
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.