Using Precursor Tasks
Introduction
Precursor tasks are tasks that are performed by the automation browser prior to the steps of the main task. Typically, a precursor task is a flow with 2 or more steps.
Precursors are extremely useful in scenarios such as performing authentication and enabling the main task (scan or flow) to reach content behind a login. They can also be used to isolate the common steps in any group of tasks, e. g. the first 3 steps of a form that then branches out in several different directions. You can also swap out precursors as a way to switch existing tasks from one test environment to another.
The advantage of having common steps in a precursor task is that if the site changes, you will only need to modify one task to bring multiple tasks back to full functionality.
Basic Use: Linking Up Existing Precursor To Existing Tasks
Linking an existing task to an existing precursor is as simple as selecting it in a picker in the Manage table under Task Details:
The existance of a precursor link is visible in the "Steps" column, which changes to say "2 + up to 20." Likewise, previews are updated to indicate that another task will run prior to the main task.
In the above use case, the existing task "RV - Accept Cookies" will be placed ahead of the task "RV - scan" and will ensure that a consent dialog is being interacted with in a specific way, enabling the scan to run on behalf of a user who has accepted tracking cookies. You can now link the task "RV - Accept Cookies" to multiple tasks as needed.
Linking Up Existing Precursor to New Task
In some use cases, you will need the actions in an existing precursor to be performed by the Design browser in order to even be able to reach certain content and begin designing a new main task.
* Select "New Scan" or "New Flow" on the Manage page:
* In the "Open Existing Task" panel, select the task you wish to use as Precursor, and click on the "Branch" button:
This action will perform the steps in "WSJ Login" and let you add steps that you can then save in a separate task. The result of the design session will be a new task with "WSJ Login" set as its precursor, and containing only the steps / actions / checks you created subsequently to the steps already defined in the precursor.
Editing Tasks With Precursors
Whenever you edit an existing task with a precursor, the steps in it are executed ahead of the main task. When you modify steps in such a context, only the modifications to the main task are actually saved.
The way to modify steps in a precursor is to edit it separately. Changes to the precursor steps and actions will affect all tasks linked to that precursor.
Typically, precursors don't contain any tag checks since their goal is mostly to prime the browser for other validation tasks. That said, any "global" checks defined in a precursor flow will be picked up by a main task if that task is also a flow. If the task is a scan, however, only checks defined in the scan will be performed in order to ensure a consistent summary of results.
A precursor flow task, like any other task, can be scheduled to run separately if it contains checks that are desirable to perform on a cadence.