Be the first user to complete this post
|
Add to List |
Getting started with automation testing for webrtc applications
WebRTC is a free, open project that provides browsers and mobile applications with Real-Time Communications (RTC) capabilities via simple APIs. Automating WebRTC application brings unique sets of challenges. Most of the times, it requires to have multiple clients ( either browser, mobile, desktop ) open at the same time and doing context switching between those. Because you want to do a certain action on one client and verify that other WebRTC client received that action. For example, in a video chat application implemented using webRTC, you want to verify when a client one shares his video feed, the second client receives the video feed. Here, I will talk specifically about opening multiple chrome browser windows and doing context switching between those.
Actions to automate
- opening multiple browser windows
- switching to browser window for client one then sharing the video feed
- switching to browser window for client two then checking the video feed did appear
.switchWindow()
.
Open multiple windows
To open a new window and set its name you can use the following snippet of code..execute
function takes callback which is invoked immediately with arguments [URL1, WINDOW1].window.open
opens the url in a new window with specified properties and sets the window name to window1.
Context switching between mutiple windows
Now, in your test suite you can context switch between windows by using.switchWindow()
. For example, if you want to share a video feed in window1 and make sure it appear in window2, you can do the following:
[wpgist id="a1e823ad7b83044bf0f2" file="video.js"]
What can you achieve with this?
You can architect an entire API of your page objects and test suite which does context switching between windows based on the received window name. Hence, whenever you call those API you need to pass the context of that window. So, you do not need record similar actions for individual windows. Are you ready to create more flexible API which re-architect your test suite?Also Read:
- querySelector vs getElementById
- imperative vs declarative/functional programming
- css - circular profile pictures
- nodejs: generate uuid / guid
- Pure vs Impure functions