As you may have noticed, we continue to simplify life in the testing infrastructure in the Aerokube team. Now we are working hard on handy tools for browser testing based on Selenium . One of the tools that I mentioned earlier is Selenoid . Selenoid is a lightweight server that runs isolated browsers in Docker containers. In previous articles ( one , two ) I described two possible scenarios for using Selenoid - working with Docker and using web-executable drivers for operating systems that lack Docker support. Today I will talk about new features that can help debug browser tests.
One of the useful features offered by commercial Selenium services is the ability to display the browser screen during the execution of tests. This helps a lot in debugging, and everyone, including your boss or manager, likes to watch cartoons with browser-running tests. And now the good news - we recently added this feature to Selenoid. To try you need:
enableVNC = true
How it works? Everything is very simple. Each container also starts a VNC server, which connects to the browser screen. Selenoid UI connects to the VNC port and shows what happens to the browser. Our default images (for example, selenoid/firefox:53.0
) do not contain a VNC server, since they are intended for use in large Selenium clusters, where session viewing is rarely needed. For each regular image, we prepared a separate image containing a VNC server - a full list can be found in the tables .
Experienced users of Selenium sometimes want to see session logs during the execution of tests. This feature has also been added to Selenoid. Using this functionality is even easier - you need to run the Selenoid UI and go to the Logs tab. On it you will see logs for all running sessions. If you need to save logs after the session is over, see how you can configure logging in the documentation section.
Although Selenium is a fairly simple tool, its initial setup can be complex. Some libraries, for example, Angular webdriver-manager already know how to automate most of the work, but they require manual installation of Node.js and Java . But what if you could prepare Selenium the environment with one team? We wrote a small tool that does all the work for you and has no external dependencies. It is simply called cm , which means "configuration manager" in English. To make it work:
1) Download the cm executable from the releases page .
On Mac:
$ curl -Lo cm https://github.com/aerokube/cm/releases/download/1.2.0/cm_darwin_amd64 $ chmod +x ./cm
On Linux:
$ curl -Lo cm https://github.com/aerokube/cm/releases/download/1.2.0/cm_linux_amd64 $ chmod +x ./cm
On Windows - there is no universal command, click on one of the links depending on the version of Windows: 32 bits or 64 bits and save the file as cm
. If you have Powershell installed, then for downloading enter the command:
> curl -o cm.exe https://github.com/aerokube/cm/releases/download/1.2.0/cm_windows_amd64
2) Run one command:
$ ./cm selenoid start --vnc
On Windows, it is written as:
> .\cm.exe selenoid start
Running this command will download the latest version of Selenoid , browser containers, web driver executable files, create configuration files and launch Selenoid. After successful completion of the command, simply run the tests via a normal URL:
http://localhost:4444/wd/hub
Similarly, in order to launch the Selenoid UI effortlessly, enter the command:
$ ./cm selenoid-ui start
Source: https://habr.com/ru/post/333568/
All Articles