Article Overview:
This article will cover how you can achieve the following:
This article will describe various ways of interacting with pop-ups in Virtuoso.
Problem Statement:
In automated testing, native pop-ups and alert dialogs often interrupt the flow of test journeys, and while Virtuoso dismisses them automatically, there are scenarios where testers need to interact with these pop-ups for validation. The challenge arises when automatic dismissals or limitations with native alerts prevent proper interaction, leading to incomplete tests.
This article provides a solution by outlining different methods to interact with pop-ups in Virtuoso, allowing users to dismiss, confirm, input values, and assert alert messages efficiently during their tests.
Solution:
There are various ways to interact with pop-ups in Virtuoso:
- Auto dismissal of Native alerts - dismissed automatically
- Use NLP steps to confirm or dismiss alert messages
- Use NLP steps to write values in a pop-up dialogue
- Assert the pop-up alert message
1. Auto dismissal of pop-ups in Virtuoso:
- Certain in-page popups can interrupt the flow of a journey, requiring additional steps to dismiss them, to continue with the testing flow.
- When enabled (default), Virtuoso will automatically try to dismiss unexpected pop-ups, so your journeys can continue without a hitch.
- This does not impact pop-ups that deterministically appear.
- For example, if you have a newsletter pop-up that randomly may occur at any part of the journey, this option can be helpful to prevent your journeys from breaking.
- However, if you have a cookie pop-up when you enter your page, you would need to dismiss the popup as part of your journey.
- Given the automated nature of this behaviour which in exceptional circumstances may have unexpected consequences, if this causes any issues for your normal journeys when you aren't dealing with pop-ups, you can disable this feature for all journeys in a goal with this setting.
-
If you still face auto dismissal of pop ups even after disabling Auto dismiss pop up setting in Goal options, it may be due to the limitation of Virtuoso where the Native alerts are automatically dismissed, so your dismiss steps following them would not work.
- Reason - Chromium team discourage use of JavaScript dialogs.
- To allow native alert pop ups to be displayed while Live Authoring, close the preview screen before an alert is shown, and Virtuoso will execute your tests normally.
2. Use NLP steps to confirm or dismiss alert messages:
Using the NLP syntax -
- “dismiss alert” in the test step in a Virtuoso journey will dismiss the alert.
- “dismiss confirm reply ok” in the test step in a Virtuoso journey will confirm the pop up by clicking ok.
- “dismiss confirm respond cancel” in the test step in a Virtuoso journey will cancel the popup by clicking cancel.
- “dismiss prompt reply cancel in the test step dismiss a prompt by selecting the cancel option.
3. Use NLP steps to write values in a pop up dialogue
- Using the NLP syntax “dismiss prompt respond "text to write"” in the test step in a Virtuoso journey will dismiss a prompt and responds with the specified text to write.
4. Assert the pop up alert message
- Assert that element "Alert" equals “alert message”
The above step verifies that the "Alert" element on the page contains the text "alert message".
Limitations:
- Native alerts can cause the remote session to become unresponsive for iOS devices.
- Dismissing alerts is not supported by some Android devices (e.g. Android 8.0 and older, and Android 11.0 on LambdaTest), iOS 15+, and older desktop browsers (e.g. Chrome 48.0 and older, Firefox 54.0 and older, and Safari 12.0).
Comments
0 comments
Please sign in to leave a comment.