Table of contents
Switch to another window
In some cases, the tested application will open a new window. For example, there are cases where the user should sign-in using an external service such as Google or Facebook sign in. External sign-in is usually performed in a separate pop-up window.
The following sample code performs the following flow:
- Switch to another window
- Enter user’s credentials
- Return to the original window
Please note that in all tests, window 0 is sometimes used for the WebRTC media collection. Since we don’t want to to dabble or think about it too much, we’ve introduced process.env.RTC_EXTRA_TABS environment variable. Use it when handling your windows:
You should assume that the base window ID is Number(process.env.RTC_EXTRA_TABS) and the pop-up window ID is going to be 1+Number(process.env.RTC_EXTRA_TABS).
Ensure you perform actions in the correct window
When you click inside a popup window (for example Facebook login window) and the window is closed, every command you run next is addressed to the closed window until you call this.switchWindow() to switch back to active tab.
Please note that any action that you will try to perform before you switch back to active tab, such as a click or taking a screenshot, will fail and the test may fail with it.
Open a new tab
Switch to next tab
Open a tab per “call”
For voice calls, you may be able to squeeze more sessions to a single probe by using multiple tabs. Here’s a bit of code to get you started: