dockpack.base_grid

Base Grid

This is a Selenium Grid setup that runs using docker-compose and other tools.

Selenium Grid screenshot

Purpose

The main aim is to help web developers ensure their websites work for everyone.

dockpack.base_grid is an Ansible role that deploys a Selenium grid and includes additional features to simulate various web browsers for local testing.

In corporate environments, people often use Virtual Desktops (like Citrix or VMWare Horizon) for Windows, along with on-premise servers running Red Hat Enterprise 7. These setups can only run specific versions of Docker (like docker-latest 1.13) that are supported by RedHat.

When running Docker containers, an internal registry, such as Sonatype Nexus, is typically required, and all internet traffic should be managed through a proxy.

To automate browser testing, you need a Selenium Grid that can be accessed from Virtual Desktops and from a build server like Jenkins. The docker-compose grid supports both older and newer versions of Firefox and Chrome. These older versions might not be available on modern corporate IT systems, but some users still need them. Microsoft offers VM images with older versions of Internet Explorer, which can be added to the local grid using Vagrant.

CentOS 7.5

This Ansible role has been tested with a Vagrant box called redesign/centos7. The source for Packer is available here.

To initialize:

vagrant init redesign/centos7

Role Variables

The defaults/main.yml file contains adjustable variables for different versions. You can check the supported browser versions at this link: Selenium Releases. This role requires Docker and a (local) registry like Sonatype Nexus, where the images are stored. You can set the registry as selenium_registry in your group_vars if necessary.

Testing

Maintaining test infrastructure is complex, so this repository includes tools to help address various upcoming changes (like Python and Ansible updates).

Requirements

You need Python pip to test multiple Ansible versions using Tox and Molecule.

pip install -r requirements.txt

On-Premise Docker Registry

You can download the original Selenium images, tag them, and push them to your local registry.

docker pull selenium/node-firefox:3.141.59-iron
docker pull selenium/node-firefox:3.12.0-cobalt
docker pull selenium/node-chrome:3.141.59-iron
docker pull selenium/node-chrome:3.8.1-erbium
docker pull selenium/hub:3.141.59-iron

Use the following to manage your images:

docker images
docker tag ...
docker push ...

Vagrant Testing

You can use seven versions of Internet Explorer by downloading Microsoft’s VMs. This script downloads, unzips, and adds the boxes to Vagrant.

cd vagrant
./windows_boxes.py

To run specific versions:

vagrant up IE8Win7
vagrant up IE9Win7
vagrant up IE10Win7
vagrant up IE11Win7
vagrant up IE11Win81
vagrant up MSEdgeWin10

Mac Tools

I test this on a Mac using Vagrant and VirtualBox. Install all the necessary Mac tools from the Brewfile with:

brew bundle

Compatible Roles

  • dockpack.base_goss
  • dockpack.base.docker

Tox Testing

Use Tox for comprehensive testing with:

tox

Example Playbook

Here’s how to use this role, including passing in variables:

- name: provision selenium
  hosts: testsystem
  become: yes
  roles:
    - { role: dockpack.base_grid, tags: 'selenium' }

License

MIT License

Author Information

Bas Meijer
@bbaassssiiee

Informazioni sul progetto

Selenium Grid running with docker-compose

Installa
ansible-galaxy install dockpack.base_grid
Licenza
mit
Download
74
Proprietario
CI/CD