chauffeur 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/chauffeur.gemspec +2 -2
- data/lib/chauffeur/downloaders/chromedriver_downloader.rb +7 -2
- data/lib/chauffeur/downloaders/edgedriver_downloader.rb +7 -3
- data/lib/chauffeur/downloaders/firefoxdriver_downloader.rb +15 -3
- data/lib/chauffeur/downloaders/iedriver_downloader.rb +7 -2
- data/lib/chauffeur/driver_downloader.rb +8 -11
- data/lib/chauffeur/path_expander.rb +13 -9
- data/lib/chauffeur/requires.rb +0 -1
- data/lib/chauffeur.rb +10 -10
- data/lib/pry_playground.rb +2 -1
- data/spec/chromedriver_downloader_spec.rb +3 -3
- data/spec/chromedriver_downloader_specs/chromedriver_downloader_install_spec.rb +127 -0
- data/spec/chromedriver_downloader_specs/chromedriver_downloader_overridden_methods_spec.rb +3 -3
- data/spec/chromedriver_downloader_specs/chromedriver_downloader_simple_spec.rb +1 -1
- data/spec/driver_downloader_specs/driver_downloader_error_spec.rb +3 -0
- data/spec/edgedriver_downloader_specs/edgedriver_downloader_install_spec.rb +55 -0
- data/spec/firefoxdriver_downloader_specs/firefox_downloader_install_spec.rb +151 -0
- data/spec/setup_spec.rb +18 -5
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 667572f03f492031efb035cd9eeef27a012f2b04e945fa95ef307085e156b460
|
4
|
+
data.tar.gz: fa66d36ef8dacd660c19e533c7de7ed98269ff3717ba0409d64220f3d66b7745
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39df22c430a395cd8f0522abc3fd09be25ae152b81f0c2f7e84680da3d87adf3d4183722c5c4ec825220e99ef0f8452732e24ebc3b68657a39e434f07a203ea1
|
7
|
+
data.tar.gz: 72c80c435def0347ded09fb7313f5e58c3f37d160134955e87c74af7cc8b2c45f19797e16368efb59cb46346ac5ee31ffb66ac66a78de267bab4f8be1321bcf9
|
data/.rubocop.yml
CHANGED
data/chauffeur.gemspec
CHANGED
@@ -3,14 +3,14 @@ require 'English'
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'chauffeur'
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.3'
|
7
7
|
s.date = '2017-10-23'
|
8
8
|
s.summary = 'summary'
|
9
9
|
s.description = 'Chauffeur is a tool to help manage drivers for automating browsers.'
|
10
10
|
s.authors = ['Jeremy Gardner']
|
11
11
|
s.email = 'jerrygar96@gmail.com'
|
12
12
|
s.files = `git ls-files`.split($ORS)
|
13
|
-
s.homepage = '
|
13
|
+
s.homepage = 'https://gitlab.com/jerrygar96/chauffeur'
|
14
14
|
s.license = 'MIT'
|
15
15
|
s.executables = %w[chauffeur]
|
16
16
|
|
@@ -2,6 +2,11 @@
|
|
2
2
|
class ChromedriverDownloader < DriverDownloader
|
3
3
|
CHROMEDRIVER_URL = 'http://chromedriver.storage.googleapis.com/'.freeze
|
4
4
|
|
5
|
+
def initialize(verbose = true)
|
6
|
+
@all_driver_versions = all_driver_versions
|
7
|
+
super(verbose)
|
8
|
+
end
|
9
|
+
|
5
10
|
def browser_name
|
6
11
|
'chromedriver'
|
7
12
|
end
|
@@ -19,7 +24,7 @@ class ChromedriverDownloader < DriverDownloader
|
|
19
24
|
# platform must be one of: linux32, linux64, mac32, win32
|
20
25
|
def latest_driver_version(platform)
|
21
26
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
22
|
-
platform_drivers = all_driver_versions.select { |v| v.include?(platform) }
|
27
|
+
platform_drivers = @all_driver_versions.select { |v| v.include?(platform) }
|
23
28
|
platform_drivers.map { |v| version_of(v.split('/')[0]) }.max
|
24
29
|
end
|
25
30
|
|
@@ -34,7 +39,7 @@ class ChromedriverDownloader < DriverDownloader
|
|
34
39
|
# platform: string - must be one of: linux32, linux64, mac32, win32
|
35
40
|
def driver_download_url(version, platform)
|
36
41
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
37
|
-
rel_path = all_driver_versions.find do |v|
|
42
|
+
rel_path = @all_driver_versions.find do |v|
|
38
43
|
v.eql?("#{version}/chromedriver_#{platform}.zip")
|
39
44
|
end
|
40
45
|
raise unknown_version_error(version) unless rel_path
|
@@ -2,6 +2,11 @@
|
|
2
2
|
class EdgedriverDownloader < DriverDownloader
|
3
3
|
EDGEDRIVER_URL = 'https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/'.freeze
|
4
4
|
|
5
|
+
def initialize(verbose = true)
|
6
|
+
@all_driver_versions = all_driver_versions
|
7
|
+
super(verbose)
|
8
|
+
end
|
9
|
+
|
5
10
|
def browser_name
|
6
11
|
'microsoft_webdriver'
|
7
12
|
end
|
@@ -19,8 +24,7 @@ class EdgedriverDownloader < DriverDownloader
|
|
19
24
|
# platform must be one of: win
|
20
25
|
def latest_driver_version(platform)
|
21
26
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
22
|
-
|
23
|
-
versions.keys.sort.reverse.find { |k| k =~ /^\d+$/ }
|
27
|
+
@all_driver_versions.keys.sort.reverse.find { |k| k =~ /^\d+$/ }
|
24
28
|
end
|
25
29
|
|
26
30
|
# Returns all available versions of geckodriver
|
@@ -39,6 +43,6 @@ class EdgedriverDownloader < DriverDownloader
|
|
39
43
|
# platform: string - must be win
|
40
44
|
def driver_download_url(version, platform)
|
41
45
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
42
|
-
all_driver_versions[version] || raise(unknown_version_error(version))
|
46
|
+
@all_driver_versions[version] || raise(unknown_version_error(version))
|
43
47
|
end
|
44
48
|
end
|
@@ -2,6 +2,11 @@
|
|
2
2
|
class FirefoxdriverDownloader < DriverDownloader
|
3
3
|
GECKODRIVER_URL = 'https://github.com/mozilla/geckodriver/releases/'.freeze
|
4
4
|
|
5
|
+
def initialize(verbose = true)
|
6
|
+
@all_driver_versions = all_driver_versions
|
7
|
+
super(verbose)
|
8
|
+
end
|
9
|
+
|
5
10
|
def browser_name
|
6
11
|
'geckodriver'
|
7
12
|
end
|
@@ -19,14 +24,16 @@ class FirefoxdriverDownloader < DriverDownloader
|
|
19
24
|
# platform must be one of: linux32, linux64, mac32, win32
|
20
25
|
def latest_driver_version(platform)
|
21
26
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
22
|
-
all_driver_versions.map { |v| Gem::Version.new(v.delete('v')) }.max
|
27
|
+
@all_driver_versions.map { |v| Gem::Version.new(v.delete('v')) }.max
|
23
28
|
end
|
24
29
|
|
25
30
|
# Returns all available versions of geckodriver
|
26
31
|
def all_driver_versions
|
27
32
|
resp = HTTParty.get(GECKODRIVER_URL, verify: false).parsed_response
|
28
33
|
doc = Nokogiri::XML.parse(resp)
|
29
|
-
doc.css('div.release h1.release-title a').map(&:text)
|
34
|
+
ver_array = doc.css('div.release h1.release-title a').map(&:text)
|
35
|
+
raise 'No versions found' if ver_array.empty?
|
36
|
+
ver_array
|
30
37
|
end
|
31
38
|
|
32
39
|
# Returns the url for the desired version of geckodriver
|
@@ -34,9 +41,14 @@ class FirefoxdriverDownloader < DriverDownloader
|
|
34
41
|
# platform: string - must be one of: linux32, linux64, mac32, win32
|
35
42
|
def driver_download_url(version, platform)
|
36
43
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
37
|
-
raise unknown_version_error(version) unless
|
44
|
+
raise unknown_version_error(version) unless valid_version?(version)
|
38
45
|
extension = platform.start_with?('win') ? 'zip' : 'tar.gz'
|
39
46
|
rel_path = "/download/v#{version}/geckodriver-v#{version}-#{platform}.#{extension}"
|
40
47
|
"#{GECKODRIVER_URL}#{rel_path}"
|
41
48
|
end
|
49
|
+
|
50
|
+
def valid_version?(version)
|
51
|
+
valid_versions = @all_driver_versions
|
52
|
+
valid_versions.include?("v#{version}")
|
53
|
+
end
|
42
54
|
end
|
@@ -2,6 +2,11 @@
|
|
2
2
|
class IedriverDownloader < DriverDownloader
|
3
3
|
IEDRIVER_URL = 'http://selenium-release.storage.googleapis.com/'.freeze
|
4
4
|
|
5
|
+
def initialize(verbose = true)
|
6
|
+
@all_driver_versions = all_driver_versions
|
7
|
+
super(verbose)
|
8
|
+
end
|
9
|
+
|
5
10
|
def browser_name
|
6
11
|
'iedriver'
|
7
12
|
end
|
@@ -19,7 +24,7 @@ class IedriverDownloader < DriverDownloader
|
|
19
24
|
# platform must be one of: linux32, linux64, mac32, win32
|
20
25
|
def latest_driver_version(platform)
|
21
26
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
22
|
-
platform_drivers = all_driver_versions.select { |v| v.include?(platform) }
|
27
|
+
platform_drivers = @all_driver_versions.select { |v| v.include?(platform) }
|
23
28
|
platform_drivers.map { |v| version_of(v.split('/')[0]) }.max
|
24
29
|
end
|
25
30
|
|
@@ -35,7 +40,7 @@ class IedriverDownloader < DriverDownloader
|
|
35
40
|
# platform: string - must be one of: linux32, linux64, mac32, win32
|
36
41
|
def driver_download_url(version, platform)
|
37
42
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
38
|
-
rel_path = all_driver_versions.find do |v|
|
43
|
+
rel_path = @all_driver_versions.find do |v|
|
39
44
|
v =~ %r{#{version}/IEDriverServer_#{platform}_#{version}\.\d+\.zip}
|
40
45
|
end
|
41
46
|
raise unknown_version_error(version) unless rel_path
|
@@ -2,7 +2,8 @@
|
|
2
2
|
class DriverDownloader
|
3
3
|
require 'zlib'
|
4
4
|
|
5
|
-
def initialize
|
5
|
+
def initialize(verbose = true)
|
6
|
+
@verbose = verbose
|
6
7
|
config_file_path = "#{Dir.pwd}/drivers/config.yml"
|
7
8
|
@data = File.open(config_file_path) { |f| YAML.safe_load(f) }
|
8
9
|
@installed_versions = @data['installed_versions']
|
@@ -69,13 +70,13 @@ class DriverDownloader
|
|
69
70
|
def install_driver(version, platform)
|
70
71
|
raise unknown_platform_error(platform) unless valid_platform?(platform)
|
71
72
|
if @installed_versions[browser_name][platform].eql?(version.to_s)
|
72
|
-
puts "Driver version #{version} already installed for #{platform}"
|
73
|
-
return
|
73
|
+
puts "Driver version #{version} already installed for #{platform}" if @verbose
|
74
|
+
return false
|
74
75
|
end
|
75
76
|
driver_path = path_for(platform, version)
|
76
77
|
download_url = driver_download_url(version, platform)
|
77
78
|
|
78
|
-
puts "installing '#{download_url}' into '#{driver_path}'"
|
79
|
+
puts "installing '#{download_url}' into '#{driver_path}'" if @verbose
|
79
80
|
|
80
81
|
download_and_unzip(driver_path, download_url)
|
81
82
|
update_browser_version(platform, version)
|
@@ -92,16 +93,12 @@ class DriverDownloader
|
|
92
93
|
|
93
94
|
# Installs the latest version of chromedriver for all platforms.
|
94
95
|
def upgrade_driver_all_platforms
|
95
|
-
all_platforms.each
|
96
|
-
upgrade_driver(platform)
|
97
|
-
end
|
96
|
+
all_platforms.each { |platform| upgrade_driver(platform) }
|
98
97
|
end
|
99
98
|
|
100
99
|
# Installs the specified version of specified driver for all platforms.
|
101
100
|
def install_driver_all_platforms(version)
|
102
|
-
all_platforms.each
|
103
|
-
install_driver(version, platform)
|
104
|
-
end
|
101
|
+
all_platforms.each { |platform| install_driver(version, platform) }
|
105
102
|
end
|
106
103
|
|
107
104
|
# Downloads and installs driver to appropriate path
|
@@ -154,7 +151,7 @@ class DriverDownloader
|
|
154
151
|
end
|
155
152
|
|
156
153
|
def unknown_version_error(version)
|
157
|
-
msg = "Unknown version '#{version}', valid options: #{all_driver_versions}."
|
154
|
+
msg = "Unknown version '#{version}', valid options: #{@all_driver_versions}."
|
158
155
|
raise UnknownVersionError.new(version, msg)
|
159
156
|
end
|
160
157
|
|
@@ -2,13 +2,16 @@ class Chauffeur
|
|
2
2
|
# Adds locations of drivers for the current platform to the beginning of the path
|
3
3
|
module PathExpander
|
4
4
|
def self.paths_to_add
|
5
|
-
all_paths = [path_to_chromedriver,
|
5
|
+
all_paths = [path_to_chromedriver,
|
6
|
+
path_to_geckodriver,
|
7
|
+
path_to_iedriver,
|
8
|
+
path_to_edgedriver].compact
|
6
9
|
# paths = all_paths.compact.join(Gem.path_separator) + Gem.path_separator
|
7
10
|
all_paths.map { |p| format_for_platform(p) }
|
8
11
|
end
|
9
12
|
|
10
|
-
def self.path_to_chromedriver
|
11
|
-
driver_path = "#{Dir.pwd}/drivers/chromedriver/#{current_chromedriver_platform}"
|
13
|
+
def self.path_to_chromedriver(platform = nil)
|
14
|
+
driver_path = "#{Dir.pwd}/drivers/chromedriver/#{platform || current_chromedriver_platform}"
|
12
15
|
make_driver_executable("#{driver_path}/chromedriver")
|
13
16
|
driver_path
|
14
17
|
end
|
@@ -24,8 +27,8 @@ class Chauffeur
|
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
27
|
-
def self.path_to_geckodriver
|
28
|
-
driver_path = "#{Dir.pwd}/drivers/geckodriver/#{current_geckodriver_platform}"
|
30
|
+
def self.path_to_geckodriver(platform = nil)
|
31
|
+
driver_path = "#{Dir.pwd}/drivers/geckodriver/#{platform || current_geckodriver_platform}"
|
29
32
|
make_driver_executable("#{driver_path}/geckodriver")
|
30
33
|
driver_path
|
31
34
|
end
|
@@ -41,16 +44,17 @@ class Chauffeur
|
|
41
44
|
end
|
42
45
|
end
|
43
46
|
|
44
|
-
def self.path_to_iedriver
|
45
|
-
windows? ? "#{Dir.pwd}/drivers/iedriver/#{current_iedriver_platform}" : nil
|
47
|
+
def self.path_to_iedriver(platform = nil)
|
48
|
+
windows? ? "#{Dir.pwd}/drivers/iedriver/#{platform || current_iedriver_platform}" : nil
|
46
49
|
end
|
47
50
|
|
48
51
|
def self.current_iedriver_platform
|
49
52
|
ENV['architecture'].eql?('64') ? 'x64' : 'Win32'
|
50
53
|
end
|
51
54
|
|
52
|
-
def self.path_to_edgedriver
|
53
|
-
|
55
|
+
def self.path_to_edgedriver(platform = nil)
|
56
|
+
p = platform || windows_build_number
|
57
|
+
windows_10? ? "#{Dir.pwd}/drivers/microsoft_webdriver/#{p}" : nil
|
54
58
|
end
|
55
59
|
|
56
60
|
# Takes a file path and puts the appropriate slashes for the operating
|
data/lib/chauffeur/requires.rb
CHANGED
data/lib/chauffeur.rb
CHANGED
@@ -31,17 +31,17 @@ class Chauffeur
|
|
31
31
|
# edge: win
|
32
32
|
# firefox: linux32, linux64, macos, win32, win64
|
33
33
|
# ie: Win32, x64
|
34
|
-
def upgrade_driver(browser, platform)
|
34
|
+
def upgrade_driver(browser, platform, verbose = true)
|
35
35
|
raise "Unknown Browser '#{browser}'." unless valid_browser?(browser)
|
36
|
-
downloader = downloader_for(browser)
|
36
|
+
downloader = downloader_for(browser, verbose)
|
37
37
|
downloader.upgrade_driver(platform)
|
38
38
|
end
|
39
39
|
|
40
40
|
# Installs the latest version of specified driver for all platforms.
|
41
41
|
# browser - string, chrome, edge, firefox, ie
|
42
|
-
def upgrade_driver_all_platforms(browser)
|
42
|
+
def upgrade_driver_all_platforms(browser, verbose = true)
|
43
43
|
raise "Unknown Browser '#{browser}'." unless valid_browser?(browser)
|
44
|
-
downloader = downloader_for(browser)
|
44
|
+
downloader = downloader_for(browser, verbose)
|
45
45
|
downloader.upgrade_driver_all_platforms
|
46
46
|
end
|
47
47
|
|
@@ -49,25 +49,25 @@ class Chauffeur
|
|
49
49
|
# browser - string, chrome, edge, firefox, ie
|
50
50
|
# platform - string, linux32, linux 64, mac32, win32
|
51
51
|
# version: string - must match exactly the version in the download URL
|
52
|
-
def install_driver(browser, platform, version)
|
52
|
+
def install_driver(browser, platform, version, verbose = true)
|
53
53
|
raise "Unknown Browser '#{browser}'." unless valid_browser?(browser)
|
54
|
-
downloader = downloader_for(browser)
|
54
|
+
downloader = downloader_for(browser, verbose)
|
55
55
|
downloader.install_driver(version, platform)
|
56
56
|
end
|
57
57
|
|
58
58
|
# Installs the specified version of specified driver for all platforms.
|
59
59
|
# browser - string, chrome, edge, firefox, ie
|
60
60
|
# platforms - linux32, linux 64, mac32, win32
|
61
|
-
def install_driver_all_platforms(browser, version)
|
61
|
+
def install_driver_all_platforms(browser, version, verbose = true)
|
62
62
|
raise "Unknown Browser '#{browser}'." unless valid_browser?(browser)
|
63
|
-
downloader = downloader_for(browser)
|
63
|
+
downloader = downloader_for(browser, verbose)
|
64
64
|
downloader.install_driver_all_platforms(version)
|
65
65
|
end
|
66
66
|
|
67
67
|
# Returns a new downloader for the specified browser.
|
68
68
|
# browser: string - chrome, edge, firefox, ie
|
69
|
-
def downloader_for(browser)
|
70
|
-
Object.const_get("#{browser.capitalize}driverDownloader").new
|
69
|
+
def downloader_for(browser, verbose = true)
|
70
|
+
Object.const_get("#{browser.capitalize}driverDownloader").new(verbose)
|
71
71
|
end
|
72
72
|
|
73
73
|
private
|
data/lib/pry_playground.rb
CHANGED
@@ -24,7 +24,7 @@ describe 'driver_download_url mac' do
|
|
24
24
|
it 'returns the url for the mac when mac32 is given' do
|
25
25
|
version = '2.11'
|
26
26
|
platform = 'mac32'
|
27
|
-
downloader = ChromedriverDownloader.new
|
27
|
+
downloader = ChromedriverDownloader.new(false)
|
28
28
|
url = downloader.driver_download_url(version, platform)
|
29
29
|
expect(url).to eq('http://chromedriver.storage.googleapis.com/2.11/chromedriver_mac32.zip')
|
30
30
|
end
|
@@ -33,7 +33,7 @@ end
|
|
33
33
|
describe 'driver_download_url linux' do
|
34
34
|
before(:all) do
|
35
35
|
Chauffeur::Setup.create_folders_and_config
|
36
|
-
@downloader = ChromedriverDownloader.new
|
36
|
+
@downloader = ChromedriverDownloader.new(false)
|
37
37
|
end
|
38
38
|
after(:all) do
|
39
39
|
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
@@ -56,7 +56,7 @@ end
|
|
56
56
|
describe 'latest_driver_version' do
|
57
57
|
before(:all) do
|
58
58
|
Chauffeur::Setup.create_folders_and_config
|
59
|
-
@downloader = ChromedriverDownloader.new
|
59
|
+
@downloader = ChromedriverDownloader.new(false)
|
60
60
|
end
|
61
61
|
after(:all) do
|
62
62
|
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require_relative '../helpers/spec_helper'
|
2
|
+
|
3
|
+
describe 'chromedriver downloader install methods' do
|
4
|
+
before(:each) do
|
5
|
+
Chauffeur::Setup.create_folders_and_config
|
6
|
+
end
|
7
|
+
after(:each) do
|
8
|
+
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
9
|
+
end
|
10
|
+
describe 'upgrade_driver' do
|
11
|
+
it 'installs a latest driver version for linux32' do
|
12
|
+
Chauffeur.upgrade_driver('chrome', 'linux32', false)
|
13
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux32')}/chromedriver")
|
14
|
+
version = Chauffeur.driver_versions['chromedriver']['linux32'].to_f > 0
|
15
|
+
expect([file_exists, version]).to eq([true, true])
|
16
|
+
end
|
17
|
+
it 'returns a latest driver version for linux64' do
|
18
|
+
Chauffeur.upgrade_driver('chrome', 'linux64', false)
|
19
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux64')}/chromedriver")
|
20
|
+
version = Chauffeur.driver_versions['chromedriver']['linux64'].to_f > 0
|
21
|
+
expect([file_exists, version]).to eq([true, true])
|
22
|
+
end
|
23
|
+
it 'returns a latest driver version for mac32' do
|
24
|
+
Chauffeur.upgrade_driver('chrome', 'mac32', false)
|
25
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('mac32')}/chromedriver")
|
26
|
+
version = Chauffeur.driver_versions['chromedriver']['mac32'].to_f > 0
|
27
|
+
expect([file_exists, version]).to eq([true, true])
|
28
|
+
end
|
29
|
+
it 'returns a latest driver version for win32' do
|
30
|
+
Chauffeur.upgrade_driver('chrome', 'win32', false)
|
31
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('win32')}/chromedriver.exe")
|
32
|
+
version = Chauffeur.driver_versions['chromedriver']['win32'].to_f > 0
|
33
|
+
expect([file_exists, version]).to eq([true, true])
|
34
|
+
end
|
35
|
+
it 'throws an error for unknown platform' do
|
36
|
+
e = Object.const_get('UnknownPlatformError')
|
37
|
+
expect { Chauffeur.upgrade_driver('chrome', 'linux34', false) }.to raise_error(e)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
describe 'upgrade_driver_all_platforms' do
|
41
|
+
it 'installs a latest driver version for linux32' do
|
42
|
+
Chauffeur.upgrade_driver_all_platforms('chrome', false)
|
43
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux32')}/chromedriver")
|
44
|
+
version = Chauffeur.driver_versions['chromedriver']['linux32'].to_f > 0
|
45
|
+
expect([file_exists, version]).to eq([true, true])
|
46
|
+
end
|
47
|
+
it 'returns a latest driver version for linux64' do
|
48
|
+
Chauffeur.upgrade_driver_all_platforms('chrome', false)
|
49
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux64')}/chromedriver")
|
50
|
+
version = Chauffeur.driver_versions['chromedriver']['linux64'].to_f > 0
|
51
|
+
expect([file_exists, version]).to eq([true, true])
|
52
|
+
end
|
53
|
+
it 'returns a latest driver version for mac32' do
|
54
|
+
Chauffeur.upgrade_driver_all_platforms('chrome', false)
|
55
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('mac32')}/chromedriver")
|
56
|
+
version = Chauffeur.driver_versions['chromedriver']['mac32'].to_f > 0
|
57
|
+
expect([file_exists, version]).to eq([true, true])
|
58
|
+
end
|
59
|
+
it 'returns a latest driver version for win32' do
|
60
|
+
Chauffeur.upgrade_driver_all_platforms('chrome', false)
|
61
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('win32')}/chromedriver.exe")
|
62
|
+
version = Chauffeur.driver_versions['chromedriver']['win32'].to_f > 0
|
63
|
+
expect([file_exists, version]).to eq([true, true])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
describe 'install_driver' do
|
67
|
+
it 'installs a latest driver version for linux32' do
|
68
|
+
Chauffeur.install_driver('chrome', 'linux32', '2.2', false)
|
69
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux32')}/chromedriver")
|
70
|
+
version = Chauffeur.driver_versions['chromedriver']['linux32'].to_f > 0
|
71
|
+
expect([file_exists, version]).to eq([true, true])
|
72
|
+
end
|
73
|
+
it 'returns a latest driver version for linux64' do
|
74
|
+
Chauffeur.install_driver('chrome', 'linux64', '2.2', false)
|
75
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux64')}/chromedriver")
|
76
|
+
version = Chauffeur.driver_versions['chromedriver']['linux64'].to_f > 0
|
77
|
+
expect([file_exists, version]).to eq([true, true])
|
78
|
+
end
|
79
|
+
it 'returns a latest driver version for mac32' do
|
80
|
+
Chauffeur.install_driver('chrome','mac32', '2.2', false)
|
81
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('mac32')}/chromedriver")
|
82
|
+
version = Chauffeur.driver_versions['chromedriver']['mac32'].to_f > 0
|
83
|
+
expect([file_exists, version]).to eq([true, true])
|
84
|
+
end
|
85
|
+
it 'returns a latest driver version for win32' do
|
86
|
+
Chauffeur.install_driver('chrome', 'win32', '2.2', false)
|
87
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('win32')}/chromedriver.exe")
|
88
|
+
version = Chauffeur.driver_versions['chromedriver']['win32'].to_f > 0
|
89
|
+
expect([file_exists, version]).to eq([true, true])
|
90
|
+
end
|
91
|
+
it 'does not install driver if it is already the currently installed driver' do
|
92
|
+
Chauffeur.install_driver('chrome', 'linux32', '2.2', false)
|
93
|
+
installed = Chauffeur.install_driver('chrome', 'linux32', '2.2')
|
94
|
+
expect(installed).to be(false)
|
95
|
+
end
|
96
|
+
it 'throws an error for unknown platform' do
|
97
|
+
e = Object.const_get('UnknownPlatformError')
|
98
|
+
expect { Chauffeur.install_driver('chrome', '2.2', 'linux34') }.to raise_error(e)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
describe 'install_driver_all_platforms' do
|
102
|
+
it 'installs a latest driver version for linux32' do
|
103
|
+
Chauffeur.install_driver_all_platforms('chrome', '2.2', false)
|
104
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux32')}/chromedriver")
|
105
|
+
version = Chauffeur.driver_versions['chromedriver']['linux32'].to_f > 0
|
106
|
+
expect([file_exists, version]).to eq([true, true])
|
107
|
+
end
|
108
|
+
it 'returns a latest driver version for linux64' do
|
109
|
+
Chauffeur.install_driver_all_platforms('chrome', '2.2', false)
|
110
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('linux64')}/chromedriver")
|
111
|
+
version = Chauffeur.driver_versions['chromedriver']['linux64'].to_f > 0
|
112
|
+
expect([file_exists, version]).to eq([true, true])
|
113
|
+
end
|
114
|
+
it 'returns a latest driver version for mac32' do
|
115
|
+
Chauffeur.install_driver_all_platforms('chrome', '2.2', false)
|
116
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('mac32')}/chromedriver")
|
117
|
+
version = Chauffeur.driver_versions['chromedriver']['mac32'].to_f > 0
|
118
|
+
expect([file_exists, version]).to eq([true, true])
|
119
|
+
end
|
120
|
+
it 'returns a latest driver version for win32' do
|
121
|
+
Chauffeur.install_driver_all_platforms('chrome', '2.2', false)
|
122
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_chromedriver('win32')}/chromedriver.exe")
|
123
|
+
version = Chauffeur.driver_versions['chromedriver']['win32'].to_f > 0
|
124
|
+
expect([file_exists, version]).to eq([true, true])
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -3,7 +3,7 @@ require_relative '../helpers/spec_helper'
|
|
3
3
|
describe 'chromedriver downloader overridden methods' do
|
4
4
|
before(:all) do
|
5
5
|
Chauffeur::Setup.create_folders_and_config
|
6
|
-
@downloader = ChromedriverDownloader.new
|
6
|
+
@downloader = ChromedriverDownloader.new(false)
|
7
7
|
end
|
8
8
|
after(:all) do
|
9
9
|
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
describe 'all versions and errors for driver_download_url' do
|
31
31
|
before(:all) do
|
32
32
|
Chauffeur::Setup.create_folders_and_config
|
33
|
-
@downloader = ChromedriverDownloader.new
|
33
|
+
@downloader = ChromedriverDownloader.new(false)
|
34
34
|
end
|
35
35
|
after(:all) do
|
36
36
|
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
@@ -55,7 +55,7 @@ end
|
|
55
55
|
describe 'driver_download_url' do
|
56
56
|
before(:all) do
|
57
57
|
Chauffeur::Setup.create_folders_and_config
|
58
|
-
@downloader = ChromedriverDownloader.new
|
58
|
+
@downloader = ChromedriverDownloader.new(false)
|
59
59
|
end
|
60
60
|
after(:all) do
|
61
61
|
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
@@ -3,7 +3,7 @@ require_relative '../helpers/spec_helper'
|
|
3
3
|
describe 'chromedriver downloader single line methods' do
|
4
4
|
before(:all) do
|
5
5
|
Chauffeur::Setup.create_folders_and_config
|
6
|
-
@downloader = ChromedriverDownloader.new
|
6
|
+
@downloader = ChromedriverDownloader.new(false)
|
7
7
|
end
|
8
8
|
after(:all) do
|
9
9
|
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
@@ -23,4 +23,7 @@ describe 'driver downloader error throwing methods' do
|
|
23
23
|
it 'throws an error for all_driver_versions' do
|
24
24
|
expect { @downloader.all_driver_versions }.to raise_error(RuntimeError)
|
25
25
|
end
|
26
|
+
it 'throws an error for driver_download_url' do
|
27
|
+
expect { @downloader.driver_download_url('something', 'test') }.to raise_error(RuntimeError)
|
28
|
+
end
|
26
29
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require_relative '../helpers/spec_helper'
|
2
|
+
|
3
|
+
describe 'edgedriver downloader install methods' do
|
4
|
+
before(:each) do
|
5
|
+
Chauffeur::Setup.create_folders_and_config
|
6
|
+
end
|
7
|
+
after(:each) do
|
8
|
+
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
9
|
+
end
|
10
|
+
describe 'upgrade_driver' do
|
11
|
+
it 'installs a latest driver version for edge' do
|
12
|
+
Chauffeur.upgrade_driver('edge', 'win', false)
|
13
|
+
latest = Chauffeur.downloader_for('edge').latest_driver_version('win')
|
14
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_edgedriver(latest)}/MicrosoftWebDriver.exe")
|
15
|
+
version = Chauffeur.driver_versions['microsoft_webdriver']['win'].include?(latest)
|
16
|
+
expect([file_exists, version]).to eq([true, true])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
describe 'upgrade_driver_all_platforms' do
|
20
|
+
it 'installs a latest driver version for edge' do
|
21
|
+
Chauffeur.upgrade_driver_all_platforms('edge', false)
|
22
|
+
latest = Chauffeur.downloader_for('edge').latest_driver_version('win')
|
23
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_edgedriver(latest)}/MicrosoftWebDriver.exe")
|
24
|
+
version = Chauffeur.driver_versions['microsoft_webdriver']['win'].include?(latest)
|
25
|
+
expect([file_exists, version]).to eq([true, true])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
describe 'install_driver' do
|
29
|
+
it 'installs a driver version for edge' do
|
30
|
+
version = '15063'
|
31
|
+
Chauffeur.install_driver('edge', 'win', version,false)
|
32
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_edgedriver(version)}/MicrosoftWebDriver.exe")
|
33
|
+
version = Chauffeur.driver_versions['microsoft_webdriver']['win'].include?(version)
|
34
|
+
expect([file_exists, version]).to eq([true, true])
|
35
|
+
end
|
36
|
+
it 'does not install driver if it is already the currently installed driver' do
|
37
|
+
Chauffeur.install_driver('edge', 'win', '10586', false)
|
38
|
+
installed = Chauffeur.install_driver('edge', 'win', '10586', false)
|
39
|
+
expect(installed).to be(false)
|
40
|
+
end
|
41
|
+
it 'throws an error for unknown platform' do
|
42
|
+
e = Object.const_get('UnknownPlatformError')
|
43
|
+
expect { Chauffeur.install_driver('edge', '2.2', 'win') }.to raise_error(e)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
describe 'install_driver_all_platforms' do
|
47
|
+
it 'installs a driver version for edge' do
|
48
|
+
version = '15063'
|
49
|
+
Chauffeur.install_driver_all_platforms('edge', version,false)
|
50
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_edgedriver(version)}/MicrosoftWebDriver.exe")
|
51
|
+
version = Chauffeur.driver_versions['microsoft_webdriver']['win'].include?(version)
|
52
|
+
expect([file_exists, version]).to eq([true, true])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,151 @@
|
|
1
|
+
require_relative '../helpers/spec_helper'
|
2
|
+
|
3
|
+
describe 'firefox downloader install methods' do
|
4
|
+
before(:each) do
|
5
|
+
Chauffeur::Setup.create_folders_and_config
|
6
|
+
end
|
7
|
+
after(:each) do
|
8
|
+
FileUtils.rm_r("#{Dir.pwd}/drivers") if File.exist?("#{Dir.pwd}/drivers")
|
9
|
+
end
|
10
|
+
describe 'upgrade_driver' do
|
11
|
+
it 'installs a latest driver version for linux32' do
|
12
|
+
Chauffeur.upgrade_driver('firefox', 'linux32', false)
|
13
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux32')}/geckodriver")
|
14
|
+
version = Chauffeur.driver_versions['geckodriver']['linux32'].to_f > 0
|
15
|
+
expect([file_exists, version]).to eq([true, true])
|
16
|
+
end
|
17
|
+
it 'returns a latest driver version for linux64' do
|
18
|
+
Chauffeur.upgrade_driver('firefox', 'linux64', false)
|
19
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux64')}/geckodriver")
|
20
|
+
version = Chauffeur.driver_versions['geckodriver']['linux64'].to_f > 0
|
21
|
+
expect([file_exists, version]).to eq([true, true])
|
22
|
+
end
|
23
|
+
it 'returns a latest driver version for macos' do
|
24
|
+
Chauffeur.upgrade_driver('firefox', 'macos', false)
|
25
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('macos')}/geckodriver")
|
26
|
+
version = Chauffeur.driver_versions['geckodriver']['macos'].to_f > 0
|
27
|
+
expect([file_exists, version]).to eq([true, true])
|
28
|
+
end
|
29
|
+
it 'returns a latest driver version for win32' do
|
30
|
+
Chauffeur.upgrade_driver('firefox', 'win32', false)
|
31
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win32')}/geckodriver.exe")
|
32
|
+
version = Chauffeur.driver_versions['geckodriver']['win32'].to_f > 0
|
33
|
+
expect([file_exists, version]).to eq([true, true])
|
34
|
+
end
|
35
|
+
it 'returns a latest driver version for win64' do
|
36
|
+
Chauffeur.upgrade_driver('firefox', 'win64', false)
|
37
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win64')}/geckodriver.exe")
|
38
|
+
version = Chauffeur.driver_versions['geckodriver']['win64'].to_f > 0
|
39
|
+
expect([file_exists, version]).to eq([true, true])
|
40
|
+
end
|
41
|
+
it 'throws an error for unknown platform' do
|
42
|
+
e = Object.const_get('UnknownPlatformError')
|
43
|
+
expect { Chauffeur.upgrade_driver('firefox', 'linux34') }.to raise_error(e)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
describe 'upgrade_driver_all_platforms' do
|
47
|
+
it 'installs a latest driver version for linux32' do
|
48
|
+
Chauffeur.upgrade_driver_all_platforms('firefox', false)
|
49
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux32')}/geckodriver")
|
50
|
+
version = Chauffeur.driver_versions['geckodriver']['linux32'].to_f > 0
|
51
|
+
expect([file_exists, version]).to eq([true, true])
|
52
|
+
end
|
53
|
+
it 'returns a latest driver version for linux64' do
|
54
|
+
Chauffeur.upgrade_driver_all_platforms('firefox', false)
|
55
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux64')}/geckodriver")
|
56
|
+
version = Chauffeur.driver_versions['geckodriver']['linux64'].to_f > 0
|
57
|
+
expect([file_exists, version]).to eq([true, true])
|
58
|
+
end
|
59
|
+
it 'returns a latest driver version for macos' do
|
60
|
+
Chauffeur.upgrade_driver_all_platforms('firefox', false)
|
61
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('macos')}/geckodriver")
|
62
|
+
version = Chauffeur.driver_versions['geckodriver']['macos'].to_f > 0
|
63
|
+
expect([file_exists, version]).to eq([true, true])
|
64
|
+
end
|
65
|
+
it 'returns a latest driver version for win32' do
|
66
|
+
Chauffeur.upgrade_driver_all_platforms('firefox', false)
|
67
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win32')}/geckodriver.exe")
|
68
|
+
version = Chauffeur.driver_versions['geckodriver']['win32'].to_f > 0
|
69
|
+
expect([file_exists, version]).to eq([true, true])
|
70
|
+
end
|
71
|
+
it 'returns a latest driver version for win64' do
|
72
|
+
Chauffeur.upgrade_driver_all_platforms('firefox', false)
|
73
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win64')}/geckodriver.exe")
|
74
|
+
version = Chauffeur.driver_versions['geckodriver']['win64'].to_f > 0
|
75
|
+
expect([file_exists, version]).to eq([true, true])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
describe 'install_driver' do
|
79
|
+
it 'installs a latest driver version for linux32' do
|
80
|
+
Chauffeur.install_driver('firefox', 'linux32', '0.18.0', false)
|
81
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux32')}/geckodriver")
|
82
|
+
version = Chauffeur.driver_versions['geckodriver']['linux32'].to_f > 0
|
83
|
+
expect([file_exists, version]).to eq([true, true])
|
84
|
+
end
|
85
|
+
it 'returns a latest driver version for linux64' do
|
86
|
+
Chauffeur.install_driver('firefox', 'linux64', '0.18.0', false)
|
87
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux64')}/geckodriver")
|
88
|
+
version = Chauffeur.driver_versions['geckodriver']['linux64'].to_f > 0
|
89
|
+
expect([file_exists, version]).to eq([true, true])
|
90
|
+
end
|
91
|
+
it 'returns a latest driver version for macos' do
|
92
|
+
Chauffeur.install_driver('firefox','macos', '0.18.0', false)
|
93
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('macos')}/geckodriver")
|
94
|
+
version = Chauffeur.driver_versions['geckodriver']['macos'].to_f > 0
|
95
|
+
expect([file_exists, version]).to eq([true, true])
|
96
|
+
end
|
97
|
+
it 'returns a latest driver version for win32' do
|
98
|
+
Chauffeur.install_driver('firefox', 'win32', '0.18.0', false)
|
99
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win32')}/geckodriver.exe")
|
100
|
+
version = Chauffeur.driver_versions['geckodriver']['win32'].to_f > 0
|
101
|
+
expect([file_exists, version]).to eq([true, true])
|
102
|
+
end
|
103
|
+
it 'returns a latest driver version for win64' do
|
104
|
+
Chauffeur.install_driver('firefox', 'win64', '0.18.0', false)
|
105
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win64')}/geckodriver.exe")
|
106
|
+
version = Chauffeur.driver_versions['geckodriver']['win64'].to_f > 0
|
107
|
+
expect([file_exists, version]).to eq([true, true])
|
108
|
+
end
|
109
|
+
it 'does not install driver if it is already the currently installed driver' do
|
110
|
+
Chauffeur.install_driver('firefox', 'linux32', '0.18.0', false)
|
111
|
+
installed = Chauffeur.install_driver('firefox', 'linux32', '0.18.0')
|
112
|
+
expect(installed).to be(false)
|
113
|
+
end
|
114
|
+
it 'throws an error for unknown platform' do
|
115
|
+
e = Object.const_get('UnknownPlatformError')
|
116
|
+
expect { Chauffeur.install_driver('firefox', '0.18.0', 'linux34') }.to raise_error(e)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
describe 'install_driver_all_platforms' do
|
120
|
+
it 'installs a latest driver version for linux32' do
|
121
|
+
Chauffeur.install_driver_all_platforms('firefox', '0.18.0', false)
|
122
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux32')}/geckodriver")
|
123
|
+
version = Chauffeur.driver_versions['geckodriver']['linux32'].to_f > 0
|
124
|
+
expect([file_exists, version]).to eq([true, true])
|
125
|
+
end
|
126
|
+
it 'returns a latest driver version for linux64' do
|
127
|
+
Chauffeur.install_driver_all_platforms('firefox', '0.18.0', false)
|
128
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('linux64')}/geckodriver")
|
129
|
+
version = Chauffeur.driver_versions['geckodriver']['linux64'].to_f > 0
|
130
|
+
expect([file_exists, version]).to eq([true, true])
|
131
|
+
end
|
132
|
+
it 'returns a latest driver version for macos' do
|
133
|
+
Chauffeur.install_driver_all_platforms('firefox', '0.18.0', false)
|
134
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('macos')}/geckodriver")
|
135
|
+
version = Chauffeur.driver_versions['geckodriver']['macos'].to_f > 0
|
136
|
+
expect([file_exists, version]).to eq([true, true])
|
137
|
+
end
|
138
|
+
it 'returns a latest driver version for win32' do
|
139
|
+
Chauffeur.install_driver_all_platforms('firefox', '0.18.0', false)
|
140
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win32')}/geckodriver.exe")
|
141
|
+
version = Chauffeur.driver_versions['geckodriver']['win32'].to_f > 0
|
142
|
+
expect([file_exists, version]).to eq([true, true])
|
143
|
+
end
|
144
|
+
it 'returns a latest driver version for win64' do
|
145
|
+
Chauffeur.install_driver_all_platforms('firefox', '0.18.0', false)
|
146
|
+
file_exists = File.exist?("#{Chauffeur::PathExpander.path_to_geckodriver('win64')}/geckodriver.exe")
|
147
|
+
version = Chauffeur.driver_versions['geckodriver']['win64'].to_f > 0
|
148
|
+
expect([file_exists, version]).to eq([true, true])
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
data/spec/setup_spec.rb
CHANGED
@@ -3,11 +3,6 @@ require_relative './helpers/spec_helper'
|
|
3
3
|
CONFIG_DATA = File.open('./lib/chauffeur/config.yml') { |f| YAML.safe_load(f) }
|
4
4
|
DRIVERS_DIR = "#{Dir.pwd}/drivers".freeze
|
5
5
|
|
6
|
-
def load_data
|
7
|
-
config_file_path = './lib/chauffeur/config.yml'
|
8
|
-
File.open(config_file_path) { |f| YAML.safe_load(f) }
|
9
|
-
end
|
10
|
-
|
11
6
|
describe 'folder creation' do
|
12
7
|
before(:each) do
|
13
8
|
FileUtils.rm_r(DRIVERS_DIR) if File.exist?(DRIVERS_DIR)
|
@@ -46,3 +41,21 @@ describe 'config file creation' do
|
|
46
41
|
expect(File.exist?("#{DRIVERS_DIR}/config.yml")).to be_truthy
|
47
42
|
end
|
48
43
|
end
|
44
|
+
|
45
|
+
describe 'chauffeur initialize_chauffeur' do
|
46
|
+
before(:all) do
|
47
|
+
FileUtils.rm_r(DRIVERS_DIR) if File.exist?(DRIVERS_DIR)
|
48
|
+
Chauffeur.initialize_chauffeur
|
49
|
+
end
|
50
|
+
after(:all) do
|
51
|
+
FileUtils.rm_r(DRIVERS_DIR) if File.exist?(DRIVERS_DIR)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'creates folders if they do not exist' do
|
55
|
+
expect(File.exist?(DRIVERS_DIR)).to be_truthy
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'creates config.yml file in ./drivers when it does not exist' do
|
59
|
+
expect(File.exist?("#{DRIVERS_DIR}/config.yml")).to be_truthy
|
60
|
+
end
|
61
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chauffeur
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Gardner
|
@@ -123,12 +123,15 @@ files:
|
|
123
123
|
- lib/chauffeur/unknown_version_error.rb
|
124
124
|
- lib/pry_playground.rb
|
125
125
|
- spec/chromedriver_downloader_spec.rb
|
126
|
+
- spec/chromedriver_downloader_specs/chromedriver_downloader_install_spec.rb
|
126
127
|
- spec/chromedriver_downloader_specs/chromedriver_downloader_overridden_methods_spec.rb
|
127
128
|
- spec/chromedriver_downloader_specs/chromedriver_downloader_simple_spec.rb
|
128
129
|
- spec/driver_downloader_specs/driver_downloader_error_spec.rb
|
129
130
|
- spec/driver_versions_spec.rb
|
131
|
+
- spec/edgedriver_downloader_specs/edgedriver_downloader_install_spec.rb
|
130
132
|
- spec/edgedriver_downloader_specs/edgedriver_downloader_overridden_methods.rb
|
131
133
|
- spec/edgedriver_downloader_specs/edgedriver_downloader_simple_spec.rb
|
134
|
+
- spec/firefoxdriver_downloader_specs/firefox_downloader_install_spec.rb
|
132
135
|
- spec/firefoxdriver_downloader_specs/firefoxdriver_downloader_overridden_methods_spec.rb
|
133
136
|
- spec/firefoxdriver_downloader_specs/firefoxdriver_downloader_simple_spec.rb
|
134
137
|
- spec/format_for_platform_spec.rb
|
@@ -138,7 +141,7 @@ files:
|
|
138
141
|
- spec/iedriver_downloader_specs/iedriver_downloader_simple_spec.rb
|
139
142
|
- spec/path_expansion_spec.rb
|
140
143
|
- spec/setup_spec.rb
|
141
|
-
homepage:
|
144
|
+
homepage: https://gitlab.com/jerrygar96/chauffeur
|
142
145
|
licenses:
|
143
146
|
- MIT
|
144
147
|
metadata: {}
|