Waits for Browser or App Actions

Document created by DPM Admin Employee on Jul 21, 2017Last modified by Dave Murphy on Sep 26, 2017
Version 2Show Document
  • View in full screen mode

SOASTA provides user-configurable waits that a Web page or mobile app test might require that are not covered by the built-in waits. These waits are what allow you to test dynamic asynchronous resources in a given test. For example, a Web page might show a loading animation while it is accessing a database to collect content that it will soon display on the page. When the content is available, it hides the loading indicator and displays the content. You can add a post-action wait to the command that initiated the database access to wait for the loading indicator to not be visible and then validate that the content is correct.

Waits are commands that tell CloudTest not to execute an action until a condition is met (pre-action waits), or to not continue processing the outputs, validations, and property sets of that action until a condition is met (post-action waits). These built-in waits occur in both browser actions and app actions (depending upon the nature of the given action).

Built-in waits

Some actions have built-in pre-action or post-action waits. For example, a click action that clicks on a button in a Web page has a built-in pre-action wait that waits for the button to be present before it can be clicked upon. Built-in waits are listed in the Info Window and in the lower panel Action Editor with the "builtin-" prefix.

Note:  In this section screenshots show the Clip Editor lower-panel, Action Editor. In the subsequent sections, they are shown in the Clip Editor, List view.

A refresh action has a built-in waitForPageToLoad that waits for the browser to finish reloading the page before continuing on to the next action.

A click action that clicks on a link in a Web page has both a built-in pre-action and a built-in post-action wait. The pre-action wait waits for the link to be present and the post-action wait waits for the new page to load.

Built-in pre- and post-action waits can be disabled, but they cannot be removed or changed. To disable a pre-action wait, uncheck the checkbox located next to the Command field.

The amount of time to wait for the condition to be met is the Timeout value and it is entered in milliseconds. The default timeout value to use for all waits is specified in the target and has a default value of 60 seconds. Some wait commands such as the waitForPageToLoad allow you to override the default timeout in the Browser Action editor. This allows us to set performance criteria for a test. In this example, we write an error to the result if the page takes longer than 20 seconds to load.

When the condition of a wait command is not met within the specified timeout period, a timeout occurs. Timeouts are errors in the test. You can choose to cause the test to stop running when a timeout occurs or to simply have the timeout error recorded in the Result, allowing the test to continue. The default action for wait timeouts is to halt the Test Composition. Click the drop-down next to Timeout Action in order to change the selection to Record in Results Only.

Adding Pre-Waits in List View

  1. Click the arrow to expand and then in the Expanded view, use the mouse to hover over the clip element.
  2. Click the Pre-Wait Pre-Wait iconicon on the Add toolbar.

When you do so, a new pre-wait form is added.

  1. The Command drop-down presents the list of available waits. Subsequent parameters depend upon the wait selection made here. Select a wait from the Command drop-down and enter the information required by the wait form presented.
    • Enter a new locator or click the Property icon to select from among available property values using the ISSE Editor

    • For those waits that take a locator, you can also use the Locator icon to enter Touch Locator mode. Note that the Locator icon is only active while in record mode.

In another example, the waitForAppInternalValue shown below takes a Value to Access, Arguments, as well as a pattern match, and the obligatory Timeout Action (shown below with a Post-Wait).

    • Where required, specify a pattern to match.

Many waits compare text by matching the pattern of some text on the page in order to determine if that page is correct. The following pattern match types are offered:

  • Exact Match – matches against the string exactly
  • Glob – matches against a pattern using Java glob notation. A glob is a limited regular expression pattern. In a glob pattern, * represents any sequence of characters, and ? represents any single character. Many personal computer users are familiar with globs through file matching expressions such as "*.jpg.*
  • Regular Expression – matches against a regular expression using Java regular expression notation.

Note:  CloudTest script authors should note that the Regular expressions within a CloudTest script (via the RegExp object or the /pattern/ notation) are JavaScript regular expressions. These JavaScript regular expression versions differ in important ways and the two are not interchangeable, so expressions cannot be copied from a CloudTest script to an include/exclude for pages, to a session template, or to a Wait, Property Set, or Validation, and vice versa.

  • Script – matches against a value specified by a script.
  1. Specify a timeout action (or accept the default Record in Results Only). The Timeout Action drop-down specifies what timeout action to take when the wait condition is not met.
    • If the timeout action is set to Record in Results Only, the wait outcome will be recorded in the result, and the test composition will continue whether the wait passes or fails.
    • If the timeout action is set to Fail the Clip, the test composition will stop if the wait fails.
    • If the timeout action is set to Honor the (Browser or App) Action, the wait inherits the parent setting from the action.

