Advanced Commands Support

 

Note: To use QAS existing projects, first import the projects into QAS and then use them.

Alert Handling methods

Alerts are modal windows that pop up on the UI with a dialog and relevant message on them. The focus shifts from the current screen to the pop-up, which compels the user to first act on it before performing any other actions or accessing other parts on the web page. Users need to accept/reject/confirm the pop-up to proceed further on the web page.

QAS supports the following types of Web/Javascript /Browser-based Alerts.

  • Simple Alert

  • Prompt Alert

  • Confirmation Alert

 

QAS handles such alerts through the following methods. You need to enter the alert commands manually in the test case to handle the alerts and accept/reject/confirm the pop-ups.

  • Accept Alert: This method is used to confirm an action performed by the users. When users need to click on the OK button of an alert pop-up.

  • Dismiss Alert: This method is used to ask the user to cancel something. When users need to click on the Cancel button of an alert pop-up.

  • Get Alert Text: This method is used to get displayed the text of an alert pop-up.

  • Set Alert Text: This method is used to type text into an alert pop-up e.g. “regression”.

  • Verify Alert Not Present: This method is used to verify if the alert is not present in the defined time in milliseconds.

  • Verify Alert Present: This method is used to verify if the alert is present in the defined time in milliseconds.

  • Wait for Alert: This method is used to wait for an alert to present in the defined time in milliseconds.

 

 

Get Alert Text

The 'Get Alert Text' command value text can be stored in a variable and that variable can be reused for verification and assertion from the recorder and CI/CD.

QAS provides an option to store the alert text in a variable, which can then be reused further in the execution of subsequent steps/test cases to verify the existence of the alert text. Users can replace the stored parameter value in their execution from UI which will be then referred to in the subsequent calls. The feature helps users store the alert text value and use the same to verify the alert in the further execution from Test Recorder. The variable will replace the exact value that has been stored.

For example, the value of Get Alert Text can be stored and used at run time to verify the existence of the alert while execution.

Steps

1. Record a test case.

 

2. On the page, click on the button to see and store the alert.

3. Then right-click on the page, point to QAS Recorder and select the Get Alert Text option.

 

4. Perform the next test steps.

5. Now stop the recording and go to the recorded test case. In the recorded test case, replace the text with the saved variable name in the syntax:

${variablename}

6. Once you are done with replacing the text with the variable name, execute the test case.

Note: In the case of test suite level execution, the feature works only with Multiple session Execution Mode wherein the test cases will execute sequentially.

Replace a Stored Value

QAS provides options to store a value, text or title in a variable for all platforms testing so that the user can use it further in the execution of subsequent steps. Users can replace the stored parameter value in their execution from UI which will be then referred to in the subsequent calls. The feature helps users store any value and use the same in further execution from Test Recorder.

These options are available while recording a test case: Store Text, Store Title, Store Value. The variable will replace the exact value that has been stored.

For example, the value of credentials can be stored and used at run time to avoid session time-out errors while execution.

Here, is an example of the Web platform.

Steps

1. Record a test case.

2. On the page, select the text that you want to store and right-click on it. Point to QAS Recorder and select the Store Value option.

 

The QAS Recorder pop-up opens.

3. Give a variable name to store the selected text on the page.

4. In the recorded test case, replace the text with the saved variable name in the syntax:

${variablename}

5. Once you are done with replacing the text with the variable name, execute the test case.

On the execution result screen, you can see the test is executed with the saved variable.

 

Here, is an example of the Android platform.

Steps

1. Record a test case.

  • Click on the element.

  • The relevant locator is displayed in the drop-down above.

  • Select the Store Value or Store Text Event for the locator from the drop-down and click on the Apply button.

2. Give a variable name to store the selected text on the page.

The event is recorded in the App Source.

3. In the recorded test case, replace the text with the saved variable name in the syntax:

${variablename}

4. Once you are done with replacing the text with the variable name, execute the test case.

View Test Case Variables

Test Case Variables display only assertions defined in the test cases across all the test suites. The variable list is displayed at the test suite level for all the test cases under all the test suites. It helps users track the variables used in the test cases.

Steps

1. On the Test Suite level, click on the more option and select Test Case Variables.

 

It opens the Test Case Variables screen with the list of variables that have been used in the test cases. If the list is long, you can also search for a particular text from the columns using the search box.

2. The Variable Names are clickable. To view the details of a particular variable, click that variable.

 

 

It navigates you to the test case command where the variable is used.

 

JavaScript Execution Commands

QAS supports the Java Script and Async Java Script Execution commands. Users can use their custom control commands written in Java Script to execute on the current browser window. For example, if you have some Java Script commands written by you. You can put your Java Script in the test case and it will be executed on the browser.

A separate Java Script editor is provided for the ease of writing the script. It also validates the script before saving it, which saves test case failure incidences.

 

 

 

On the recorded steps insert the following types of JavaScript commands in accordance with your test scenarios.

  • Execute Java Script: This command executes the JavaScript that is manually provided in the Input field.

  • Execute Async Java Script: This command waits for the Java Scripts to get executed for a duration of time (milliseconds) provided by users.

Examples:

Command

Sample Code/Input

Command

Sample Code/Input

Execute Java Script

1 2 3 window.scrollBy(0,60000) history.go(0) window.open("URL")

Execute Async Java Script

1 window.setTimeout(arguments[arguments.length - 1], 5000);

 

Test Recorder Report

The commands are also displayed under Test Data in the report.