Handling Confirmations, Alerts and Prompts in QaSCRIBE
Handling Confirmations
Confirmations are dialogs that are shown by a Web application to provide user with some information and prompt them to pick between two option - usually OK and Cancel.To illustrate how we automate handling Confirmations, let us consider a sample applications that shows a Confirmation and asks the user to click on either OK or Cancel buttons. The application then echoes the choice made by the user.
On the screen below click the 'Try it' button:
http://www.eureqatest.com:9191/ConfirmationStart_zpsfc33bc2e.jpg
The Confirmation dialog is shown as follows:
http://www.eureqatest.com:9191/ConfirmationDialog_zps54b17a0d.jpg
When you click on OK, the application echoes your choice:
http://www.eureqatest.com:9191/ConfirmationOK_zpsb5436527.jpg
If you click on Cancel instead the application shows:
http://www.eureqatest.com:9191/ConfirmationCancel_zpsa09d6b08.jpg
Automating in QaSCRIBE
You can automate choosing OK using the following script
http://www.eureqatest.com:9191/ConfirmationOKQaSCRIBE_zps35a93bcc.jpg
The command chooseOkOnNextConfirmation tells QaSCRIBE to automatically select OK when the next confirmation dialog is presented. The assertConfirmation command compares the text displayed on the dialog with the text shown in the Target field for the command.
Note: If the assertConfirmation fails, the test execution will stop. If you want the test to continue you can use verifyConfirmation instead.
To automate choosing Cancel replace chooseOkOnNextConfirmation with chooseCancelOnNextConfirmation as shown below
http://www.eureqatest.com:9191/ConfirmationCancelQaSCRIBE_zps65b9ae66.jpg
Note: If the assertConfirmation fails, the test execution will stop. If you want the test to continue you can use verifyConfirmation instead.
Handling Alerts
Alerts are a special case of Confirmation dialog where the user is being alerted to some information by the Web application. The information is presented in a dialog and the user has to select OK to accept the alert.
To illustrate how we automate handling alerts, let us consider a sample application that shows the alert dialog shown below:
http://www.eureqatest.com:9191/AlertDialog_zps3919a868.jpg
Clicking on the OK button will remove the alert.
Automating in QaSCRIBE
You can automate handling this alert in QaSCRIBE as follows:
http://www.eureqatest.com:9191/AlertQaSCRIBE_zps3f056faa.jpg
Note: If the assertAlert fails, the test execution will stop. If you want the test to continue you can use verifyAlert instead.
Handling Prompts
Prompts are a special case of Confirmation dialog where the user has to enter information into one or more fields and select ‘OK’ or ‘Cancel’.
To illustrate how we automate handling prompts, let us consider a sample application that prompts the user to enter some text and then echoes the data entered by the use.
On the screen below click the ‘Try it’ button:
http://www.eureqatest.com:9191/PromptStart_zpsd305fa1d.jpg
The prompt appears as follows:
http://www.eureqatest.com:9191/PromptDataEntry_zps6c195f0e.jpg
Enter a name (e.g. Worksoft SaaS) and click 'OK' to accept the entered data. You will see the following screen.
http://www.eureqatest.com:9191/PromptSubmissionOK_zpsbd2e0764.jpg
Automating in QaSCRIBE
The sample application shown above is automated in QaSCRIBE using the following commands:
http://www.eureqatest.com:9191/PromptOKQaSCRIBE_zps3569d006.jpg
Note that in this script you ask QaSCRIBE to enter the text Worksoft SaaS when a prompt appears the next time. The command ‘answerOnNextPrompt’ has to be called prior to clicking on the button ‘Try it’ in the application that triggers the prompt.
If however you wish to click ‘Cancel’ on the prompt (i.e. not enter any data into the field shown), you can do so using the following script:http://www.eureqatest.com:9191/PromptQaSCRIBECancel_zps6f4911d1.jpg
In this script, you are telling QaSCRIBE that you do not want to answer the prompt with anything.