I am trying to configuring a Windows 7 Vagrant box to run tests.
I used Chocolatey in the provisioning to install all the dependencies needed and everything is almost ready, but I keep running into this error when trying to run webdriver-manager update
, right before the last step, which would be to launch the Selenium server with webdriver-manager start --detach
:
(...)
==> tests: Running provisioner: webdriver-update (shell)...
tests: Running: provisioners/windows/webdriver-update.bat as C:\tmp\vagrant-shell_05.bat
==> tests: C:\Windows\system32>"C:\Users\IEUser\AppData\Roaming\npm\webdriver-manager" update
==> tests: 'node' is not recognized as an internal or external command,
==> tests: operable program or batch file.
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
C:\tmp\vagrant-shell_05.bat
Stdout from the command:
Stderr from the command:
If I then make a remote connection to the VM after all the provisioning, open a command prompt and run webdriver-manager update
and webdriver-manager start
will run successfully, but during provisioning, the problem always occurs.
Sorry for asking a question with so much code but I'm trying to make it as complete as possible:
Here's the Vagrantfile
I'm using to configure the VM:
config.vm.define "tests", autostart: false do |tests|
tests.vm.box = 'C:/Users/Bruno Finger/Win7-WinRM.box'
tests.vm.guest = :windows
tests.vm.provision "chocolatey",
type: "shell",
preserve_order: true,
privileged: true,
upload_path: "C:/tmp/vagrant-shell_01.ps1",
path: "provisioners/windows/chocolatey-installer.ps1"
tests.vm.provision "dependencies",
type: "shell",
preserve_order: true,
privileged: true,
upload_path: "C:/tmp/vagrant-shell_02.bat",
path: "provisioners/windows/test-env-dependencies.bat"
tests.vm.provision "firewall-off",
type: "shell",
preserve_order: true,
run: "always",
privileged: true,
upload_path: "C:/tmp/vagrant-shell_03.bat",
path: "provisioners/windows/windows-firewall-off.bat"
tests.vm.provision "protractor-installer",
type: "shell",
preserve_order: true,
privileged: true,
upload_path: "C:/tmp/vagrant-shell_04.bat",
path: "provisioners/windows/protractor-install.bat"
tests.vm.provision "webdriver-update",
type: "shell",
preserve_order: true,
privileged: true,
upload_path: "C:/tmp/vagrant-shell_05.bat",
path: "provisioners/windows/webdriver-update.bat"
tests.vm.provision "webdriver-start",
type: "shell",
preserve_order: true,
privileged: true,
run: "always",
upload_path: "C:/tmp/vagrant-shell_06.bat",
path: "provisioners/windows/webdriver-start.bat"
tests.vm.provision "hosts",
type: "shell",
preserve_order: true,
privileged: true,
upload_path: "C:/tmp/vagrant-shell_07.ps1",
path: "provisioners/windows/hosts.ps1"
tests.vm.communicator = "winrm"
tests.vm.boot_timeout = 600
tests.winrm.username = "IEUser"
tests.winrm.password = "Passw0rd!"
tests.vm.base_mac = "08002799B15F"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder "./tests", "/Users/IEUser/DGuardWeb/tests"
tests.vm.provider :virtualbox do |v|
v.gui = true
v.customize ["modifyvm", :id, "--pae", "on"]
v.customize ["modifyvm", :id, "--memory", 2048]
v.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]
v.customize ["modifyvm", :id, "--audio", "none"]
end
end
The provisioners specified, one by one:
chocolatey: (PowerShell script)
(iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')))>$null 2>&1
C:\ProgramData\chocolatey\bin\RefreshEnv.cmd
dependencies: (Batch)
"C:\ProgramData\chocolatey\bin\choco.exe" install -y googlechrome firefox git nodejs.install javaruntime python ruby 7zip selenium-ie-driver
"C:\ProgramData\chocolatey\bin\RefreshEnv.cmd"
firewall-off: (Batch)
"C:\Windows\System32\netsh.exe" advfirewall set allprofiles state off
protractor-installer: (Batch)
"C:\Program Files\nodejs\npm" install -g protractor
"C:\ProgramData\chocolatey\bin\RefreshEnv.cmd"
webdriver-update: (Batch) FAILS HERE
"C:\Users\IEUser\AppData\Roaming\npm\webdriver-manager" update
webdriver-start: (Batch) Never got to here, but it's supposed to start the Selenium server in background
"C:\Users\IEUser\AppData\Roaming\npm\webdriver-manager" start --detach
And finally, here's the complete terminal output when I run vagrant up tests
command: http://pastebin.com/SEfSiG9h