Install chromedriver from github
authorTulio Casagrande <tcasagra@thoughtworks.com>
Mon, 5 Jun 2017 16:05:22 +0000 (13:05 -0300)
committerTulio Casagrande <tcasagra@thoughtworks.com>
Tue, 6 Jun 2017 14:55:58 +0000 (11:55 -0300)
The latest chromedriver version is getting recurring errors when
running login.feature from functional tests

provisioning/modules/chromedriver/manifests/init.pp [new file with mode: 0644]
provisioning/modules/pixelated/manifests/source.pp

diff --git a/provisioning/modules/chromedriver/manifests/init.pp b/provisioning/modules/chromedriver/manifests/init.pp
new file mode 100644 (file)
index 0000000..d3f0a41
--- /dev/null
@@ -0,0 +1,37 @@
+# install chromedriver for functional tests
+# we ship our local copy of chromedriver
+# because latest versions are getting recurring errors on
+# test/functional/features/login.feature#Then I should see the fancy interstitial
+
+class chromedriver (
+  $release       = '1.0_beta1',
+  $chromedriver  = 'chromedriver_2.27_linux64.zip',
+  $google_chrome = 'google-chrome-stable_54.0.2840.100-1_amd64.deb',
+) {
+
+  exec { 'fetch_chromedriver':
+    command => "/usr/bin/wget https://github.com/pixelated/pixelated-user-agent/releases/download/${release}/${chromedriver}",
+    cwd     => '/var/tmp',
+    creates => "/var/tmp/${chromedriver}",
+  }
+
+  exec { 'fetch_google_chrome':
+    command => "/usr/bin/wget https://github.com/pixelated/pixelated-user-agent/releases/download/${release}/${google_chrome}",
+    cwd     => '/var/tmp',
+    creates => "/var/tmp/${google_chrome}",
+  }
+
+  exec { 'unpack_chromedriver':
+    command => "/usr/bin/unzip ${chromedriver} -d /usr/local/bin/",
+    cwd     => '/var/tmp/',
+    creates => '/usr/local/bin/chromedriver',
+  }
+
+  exec { 'install_google_chrome':
+    command => "/usr/bin/dpkg -i ${google_chrome} || /usr/bin/apt-get -y -f install",
+    cwd     => '/var/tmp/',
+    unless  => '/usr/bin/dpkg -l google-chrome-stable > /dev/null 2>&1',
+    require => [ Exec['apt_get_update'] ],
+  }
+
+}
index de4ade1..691a3fb 100644 (file)
@@ -1,5 +1,6 @@
 # install requirements for setting up the useragent from source
 class pixelated::source {
+  include chromedriver
 
   package { [
     'git',
@@ -15,14 +16,13 @@ class pixelated::source {
     'ruby-compass',
     'xvfb',
     'xauth',
-    'chromedriver',
     'phantomjs'
     ]:
       ensure => latest
   }
 
   package { ['sass', 'compass']:
-    ensure => latest,
+    ensure   => latest,
     provider => 'gem',
   }