Docs

Documentation versions (currently viewingVaadin 14)

You are viewing documentation for an older Vaadin version. View latest documentation

Setting up your Own Test Grid

Setting up the Docker Based Selenium Grid

There are ready made Docker images for setting up a Selenium Grid available at https://github.com/SeleniumHQ/docker-selenium. To use the images, you first need to install Docker. Once you have Docker installed, you can create your own test grid e.g. using docker-compose.

First create the following docker-compose.yaml in an empty folder:

version: '2'
services:
  firefox:
    image: selenium/node-firefox:3.9.1-actinium
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - hub
    environment:
      HUB_HOST: hub

  chrome:
    image: selenium/node-chrome:3.9.1-actinium
    volumes:
      - /dev/shm:/dev/shm
    depends_on:
      - hub
    environment:
      HUB_HOST: hub

  hub:
    image: selenium/hub:3.9.1-actinium
    ports:
      - "4444:4444"

This defines a grid with one Chrome node and one Firefox node in addition to the hub.

The whole grid can then be started as

docker-compose up

This will start a grid on http://localhost:4444, with the console at http://localhost:4444/grid/console so you can run your tests on the hub using @RunOnHub("localhost").

Note
The communication protocol used by the grid is standardized so it should not be critical to match the Selenium version that TestBench is based on with the version of the grid. If you run into some strange issues, try matching the versions. You can check the Selenium version for TestBench here

Setting up a Custom Selenium Grid

The process for setting up your own custom Selenium grid is described at https://seleniumhq.github.io/docs/grid.html#rolling_your_own_grid. All the instructions for Selenium apply also for TestBench.

Settings for Screenshots

The screenshot comparison feature requires that the user interface of the browser stays constant. The exact features that interfere with testing depend on the browser and the operating system.

In general:

  • Disable cursor blinking

  • Use the exact same operating system and browser version on every host

  • Turn off any software that may suddenly pop up a new window

  • Turn off the screen saver

If you are using Windows and Internet Explorer, you should also turn on Allow active content to run in files on My Computer in Security settings.

Mobile Testing

Vaadin TestBench includes an iPhone and an Android driver, with which you can test on mobile devices. The tests can be run either in a device or in an emulator/simulator.

The actual testing is just like with any WebDriver, using either the IPhoneDriver or the AndroidDriver. The Android driver assumes that the hub (android-server) is installed in the emulator and forwarded to port 8080 in localhost, while the iPhone driver assumes port 3001. You can also use the RemoteWebDriver with either the iphone() or the android() capability, and specify the hub URI explicitly.

The mobile testing setup is covered in detail in the Selenium documentation for both the iOS driver and the AndroidDriver.

84E12224-214F-4FD6-BEAB-7A4DAC9F8201