diff options
Diffstat (limited to 'testautomation/framework/tools/includes/wizards.inc')
-rwxr-xr-x | testautomation/framework/tools/includes/wizards.inc | 322 |
1 files changed, 0 insertions, 322 deletions
diff --git a/testautomation/framework/tools/includes/wizards.inc b/testautomation/framework/tools/includes/wizards.inc index 274d862a8520..380f84141d34 100755 --- a/testautomation/framework/tools/includes/wizards.inc +++ b/testautomation/framework/tools/includes/wizards.inc @@ -31,328 +31,6 @@ '* '\****************************************************************************** -function hOpenWizardWithMenu( cType as string ) as integer - - const CFN = "hOpenWizardWithMenu::" - - '///<h3>Open a wizard via menu</h3> - '///<i>Starting point: Any plain document</i><br> - '///<i>Uses: framework/tools/input/menuentries.txt</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Name of Wizard (string). Known Wizards are:</li> - '///<ul> - '///+<li>"LETTER"</li> - '///+<li>"FAX"</li> - '///+<li>"AGENDA"</li> - '///+<li>"PRESENTATION"</li> - '///+<li>"WEBPAGE"</li> - '///+<li>"DOCCONV"</li> - '///+<li>"EUROCONV"</li> - '///+<li>"ADDRESS"</li> - '///+<li>"MAILMERGE"</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcode (integer)</li> - '///<ul> - '///+<li>0: The expected wizard is open</li> - '///+<li>1: No wizard is open</li> - '///+<li>2: The incorrect wizard is open</li> - '///+<li>3: The requested wizard is unknown to this function</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - dim iMainMenuPosition as integer ' position in the main menu - dim iMenuPosition as integer ' the position of the menuentry - dim iWizardMenuPosition as integer ' the position of the wizards menu - dim iWizardID as integer ' a unique number to identify the wizard - dim iWait as integer ' time of the wizard to open - dim iOpen as integer ' identifier for the open dialog - dim brc as boolean ' some multi purpose boolean returnvalue - - hOpenWizardWithMenu() = 0 - - '///+<li>find out where in the menustructure the wizards are located</li> - printlog( "Requested Wizard: " & cType ) - iWizardID = hGetWizardParams( cType , "ID" ) - iMainMenuPosition = hGetWizardParams( cType , "MAIN" ) - iMenuPosition = hGetWizardParams( cType , "SUB" ) - iWizardMenuPosition = 4 ' This is the "Wizards" menuentry below "File" - - try - kontext "DocumentWriter" - hUseMenu() - - '///+<li>Open the 'File' menu</li> - printlog( CFN & "Open Menu at pos " & iMainMenuPosition ) - hMenuSelectNr( iMainMenuPosition ) - WaitSlot( 2000 ) - - '///+<li>if we are in the filemenu the wizards are below a submenu</li> - if ( iMainMenuPosition = 1 ) then - printlog( CFN & "Select wizards-submenu at pos " & iWizardMenuPosition ) - hMenuSelectNr( iWizardMenuPosition ) - WaitSlot( 2000 ) - else - printlog( CFN & "Wizard is not in File-Menu" ) - endif - - '///+<li>try to click the menuentry where we expect the wizard</li> - printlog( CFN & "Select " & cType & " wizard at pos " & iMenuPosition ) - hMenuSelectNr( iMenuPosition ) - WaitSlot( 2000 ) - brc = true - catch - ' we end up here, when the menuitems could not be accessed - printlog( CFN & "Error accessing menuentry for wizard" ) - hOpenWizardwithMenu() = 1 - brc = false - endcatch - - if ( not brc ) then - printlog( CFN & "Trying to open wizard using the slot" ) - select case iWizardId - case 1 : FileAutopilotLetter - case 2 : FileAutopilotFax - case 3 : FileAutopilotAgenda - case 4 : FileAutopilotPresentation - end select - endif - - '///+<li>wait for a wizard to open, iOpen is the number of the menuitem</li> - iOpen = hWaitForWizard() - - '///+<li>Verify that the correct wizard is open. iOpen should match iMenuPosition</li> - ' This works because the menu-positions are unique. BEWARE! - if ( iOpen <> iWizardID ) then - - qaerrorlog( CFN & "Incorrect Wizard is open, did the menu-order change?" ) - - hFinishWizard( 2 ) - hOpenWizardWithMenu() = 2 - - else - - hOpenWizardWithMenu() = 0 - - endif - '///</ul> - -end function - -'******************************************************************************* - -function hFinishWizard( iMode as integer ) as boolean - - const CFN = "hFinishWizard::" - - '///<h3>Finish or cancel a wizard</h3> - '///<i>Starting point: Any known wizard must be open</i><br> - '///<i>If several wizards are open at the same time the outcome is undefined</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Closing method (integer). Valid options are:</li> - '///<ul> - '///+<li>1: Click Finish-Button</li> - '///+<li>2: Click Cancel-Button</li> - '///+<li>3: Use Accelerator for Finish-Button</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Errorcode (boolean)</li> - '///<ul> - '///+<li>TRUE: If everything is ok</li> - '///+<li>FALSE: On any error (including incorrect function parameters)</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - '///+<li>Handle possible errors when invoking this function</li> - if ( ( iMode < 1 ) or ( iMode > 3 ) ) then - printlog( CFN & "Invalid iMode = " & iMode ) - hFinishWizard() = false - exit function - endif - - dim cAccel as string - dim iWait as integer - dim brc as boolean : brc = false - - - '///+<li>Try to close the wizard</li> - for iWait = 1 to 5 - - Kontext "AutopilotLetter" - if ( AutopilotLetter.exists() ) then - select case iMode - case 1 : hWaitForObject( FinishButton, 3000 ) : FinishButton.click() - case 2 : AutopilotLetter.cancel() - case 3 : cAccel = hGetAccel( "Finish_Wizard" ) - AutopilotLetter.typeKeys( cAccel ) - end select - brc = true - exit for - endif - - Kontext "AutopilotFax" - if ( AutopilotFax.exists() ) then - select case iMode - case 1 : hWaitForObject( FinishButton, 3000 ) : FinishButton.click() - case 2 : AutopilotFax.cancel() - case 3 : cAccel = hGetAccel( "Finish_Wizard" ) - AutopilotFax.typeKeys( cAccel ) - end select - brc = true - exit for - endif - - Kontext "AutopilotAgenda" - if ( AutopilotAgenda.exists() ) then - select case iMode - case 1 : hWaitForObject( createButton, 3000 ) : createButton.click() - case 2 : hWaitForObject( cancelButton, 3000 ) : cancelButton.click() - case 3 : cAccel = hGetAccel( "Finish_Wizard" ) - AutopilotAgenda.typeKeys( cAccel ) - end select - brc = true - exit for - endif - - Kontext "MailMergeWizard" - if ( MailMergeWizard.exists() ) then - select case iMode - case 1 : MailMergeWizard.OK() - case 2 : MailMergeWizard.Cancel() - case 3 : cAccel = hGetAccel( "Finish_Wizard" ) - MailMergeWizard.typeKeys( cAccel ) - end select - brc = true - exit for - endif - - Kontext "AutopilotPraesentation3" - if ( AutopilotPraesentation3.exists() ) then - select case iMode - case 1 : AutopilotPraesentation3.OK() - case 2 : AutopilotPraesentation3.Cancel() - case 3 : cAccel = hGetAccel( "Finish_Wizard" ) - AutopilotPraesentation3.typeKeys( cAccel ) - end select - brc = true - exit for - endif - - Kontext "AutoPilotEuroKonverter" - if ( AutoPilotEuroKonverter.exists() ) then - select case iMode - case 1 : hWaitForObject( Konvertieren, 3000 ) : Konvertieren.click() - case 2 : hWaitForObject( abbrechen , 3000 ) : abbrechen.click() - case 3 : cAccel = hGetAccel( "Finish_Wizard" ) - AutoPilotEuroKonverter.typeKeys( cAccel ) - end select - brc = true - exit for - endif - - next iWait - - '///+<li>Verify that no wizard is open anymore</li> - if ( brc ) then - printlog( CFN & "Closed wizard" ) - hFinishWizard() = true - else - qaerrorlog( CFN & "No (known) wizard is present to be closed" ) - hFinishWizard() = false - endif - '///</ul> - -end function - -'******************************************************************************* - -function hGetWizardParams( cType as string, cParam as string ) as integer - - const CFN = "hGetWizardParams::" - - '///<h3>Retrieve the location of a wizard in the menu</h3> - '///<i>Uses: framework/tools/input/menuentries.txt</i><br> - '///<i>Refer to inline documentation for further information</i><br> - '///<u>Input</u>: - '///<ol> - '///+<li>Name of Wizard (string). Valid options are:</li> - '///<ul> - '///+<li>"LETTER"</li> - '///+<li>"FAX"</li> - '///+<li>"AGENDA"</li> - '///+<li>"PRESENTATION"</li> - '///+<li>"WEBPAGE"</li> - '///+<li>"DOCCONV"</li> - '///+<li>"EUROCONV"</li> - '///+<li>"ADDRESS"</li> - '///+<li>"MAILMERGE"</li> - '///</ul> - '///+<li>Menu Position (string). Valid options are:</li> - '///<ul> - '///+<li>"ID" - This is a unique id for the wizard</li> - '///+<li>"MAIN" - Main menu position (e.g. "File"</li> - '///+<li>"SUB" - Position below main menu</li> - '///</ul> - '///</ol> - '///<u>Returns</u>: - '///<ol> - '///+<li>Position of a menu entry (integer)</li> - '///<ul> - '///+<li>0: Invalid function parameter</li> - '///+<li>1-n: Position of the item in the menu</li> - '///</ul> - '///</ol> - '///<u>Description</u>: - '///<ul> - - dim iParam as integer - - dim cInputArray( 200 ) as string - dim iArraySize as integer - - dim cFile as string - cFile = gTesttoolPath & "framework\tools\input\menuentries.txt" - cFile = convertpath( cFile ) - - '///+<li>Lowercase all function parameters</li> - cType = ucase( cType ) - cParam = ucase( cParam ) - - '///+<li>Read in the section containing the waizard parameters</li> - '///+<li>Retrieve the requested value from the section</li> - iArraySize = hGetDataFileSection( cFile , cInputArray() , ctype , "" , "" ) - if ( iArraySize = 3 ) then - - select case cParam - case "ID" - iParam = hGetValueForKeyAsInt( cInputArray() , "iWizardId" ) - case "MAIN" - iParam = hGetValueForKeyAsInt( cInputArray() , "iMainMenuPosition" ) - case "SUB" - iParam = hGetValueForKeyAsInt( cInputArray() , "iMenuPosition" ) - end select - - hGetWizardParams() = iParam - else - qaerrorlog( CFN & "hGetDataFileSection returned invalid data" ) - hGetWizardParams() = 0 - endif - '///</ul> - -end function - -'******************************************************************************* - function hWaitForWizard() as integer const CFN = "hWaitForWizard::" |