Consider a situation where you have an action in a page that could result in different destination contexts in different situations.
For example, let's say on an e-commerce site, you have an Action, "Provide payment info and confirm order". This action may have two possibilities for destination context:
- Authentication Page: For credit card accounts that have signed up for multi-factor authentication (MFA).
- Purchase Confirmation Page: For credit card accounts that did not sign up for MFA.
Now, for both these situations, logic to perform the payment action is the same. Only the resulting destination page will be different depending on which credit card number was used. You may want to create two test scenarios, one for MFA enabled and one for MFA disabled.
Since an Action has a definite destination context, you will need two different actions to handle this situation. However, it is not advisable to duplicate the same logic in two different actions. Following approach helps you streamline this.
- Define a generic action "Provide Payment Info and Confirm Order" and mark its destination Context as "Current Context". Turn-off "Scenario access" to this action by toggling the switch in the sidebar of this action (which prevents this action being used directly in a Scenario).
- Define an action for MFA credit cards, "Provide Payment Info for MFA Card" and mark its destination as "Authentication Page". In the logic for this Action, simply "call" the generic action you created in the above step.
- Repeat the same process and define one more action for non-MFA cards, "Provide Payment Info for non-MFA Card" and mark its destination as "Purchase Confirmation Page".
In step #2, #3 above, you just created 2 shell actions that are simply making use of a central logic, there by avoiding the duplication.
Comments
0 comments
Please sign in to leave a comment.