Editing Expanded Pre-Waits

A pre-wait tells CloudTest not to execute an action until a condition is met. Pre-action waits are identified in the expanded clip element by the Pre-Wait Pre-Wait icon icon.

  1. Locate the Pre-Wait Pre-Wait icon icon and expand the wait to examine its attributes.

    • Enter a new locator or click the Property icon to select from among available property values using the ISSE Editor.

    • For those waits that take a locator, you can also use the Locator icon to enter Touch Locator mode. Note that the Locator icon is only active while in record mode.

Refer to Touch Locator for Mobile Apps for the steps to enter Locator mode on the target device.

Adding a Post-Wait

  1. In the Expanded view, use the mouse to hover over the clip element.
  2. Click the Post-Wait  icon on the Add toolbar.

When you do so, a new post-wait form is added.

The Command drop-down presents the list of available waits. Subsequent parameters depend upon the wait selection made here. For example, the default waitForElementPresent above takes a locator. A locator is used to identify a specific element or object for the given action. It may be the name of an element on the page such as submitButton. or a piece in a chess game, such as classname=PieceImageView[13].

  1. Select a wait from the Command drop-down and enter the information required by the wait form presented.

In another example, the waitForAppInternalValue takes a Value to Access, and Arguments, as well as a pattern match, and the obligatory Timeout Action.

Many waits compare text by matching the pattern of some text on the page in order to determine if that page is correct. The following pattern match types are offered:

 

  • Where required, specify a pattern to match.
  • Exact Match – matches against the string exactly
  • Glob – matches against a pattern using Java glob notation. A glob is a limited regular expression pattern. In a glob pattern, * represents any sequence of characters, and ? represents any single character. Many personal computer users are familiar with globs through file matching expressions such as "*.jpg.*
  • Regular Expression – matches against a regular expression using Java regular expression notation.

Note:  CloudTest script authors should note that the Regular expressions within a CloudTest script (via the RegExp object or the /pattern/ notation) are JavaScript regular expressions. These JavaScript regular expression versions differ in important ways and the two are not interchangeable, so expressions cannot be copied from a CloudTest script to an include/exclude for pages, to a session template, or to a Wait, Property Set, or Validation, and vice versa.

  • Script – matches against a value specified by a script.
  1. Specify a timeout action (or accept the default Record in Results Only).

The Timeout Action drop-down specifies what timeout action to take when the wait condition is not met.

    • If the timeout action is set to Record in Results Only, the wait outcome will be recorded in the result, and the test composition will continue whether the wait passes or fails.
    • If the timeout action is set to Fail the Clip, the test composition will stop if the wait fails.

If the timeout action is set to Honor the (Browser or App) Action, the wait inherits the parent setting from the action.

  • Exact Match – matches against the string exactly
  • Glob – matches against a pattern using Java glob notation. A glob is a limited regular expression pattern. In a glob pattern, * represents any sequence of characters, and ? represents any single character. Many personal computer users are familiar with globs through file matching expressions such as "*.jpg.*
  • Regular Expression – matches against a regular expression using Java regular expression notation.

Note:  CloudTest script authors should note that the Regular expressions within a CloudTest script (via the RegExp object or the /pattern/ notation) are JavaScript regular expressions. These JavaScript regular expression versions differ in important ways and the two are not interchangeable, so expressions cannot be copied from a CloudTest script to an include/exclude for pages, to a session template, or to a Wait, Property Set, or Validation, and vice versa.

  • Script – matches against a value specified by a script.

Editing a Post-Wait

  1. In the Expanded list view, use the mouse to hover over the action.

  1. Locate the post-wait and expand its attributes.
    • Check Enable to edit the form. Enable or disable the post-wait, enter a new locator (or use the Touch Locator tool to do so)
    • For those waits that take a locator, you can use the Locator icon to enter Touch Locator mode.

Attachments

    Outcomes