Simple Vagrant + Puppet setup to easily test Selenium for different browser versions on different platforms.
Currently supports:
- Windows 2012 x64 (Firefox, Chrome, IE11, PhantomJS)
- Windows 10 x64 (Firefox, Chrome, IE11, PhantomJS, Edge)
Make sure you have the following installed:
- Puppet Agent (tested on 4.9.0)
- Ruby (tested on 2.3.3)
- Vagrant (tested on 2.0.2)
- VirtualBox (tested on 5.1.18)
Now, clone repository:
$ git clone https://github.com/p0deje/se-boxes.git
$ cd se-boxes/
You need to install all Puppet dependencies first:
$ gem install librarian-puppet
$ cd environments/windows/
$ librarian-puppet install
Username: vagrant. Password: vagrant.
$ vagrant up win2012
The best way to connect to VM is to use RDP command:
$ vagrant rdp win2012
It will open Remote Desktop connection to VM. You can use Microsoft Remote Desktop or any other RDP client you like.
Username: IEUser. Password: Passw0rd!.
You will need to manually download Windows 10 Vagrant box from Microsoft VMs. The following has been tested on 16.16299.
After it's downloaded and unpacked, add it to Vagrant:
$ vagrant box add --name msedge-win10 dev-msedge.box
Now you can start VM:
$ vagrant up win10 --no-provision
Once VM is started, you'll see VirtualBox GUI which you should use to manually tweak VM so it allows provisioning:
- Go to "Control Panel".
- Open "Administrative Tools".
- Open "Local Security Policy".
- Open "Network List Management Policies".
- Open "Network".
- Switch to "Network Location" tab.
- Set "Location type" to "Private".
- Set "User permissions" to "User can change location".
- Go back to "Network List Management Policies".
Next, we might need to enable WinRM (at least on preview box):
- Run "Command Prompt" as administrator.
- Execute
winrm quickconfig -q
.
If you encounter the following error:
WinRM firewall exception will not work since one of the network connection types
on this machine is set to Public. Change the network connection type to either
Domain or Private and try again.
Then make all networks private by the following:
- Run "Window PowerShell" as administrator.
- Execute
Get-NetConnectionProfile | Set-NetConnectionProfile -NetworkCategory Private
.
Next, you might need to install VirtualBox Guest Additions (at least on preview box):
- Switch to VirtualBox VM window.
- Select "Devices" menu.
- Hit "Insert Guest Additions CD image..." menu entry.
- Switch inside VM.
- Install Guest Additions from CD.
- Reboot to complete Guest Additions installation.
Finally, restart and provision your VM:
$ vagrant reload win10 --provision
To quickly change browser/driver versions, you can do the following:
$ export CHROME_VERSION="57.0.2987.110"
$ export CHROMEDRIVER_VERSION="2.28"
$ export FIREFOX_VERSION="52.0.1"
$ export GECKODRIVER_VERSION="0.15.0"
$ export PHANTOMJS_VERSION="2.1.1"
$ vagrant provision [VM]
Refer to the following chocolatey packages to figure out available versions:
Additionally, the following tools are installed:
Refer to environments/windows/manifests
for
more information.
Note that we use linked clones of VMs, which means that in order to fully remove VM and box you need to:
- Remove linked VM using
vagrant destroy [VM]
. - Manually remove master VM using VirtualBox.
- Remove box using
vagrant box destroy [BOX]
.
If you want your Selenium sources directory be synced into VM, export SELENIUM_PATH
environment variable. It will be accessible in C:\selenium
inside VM.
Please note that on Windows 10 box you might need to restart Vagrant to pick up Selenium sources after provisioning:
$ vagrant reload win10 --no-provision
If you want your Watir sources directory be synced into VM, export WATIR_PATH
environment variable. It will be accessible in C:\watir
inside VM.