unobtainium 0.11.1 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.rubocop.yml +35 -10
- data/.travis.yml +2 -0
- data/Gemfile.lock +54 -53
- data/features/step_definitions/steps.rb +2 -2
- data/lib/unobtainium.rb +1 -1
- data/lib/unobtainium/driver.rb +7 -8
- data/lib/unobtainium/drivers/appium.rb +10 -6
- data/lib/unobtainium/drivers/phantom.rb +2 -2
- data/lib/unobtainium/drivers/selenium.rb +4 -4
- data/lib/unobtainium/runtime.rb +1 -1
- data/lib/unobtainium/support/identifiers.rb +1 -1
- data/lib/unobtainium/support/port_scanner.rb +6 -6
- data/lib/unobtainium/support/runner.rb +4 -4
- data/lib/unobtainium/support/util.rb +1 -1
- data/lib/unobtainium/version.rb +2 -2
- data/lib/unobtainium/world.rb +1 -1
- data/spec/drivers_appium_spec.rb +2 -2
- data/spec/drivers_phantom_spec.rb +2 -2
- data/spec/drivers_selenium_spec.rb +4 -4
- data/spec/support_port_scanner_spec.rb +4 -4
- data/spec/support_runner_spec.rb +7 -7
- data/spec/support_utility_spec.rb +2 -2
- data/spec/world_spec.rb +2 -2
- data/unobtainium.gemspec +13 -15
- metadata +17 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e364b1ef617fdd456a850dc26396e8dacb4c53d7
|
4
|
+
data.tar.gz: 99d7fffbd5d9f4ab8f113c80d9d972f84963d32e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c13beb99645c0d839b5a43c49825f2fda399219981ee4fc1aa1d17a5959cbad4f3e2b2b88f1a811d8cdfc5e3110150aaadb3599249c6c1edc610e22c3890b58
|
7
|
+
data.tar.gz: 1d2e54eeb68b2da3fa3b715cfe7325e80e77fc4a4e81445ad978e2e96c5014201698190983b3c73d15d6bcdd02e812d6316b90837606b24cc4ab2b379aa3dc6a
|
data/.gitignore
CHANGED
@@ -43,7 +43,7 @@ build-iPhoneSimulator/
|
|
43
43
|
# for a library or gem, you might want to ignore these files since the code is
|
44
44
|
# intended to run in multiple environments; otherwise, check them in:
|
45
45
|
# Gemfile.lock
|
46
|
-
|
46
|
+
.ruby-version
|
47
47
|
# .ruby-gemset
|
48
48
|
|
49
49
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.3
|
3
3
|
|
4
4
|
# Metrics
|
5
5
|
|
6
6
|
Metrics/LineLength:
|
7
|
-
Max:
|
7
|
+
Max: 84
|
8
8
|
Details: >-
|
9
9
|
Line length of 80 is ideal for readability and compatibility; we'll accept
|
10
|
-
an extra
|
10
|
+
an extra 4 for minor edge cases (e.g. copyright notice).
|
11
11
|
|
12
12
|
Metrics/MethodLength:
|
13
13
|
Max: 35
|
@@ -30,6 +30,9 @@ Metrics/ClassLength:
|
|
30
30
|
Metrics/ModuleLength:
|
31
31
|
Max: 300
|
32
32
|
|
33
|
+
Metrics/BlockLength:
|
34
|
+
Max: 300
|
35
|
+
|
33
36
|
# Style
|
34
37
|
|
35
38
|
Style/StringLiterals:
|
@@ -38,9 +41,6 @@ Style/StringLiterals:
|
|
38
41
|
Style/ConditionalAssignment:
|
39
42
|
Enabled: false
|
40
43
|
|
41
|
-
Style/EmptyLinesAroundModuleBody:
|
42
|
-
Enabled: false
|
43
|
-
|
44
44
|
Style/AndOr:
|
45
45
|
Enabled: false
|
46
46
|
|
@@ -59,9 +59,6 @@ Style/IfUnlessModifier:
|
|
59
59
|
Style/TrailingCommaInLiteral:
|
60
60
|
Enabled: false
|
61
61
|
|
62
|
-
Style/FirstParameterIndentation:
|
63
|
-
Enabled: false
|
64
|
-
|
65
62
|
Style/TrailingUnderscoreVariable:
|
66
63
|
Enabled: false
|
67
64
|
|
@@ -71,5 +68,33 @@ Style/NumericLiterals:
|
|
71
68
|
Style/FileName:
|
72
69
|
Enabled: false
|
73
70
|
|
74
|
-
Style/
|
71
|
+
Style/FrozenStringLiteralComment:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Style/PreferredHashMethods:
|
75
|
+
Enabled: false
|
76
|
+
|
77
|
+
Style/NumericPredicate:
|
78
|
+
Enabled: false # Not compatible with <= 2.2
|
79
|
+
|
80
|
+
Style/YodaCondition:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
Style/ClassAndModuleChildren:
|
84
|
+
Enabled: false
|
85
|
+
|
86
|
+
# Layout
|
87
|
+
|
88
|
+
Layout/EmptyLineAfterMagicComment:
|
89
|
+
Enabled: false
|
90
|
+
|
91
|
+
Layout/SpaceAfterNot:
|
75
92
|
Enabled: false
|
93
|
+
|
94
|
+
Layout/FirstParameterIndentation:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Layout/EmptyLinesAroundModuleBody:
|
98
|
+
Enabled: false
|
99
|
+
|
100
|
+
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,36 +1,36 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
unobtainium (0.
|
5
|
-
collapsium (~> 0.
|
6
|
-
collapsium-config (~> 0.
|
4
|
+
unobtainium (0.12.0)
|
5
|
+
collapsium (~> 0.9)
|
6
|
+
collapsium-config (~> 0.6)
|
7
7
|
ptools (~> 1.3)
|
8
8
|
sys-proctable (~> 1.1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
appium_lib (9.1
|
14
|
-
awesome_print (~> 1.
|
13
|
+
appium_lib (9.6.1)
|
14
|
+
awesome_print (~> 1.8)
|
15
15
|
json (>= 1.8)
|
16
16
|
nokogiri (~> 1.6, >= 1.6.6)
|
17
|
-
selenium-webdriver (~> 3.
|
17
|
+
selenium-webdriver (~> 3.4, >= 3.4.1)
|
18
18
|
tomlrb (~> 1.1)
|
19
19
|
archive-zip (0.7.0)
|
20
20
|
io-like (~> 0.3.0)
|
21
21
|
ast (2.3.0)
|
22
|
-
awesome_print (1.
|
23
|
-
builder (3.2.
|
24
|
-
childprocess (0.
|
22
|
+
awesome_print (1.8.0)
|
23
|
+
builder (3.2.3)
|
24
|
+
childprocess (0.7.1)
|
25
25
|
ffi (~> 1.0, >= 1.0.11)
|
26
|
-
chromedriver-helper (1.
|
26
|
+
chromedriver-helper (1.1.0)
|
27
27
|
archive-zip (~> 0.7.0)
|
28
28
|
nokogiri (~> 1.6)
|
29
|
-
codeclimate-test-reporter (1.0.
|
30
|
-
simplecov
|
31
|
-
collapsium (0.
|
32
|
-
collapsium-config (0.
|
33
|
-
collapsium (~> 0.
|
29
|
+
codeclimate-test-reporter (1.0.8)
|
30
|
+
simplecov (<= 0.13)
|
31
|
+
collapsium (0.9.1)
|
32
|
+
collapsium-config (0.6.0)
|
33
|
+
collapsium (~> 0.9)
|
34
34
|
cucumber (2.4.0)
|
35
35
|
builder (>= 2.1.2)
|
36
36
|
cucumber-core (~> 1.5.0)
|
@@ -42,77 +42,78 @@ GEM
|
|
42
42
|
cucumber-core (1.5.0)
|
43
43
|
gherkin (~> 4.0)
|
44
44
|
cucumber-wire (0.0.1)
|
45
|
-
diff-lcs (1.
|
45
|
+
diff-lcs (1.3)
|
46
46
|
docile (1.1.5)
|
47
|
-
ffi (1.9.
|
48
|
-
gherkin (4.
|
47
|
+
ffi (1.9.18)
|
48
|
+
gherkin (4.1.3)
|
49
49
|
io-like (0.3.0)
|
50
|
-
json (2.0
|
51
|
-
mini_portile2 (2.
|
50
|
+
json (2.1.0)
|
51
|
+
mini_portile2 (2.2.0)
|
52
52
|
multi_json (1.12.1)
|
53
53
|
multi_test (0.1.2)
|
54
|
-
nokogiri (1.
|
55
|
-
mini_portile2 (~> 2.
|
56
|
-
|
54
|
+
nokogiri (1.8.0)
|
55
|
+
mini_portile2 (~> 2.2.0)
|
56
|
+
parallel (1.12.0)
|
57
|
+
parser (2.4.0.0)
|
57
58
|
ast (~> 2.2)
|
58
59
|
phantomjs (2.1.1.0)
|
59
60
|
powerpack (0.1.1)
|
60
|
-
ptools (1.3.
|
61
|
-
rainbow (2.2.
|
61
|
+
ptools (1.3.4)
|
62
|
+
rainbow (2.2.2)
|
63
|
+
rake
|
62
64
|
rake (11.3.0)
|
63
|
-
rspec (3.
|
64
|
-
rspec-core (~> 3.
|
65
|
-
rspec-expectations (~> 3.
|
66
|
-
rspec-mocks (~> 3.
|
67
|
-
rspec-core (3.
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-expectations (3.
|
65
|
+
rspec (3.6.0)
|
66
|
+
rspec-core (~> 3.6.0)
|
67
|
+
rspec-expectations (~> 3.6.0)
|
68
|
+
rspec-mocks (~> 3.6.0)
|
69
|
+
rspec-core (3.6.0)
|
70
|
+
rspec-support (~> 3.6.0)
|
71
|
+
rspec-expectations (3.6.0)
|
70
72
|
diff-lcs (>= 1.2.0, < 2.0)
|
71
|
-
rspec-support (~> 3.
|
72
|
-
rspec-mocks (3.
|
73
|
+
rspec-support (~> 3.6.0)
|
74
|
+
rspec-mocks (3.6.0)
|
73
75
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
-
rspec-support (~> 3.
|
75
|
-
rspec-support (3.
|
76
|
-
rubocop (0.
|
77
|
-
|
76
|
+
rspec-support (~> 3.6.0)
|
77
|
+
rspec-support (3.6.0)
|
78
|
+
rubocop (0.49.1)
|
79
|
+
parallel (~> 1.10)
|
80
|
+
parser (>= 2.3.3.1, < 3.0)
|
78
81
|
powerpack (~> 0.1)
|
79
82
|
rainbow (>= 1.99.1, < 3.0)
|
80
83
|
ruby-progressbar (~> 1.7)
|
81
84
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
82
85
|
ruby-progressbar (1.8.1)
|
83
|
-
rubyzip (1.2.
|
84
|
-
selenium-webdriver (3.
|
86
|
+
rubyzip (1.2.1)
|
87
|
+
selenium-webdriver (3.5.1)
|
85
88
|
childprocess (~> 0.5)
|
86
89
|
rubyzip (~> 1.0)
|
87
|
-
|
88
|
-
simplecov (0.12.0)
|
90
|
+
simplecov (0.13.0)
|
89
91
|
docile (~> 1.1.0)
|
90
92
|
json (>= 1.8, < 3)
|
91
93
|
simplecov-html (~> 0.10.0)
|
92
|
-
simplecov-html (0.10.
|
93
|
-
sys-proctable (1.1.
|
94
|
-
tomlrb (1.2.
|
95
|
-
unicode-display_width (1.
|
96
|
-
|
97
|
-
yard (0.9.6)
|
94
|
+
simplecov-html (0.10.2)
|
95
|
+
sys-proctable (1.1.5-universal-linux)
|
96
|
+
tomlrb (1.2.4)
|
97
|
+
unicode-display_width (1.3.0)
|
98
|
+
yard (0.9.9)
|
98
99
|
|
99
100
|
PLATFORMS
|
100
101
|
ruby
|
101
102
|
|
102
103
|
DEPENDENCIES
|
103
104
|
appium_lib (>= 9.1)
|
104
|
-
bundler (~> 1.
|
105
|
+
bundler (~> 1.15)
|
105
106
|
chromedriver-helper
|
106
107
|
codeclimate-test-reporter
|
107
108
|
cucumber
|
108
109
|
phantomjs
|
109
110
|
rake (~> 11.3)
|
110
|
-
rspec (~> 3.
|
111
|
-
rubocop (~> 0.
|
111
|
+
rspec (~> 3.6)
|
112
|
+
rubocop (~> 0.49)
|
112
113
|
selenium-webdriver
|
113
|
-
simplecov (~> 0.
|
114
|
+
simplecov (~> 0.13)
|
114
115
|
unobtainium!
|
115
116
|
yard (~> 0.9)
|
116
117
|
|
117
118
|
BUNDLED WITH
|
118
|
-
1.
|
119
|
+
1.15.4
|
@@ -31,10 +31,10 @@ When(/^I navigate to the best website in the world again$/) do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
Then(/^I expect the driver in each case to be the same$/) do
|
34
|
-
if
|
34
|
+
if @driver_ids[0] != @driver_ids[1]
|
35
35
|
raise "Driver instance changed!"
|
36
36
|
end
|
37
|
-
if
|
37
|
+
if @driver_impl_ids[0] != @driver_impl_ids[1]
|
38
38
|
raise "Driver implementation instance changed!"
|
39
39
|
end
|
40
40
|
end
|
data/lib/unobtainium.rb
CHANGED
data/lib/unobtainium/driver.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
|
2
1
|
# coding: utf-8
|
3
2
|
#
|
4
3
|
# unobtainium
|
5
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
6
5
|
#
|
7
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
8
7
|
# All rights reserved.
|
9
8
|
#
|
10
9
|
module Unobtainium
|
@@ -266,15 +265,15 @@ module Unobtainium
|
|
266
265
|
# rubocop:enable Style/ClassVars
|
267
266
|
|
268
267
|
# Methods that drivers must implement
|
269
|
-
DRIVER_METHODS = [
|
270
|
-
|
271
|
-
|
272
|
-
|
268
|
+
DRIVER_METHODS = %i[
|
269
|
+
matches?
|
270
|
+
ensure_preconditions
|
271
|
+
create
|
273
272
|
].freeze
|
274
273
|
|
275
274
|
# Methods that driver modules must implement
|
276
|
-
MODULE_METHODS = [
|
277
|
-
|
275
|
+
MODULE_METHODS = %i[
|
276
|
+
matches?
|
278
277
|
].freeze
|
279
278
|
end # class Driver
|
280
279
|
end # module Unobtainium
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
|
@@ -35,7 +35,11 @@ module Unobtainium
|
|
35
35
|
# Initialize
|
36
36
|
def initialize(driver, compatibility = true)
|
37
37
|
@appium_driver = driver
|
38
|
-
|
38
|
+
begin
|
39
|
+
@selenium_driver = driver.start_driver
|
40
|
+
rescue StandardError
|
41
|
+
@selenium_driver = driver.driver
|
42
|
+
end
|
39
43
|
|
40
44
|
# Prioritize the two different drivers according to whether
|
41
45
|
# compatibility with Selenium is more desirable than functionality.
|
@@ -65,7 +69,7 @@ module Unobtainium
|
|
65
69
|
def method_missing(meth, *args, &block)
|
66
70
|
@drivers.each do |driver|
|
67
71
|
if not driver.nil? and driver.respond_to?(meth)
|
68
|
-
return driver.send(meth
|
72
|
+
return driver.send(meth, *args, &block)
|
69
73
|
end
|
70
74
|
end
|
71
75
|
return super
|
@@ -74,7 +78,7 @@ module Unobtainium
|
|
74
78
|
|
75
79
|
# Recognized labels for matching the driver
|
76
80
|
LABELS = {
|
77
|
-
ios: [
|
81
|
+
ios: %i[iphone ipad],
|
78
82
|
android: [],
|
79
83
|
}.freeze
|
80
84
|
|
@@ -95,7 +99,7 @@ module Unobtainium
|
|
95
99
|
# Return true if the given label matches this driver implementation,
|
96
100
|
# false otherwise.
|
97
101
|
def matches?(label)
|
98
|
-
return
|
102
|
+
return !normalize_label(label).nil?
|
99
103
|
end
|
100
104
|
|
101
105
|
##
|
@@ -132,7 +136,7 @@ module Unobtainium
|
|
132
136
|
# the :url key if the normalized label is remote, and setting
|
133
137
|
# appropriate options.
|
134
138
|
set_url = options['appium_lib.server_url']
|
135
|
-
if set_url and options['url'] and
|
139
|
+
if set_url and options['url'] and set_url != options['url']
|
136
140
|
warn "You have the remote URL '#{set_url}' set in your options, "\
|
137
141
|
"so we're not replacing it with '#{options['url']}'!"
|
138
142
|
elsif not set_url
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
|
@@ -27,7 +27,7 @@ module Unobtainium
|
|
27
27
|
class Phantom < Selenium
|
28
28
|
# Recognized labels for matching the driver
|
29
29
|
LABELS = {
|
30
|
-
phantomjs: [
|
30
|
+
phantomjs: %i[headless phantom],
|
31
31
|
}.freeze
|
32
32
|
|
33
33
|
# Port scanning ranges (can also be arrays or single port numbers.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
|
@@ -21,8 +21,8 @@ module Unobtainium
|
|
21
21
|
class Selenium
|
22
22
|
# Recognized labels for matching the driver
|
23
23
|
LABELS = {
|
24
|
-
firefox: [
|
25
|
-
internet_explorer: [
|
24
|
+
firefox: %i[ff],
|
25
|
+
internet_explorer: %i[internetexplorer explorer ie],
|
26
26
|
safari: [],
|
27
27
|
chrome: [],
|
28
28
|
chromium: [],
|
@@ -118,7 +118,7 @@ module Unobtainium
|
|
118
118
|
end
|
119
119
|
|
120
120
|
set_binary = options['desired_capabilities.chromeOptions.binary']
|
121
|
-
if set_binary and
|
121
|
+
if set_binary and set_binary != binary
|
122
122
|
# There's already a binary set. We should warn about this, but
|
123
123
|
# otherwise leave this choice.
|
124
124
|
warn "You have the chrome binary '#{set_binary}' set in your "\
|
data/lib/unobtainium/runtime.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
require 'singleton'
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
module Unobtainium
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
|
@@ -42,8 +42,8 @@ module Unobtainium
|
|
42
42
|
# @param port [Integer] port number (1..65535)
|
43
43
|
# @param domains [Array/Symbol] :INET, :INET6, etc. or an Array of
|
44
44
|
# these. Any from Socket::Constants::AF_* work. Defaults to
|
45
|
-
# [
|
46
|
-
def port_open?(host, port, domains = [
|
45
|
+
# %i[INET INET6].
|
46
|
+
def port_open?(host, port, domains = %i[INET INET6])
|
47
47
|
if port < 1 or port > 65535
|
48
48
|
raise ArgumentError, "Port must be in range 1..65535!"
|
49
49
|
end
|
@@ -101,10 +101,10 @@ module Unobtainium
|
|
101
101
|
end
|
102
102
|
opts = { for: :open, amount: :all }.merge(opts)
|
103
103
|
|
104
|
-
if not [
|
104
|
+
if not %i[all first].include?(opts[:amount])
|
105
105
|
raise ArgumentError, ":amount must be one of :all, :first!"
|
106
106
|
end
|
107
|
-
if not [
|
107
|
+
if not %i[open closed available].include?(opts[:for])
|
108
108
|
raise ArgumentError, ":for must beone of :open, :closed, :available!"
|
109
109
|
end
|
110
110
|
|
@@ -151,7 +151,7 @@ module Unobtainium
|
|
151
151
|
return true
|
152
152
|
end
|
153
153
|
|
154
|
-
if not open and [
|
154
|
+
if not open and %i[closed available].include?(test_for)
|
155
155
|
return true
|
156
156
|
end
|
157
157
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
require 'sys-proctable'
|
@@ -114,7 +114,7 @@ module Unobtainium
|
|
114
114
|
raise "No command is running!"
|
115
115
|
end
|
116
116
|
|
117
|
-
if not [
|
117
|
+
if not %i[self children all].include?(scope)
|
118
118
|
raise ArgumentError, "The :scope argument must be one of :self, "\
|
119
119
|
":children or :all!"
|
120
120
|
end
|
@@ -122,11 +122,11 @@ module Unobtainium
|
|
122
122
|
# Figure out which pids to send the signal to. That is usually @pid,
|
123
123
|
# but possibly its children.
|
124
124
|
to_send = []
|
125
|
-
if [
|
125
|
+
if %i[self all].include?(scope)
|
126
126
|
to_send << @pid
|
127
127
|
end
|
128
128
|
|
129
|
-
if [
|
129
|
+
if %i[children all].include?(scope)
|
130
130
|
children = ::Sys::ProcTable.ps.select { |p| p.ppid == @pid }
|
131
131
|
to_send += children.collect(&:pid)
|
132
132
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
module Unobtainium
|
data/lib/unobtainium/version.rb
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
module Unobtainium
|
10
10
|
# The current release version
|
11
|
-
VERSION = "0.
|
11
|
+
VERSION = "0.12.0".freeze
|
12
12
|
end
|
data/lib/unobtainium/world.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
require 'unobtainium'
|
data/spec/drivers_appium_spec.rb
CHANGED
@@ -30,14 +30,14 @@ describe ::Unobtainium::Drivers::Appium do
|
|
30
30
|
|
31
31
|
context "#matches?" do
|
32
32
|
it "matches all known aliases" do
|
33
|
-
aliases = [
|
33
|
+
aliases = %i[ios iphone ipad android]
|
34
34
|
aliases.each do |name|
|
35
35
|
expect(tester.matches?(name)).to be_truthy
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
it "does not match unknown names" do
|
40
|
-
unknown = [
|
40
|
+
unknown = %i[foo bar appium phantomjs headless]
|
41
41
|
unknown.each do |name|
|
42
42
|
expect(tester.matches?(name)).to be_falsey
|
43
43
|
end
|
@@ -30,14 +30,14 @@ describe ::Unobtainium::Drivers::Phantom do
|
|
30
30
|
|
31
31
|
context "#matches?" do
|
32
32
|
it "matches all known aliases" do
|
33
|
-
aliases = [
|
33
|
+
aliases = %i[phantomjs headless phantom]
|
34
34
|
aliases.each do |name|
|
35
35
|
expect(tester.matches?(name)).to be_truthy
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
it "does not match unknown names" do
|
40
|
-
unknown = [
|
40
|
+
unknown = %i[foo bar appium selenium ios]
|
41
41
|
unknown.each do |name|
|
42
42
|
expect(tester.matches?(name)).to be_falsey
|
43
43
|
end
|
@@ -6,9 +6,9 @@ describe ::Unobtainium::Drivers::Selenium do
|
|
6
6
|
|
7
7
|
context "#matches?" do
|
8
8
|
it "matches all known aliases" do
|
9
|
-
aliases = [
|
10
|
-
|
11
|
-
|
9
|
+
aliases = %i[
|
10
|
+
firefox ff internet_explorer internetexplorer explorer
|
11
|
+
ie safari chrome chromium
|
12
12
|
]
|
13
13
|
aliases.each do |name|
|
14
14
|
expect(tester.matches?(name)).to be_truthy
|
@@ -16,7 +16,7 @@ describe ::Unobtainium::Drivers::Selenium do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "does not match unknown names" do
|
19
|
-
unknown = [
|
19
|
+
unknown = %i[foo bar appium phantomjs headless]
|
20
20
|
unknown.each do |name|
|
21
21
|
expect(tester.matches?(name)).to be_falsey
|
22
22
|
end
|
@@ -7,7 +7,7 @@ describe ::Unobtainium::Support::PortScanner do
|
|
7
7
|
# This Socket#connect mock finds port 1234 or 4321 open
|
8
8
|
def connect_mock(_, addr)
|
9
9
|
port, = Socket.unpack_sockaddr_in(addr)
|
10
|
-
if
|
10
|
+
if [1234, 4321].include?(port)
|
11
11
|
raise Errno::EISCONN
|
12
12
|
end
|
13
13
|
raise Errno::ECONNREFUSED
|
@@ -39,7 +39,7 @@ describe ::Unobtainium::Support::PortScanner do
|
|
39
39
|
allow_any_instance_of(Socket).to receive(:connect_nonblock).and_raise(
|
40
40
|
Errno::ECONNREFUSED
|
41
41
|
)
|
42
|
-
expect(tester.port_open?('localhost', 1234, [
|
42
|
+
expect(tester.port_open?('localhost', 1234, %i[INET INET6])).to be_falsy
|
43
43
|
end
|
44
44
|
|
45
45
|
it "rejects bad domain parameters" do
|
@@ -52,7 +52,7 @@ describe ::Unobtainium::Support::PortScanner do
|
|
52
52
|
allow_any_instance_of(Socket).to receive(:connect_nonblock).and_raise(
|
53
53
|
Errno::EINVAL # or EAFNOSUPPORT
|
54
54
|
)
|
55
|
-
expect(tester.port_open?('localhost', 1234, [
|
55
|
+
expect(tester.port_open?('localhost', 1234, %i[INET INET6])).to be_falsy
|
56
56
|
end
|
57
57
|
|
58
58
|
it "retries for several seconds if a socket is being created" do
|
@@ -60,7 +60,7 @@ describe ::Unobtainium::Support::PortScanner do
|
|
60
60
|
Errno::EINPROGRESS
|
61
61
|
)
|
62
62
|
before = Time.now.utc
|
63
|
-
expect(tester.port_open?('localhost', 1234, [
|
63
|
+
expect(tester.port_open?('localhost', 1234, %i[INET INET6])).to be_falsy
|
64
64
|
after = Time.now.utc
|
65
65
|
|
66
66
|
elapsed = after - before
|
data/spec/support_runner_spec.rb
CHANGED
@@ -15,7 +15,7 @@ describe ::Unobtainium::Support::Runner do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it "runs a shell command" do
|
18
|
-
runner = ::Unobtainium::Support::Runner.new("foo", %w
|
18
|
+
runner = ::Unobtainium::Support::Runner.new("foo", %w[ls -l])
|
19
19
|
expect(runner.pid).to be_nil
|
20
20
|
runner.start
|
21
21
|
expect(runner.pid).not_to be_nil
|
@@ -25,7 +25,7 @@ describe ::Unobtainium::Support::Runner do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "captures output" do
|
28
|
-
runner = ::Unobtainium::Support::Runner.new("foo", %w
|
28
|
+
runner = ::Unobtainium::Support::Runner.new("foo", %w[ls -l])
|
29
29
|
runner.start
|
30
30
|
runner.wait
|
31
31
|
expect(runner.stdout).not_to be_nil
|
@@ -37,7 +37,7 @@ describe ::Unobtainium::Support::Runner do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "can be killed" do
|
40
|
-
runner = ::Unobtainium::Support::Runner.new("foo", %w
|
40
|
+
runner = ::Unobtainium::Support::Runner.new("foo", %w[sleep 30])
|
41
41
|
runner.start
|
42
42
|
expect(runner.pid).not_to be_nil
|
43
43
|
runner.kill
|
@@ -45,7 +45,7 @@ describe ::Unobtainium::Support::Runner do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "verifies #signal arguments" do
|
48
|
-
runner = ::Unobtainium::Support::Runner.new("foo", %w
|
48
|
+
runner = ::Unobtainium::Support::Runner.new("foo", %w[sleep 30])
|
49
49
|
expect { runner.signal("KILL", scope: :foo) }.to raise_error(RuntimeError)
|
50
50
|
runner.start
|
51
51
|
expect { runner.signal("KILL", scope: :foo) }.to raise_error(ArgumentError)
|
@@ -58,14 +58,14 @@ describe ::Unobtainium::Support::Runner do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it "refuses to run the command twice without ending it first" do
|
61
|
-
runner = ::Unobtainium::Support::Runner.new("foo", %w
|
61
|
+
runner = ::Unobtainium::Support::Runner.new("foo", %w[ls -l])
|
62
62
|
expect { runner.start }.not_to raise_error
|
63
63
|
expect { runner.start }.to raise_error(RuntimeError)
|
64
64
|
runner.wait
|
65
65
|
end
|
66
66
|
|
67
67
|
it "kills when destroyed" do
|
68
|
-
runner = ::Unobtainium::Support::Runner.new("foo", %w
|
68
|
+
runner = ::Unobtainium::Support::Runner.new("foo", %w[sleep 30])
|
69
69
|
runner.start
|
70
70
|
expect(runner.pid).not_to be_nil
|
71
71
|
runner.destroy
|
@@ -73,7 +73,7 @@ describe ::Unobtainium::Support::Runner do
|
|
73
73
|
end
|
74
74
|
|
75
75
|
it "cannot be killed twice" do
|
76
|
-
runner = ::Unobtainium::Support::Runner.new("foo", %w
|
76
|
+
runner = ::Unobtainium::Support::Runner.new("foo", %w[sleep 30])
|
77
77
|
runner.start
|
78
78
|
expect(runner.pid).not_to be_nil
|
79
79
|
runner.kill
|
data/spec/world_spec.rb
CHANGED
@@ -37,10 +37,10 @@ describe ::Unobtainium::World do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "extends driver options, but doesn't pass 'base' on" do
|
40
|
-
expect(@tester.config["drivers.leaf.base"]).to eql %w
|
40
|
+
expect(@tester.config["drivers.leaf.base"]).to eql %w[.global
|
41
41
|
.drivers.mock
|
42
42
|
.drivers.branch1
|
43
|
-
.drivers.branch2
|
43
|
+
.drivers.branch2]
|
44
44
|
expect(@tester.driver.passed_options["base"]).to be_nil
|
45
45
|
end
|
46
46
|
|
data/unobtainium.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# unobtainium
|
4
4
|
# https://github.com/jfinkhaeuser/unobtainium
|
5
5
|
#
|
6
|
-
# Copyright (c) 2016 Jens Finkhaeuser and other unobtainium contributors.
|
6
|
+
# Copyright (c) 2016-2017 Jens Finkhaeuser and other unobtainium contributors.
|
7
7
|
# All rights reserved.
|
8
8
|
#
|
9
9
|
|
@@ -11,14 +11,13 @@ lib = File.expand_path('../lib', __FILE__)
|
|
11
11
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
12
12
|
require 'unobtainium/version'
|
13
13
|
|
14
|
-
# rubocop:disable Style/UnneededPercentQ,
|
15
|
-
# rubocop:disable
|
16
|
-
# rubocop:disable Metrics/BlockLength
|
14
|
+
# rubocop:disable Style/UnneededPercentQ, Layout/ExtraSpacing
|
15
|
+
# rubocop:disable Layout/SpaceAroundOperators
|
17
16
|
Gem::Specification.new do |spec|
|
18
17
|
spec.name = "unobtainium"
|
19
18
|
spec.version = Unobtainium::VERSION
|
20
|
-
spec.authors = ["Jens Finkhaeuser"]
|
21
|
-
spec.email = ["jens@finkhaeuser.de"]
|
19
|
+
spec.authors = ["Jens Finkhaeuser", "Jana Rekittke"]
|
20
|
+
spec.email = ["jens@finkhaeuser.de", "jrekittke@babbel.com"]
|
22
21
|
spec.description = %q(
|
23
22
|
Unobtainium wraps Selenium and Appium in a simple driver abstraction so that
|
24
23
|
test code can more easily cover desktop browsers, mobile browsers and mobile
|
@@ -43,11 +42,11 @@ Gem::Specification.new do |spec|
|
|
43
42
|
spec.requirements = "Either or all of 'selenium-webdriver', 'appium_lib', "\
|
44
43
|
"'phantomjs'"
|
45
44
|
|
46
|
-
spec.add_development_dependency "bundler", "~> 1.
|
47
|
-
spec.add_development_dependency "rubocop", "~> 0.
|
45
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
46
|
+
spec.add_development_dependency "rubocop", "~> 0.49"
|
48
47
|
spec.add_development_dependency "rake", "~> 11.3"
|
49
|
-
spec.add_development_dependency "rspec", "~> 3.
|
50
|
-
spec.add_development_dependency "simplecov", "~> 0.
|
48
|
+
spec.add_development_dependency "rspec", "~> 3.6"
|
49
|
+
spec.add_development_dependency "simplecov", "~> 0.13"
|
51
50
|
spec.add_development_dependency "yard", "~> 0.9"
|
52
51
|
spec.add_development_dependency "appium_lib", ">= 9.1"
|
53
52
|
spec.add_development_dependency "selenium-webdriver"
|
@@ -57,9 +56,8 @@ Gem::Specification.new do |spec|
|
|
57
56
|
|
58
57
|
spec.add_dependency "sys-proctable", "~> 1.1"
|
59
58
|
spec.add_dependency "ptools", "~> 1.3"
|
60
|
-
spec.add_dependency "collapsium", "~> 0.
|
61
|
-
spec.add_dependency "collapsium-config", "~> 0.
|
59
|
+
spec.add_dependency "collapsium", "~> 0.9"
|
60
|
+
spec.add_dependency "collapsium-config", "~> 0.6"
|
62
61
|
end
|
63
|
-
# rubocop:enable
|
64
|
-
# rubocop:enable Style/
|
65
|
-
# rubocop:enable Style/UnneededPercentQ, Style/ExtraSpacing
|
62
|
+
# rubocop:enable Layout/SpaceAroundOperators
|
63
|
+
# rubocop:enable Style/UnneededPercentQ, Layout/ExtraSpacing
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unobtainium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Finkhaeuser
|
8
|
+
- Jana Rekittke
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2017-
|
12
|
+
date: 2017-08-31 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -16,28 +17,28 @@ dependencies:
|
|
16
17
|
requirements:
|
17
18
|
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
20
|
+
version: '1.15'
|
20
21
|
type: :development
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - "~>"
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
27
|
+
version: '1.15'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
29
|
name: rubocop
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
32
|
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
34
|
+
version: '0.49'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0.
|
41
|
+
version: '0.49'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
43
|
name: rake
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,28 +59,28 @@ dependencies:
|
|
58
59
|
requirements:
|
59
60
|
- - "~>"
|
60
61
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
62
|
+
version: '3.6'
|
62
63
|
type: :development
|
63
64
|
prerelease: false
|
64
65
|
version_requirements: !ruby/object:Gem::Requirement
|
65
66
|
requirements:
|
66
67
|
- - "~>"
|
67
68
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
69
|
+
version: '3.6'
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
71
|
name: simplecov
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
74
|
- - "~>"
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: '0.
|
76
|
+
version: '0.13'
|
76
77
|
type: :development
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
81
|
- - "~>"
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version: '0.
|
83
|
+
version: '0.13'
|
83
84
|
- !ruby/object:Gem::Dependency
|
84
85
|
name: yard
|
85
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,34 +199,35 @@ dependencies:
|
|
198
199
|
requirements:
|
199
200
|
- - "~>"
|
200
201
|
- !ruby/object:Gem::Version
|
201
|
-
version: '0.
|
202
|
+
version: '0.9'
|
202
203
|
type: :runtime
|
203
204
|
prerelease: false
|
204
205
|
version_requirements: !ruby/object:Gem::Requirement
|
205
206
|
requirements:
|
206
207
|
- - "~>"
|
207
208
|
- !ruby/object:Gem::Version
|
208
|
-
version: '0.
|
209
|
+
version: '0.9'
|
209
210
|
- !ruby/object:Gem::Dependency
|
210
211
|
name: collapsium-config
|
211
212
|
requirement: !ruby/object:Gem::Requirement
|
212
213
|
requirements:
|
213
214
|
- - "~>"
|
214
215
|
- !ruby/object:Gem::Version
|
215
|
-
version: '0.
|
216
|
+
version: '0.6'
|
216
217
|
type: :runtime
|
217
218
|
prerelease: false
|
218
219
|
version_requirements: !ruby/object:Gem::Requirement
|
219
220
|
requirements:
|
220
221
|
- - "~>"
|
221
222
|
- !ruby/object:Gem::Version
|
222
|
-
version: '0.
|
223
|
+
version: '0.6'
|
223
224
|
description: "\n Unobtainium wraps Selenium and Appium in a simple driver abstraction
|
224
225
|
so that\n test code can more easily cover desktop browsers, mobile browsers and
|
225
226
|
mobile\n apps.\n\n Some additional useful functionality for the maintenance
|
226
227
|
of test suites is\n also added.\n "
|
227
228
|
email:
|
228
229
|
- jens@finkhaeuser.de
|
230
|
+
- jrekittke@babbel.com
|
229
231
|
executables: []
|
230
232
|
extensions: []
|
231
233
|
extra_rdoc_files: []
|
@@ -296,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
298
|
requirements:
|
297
299
|
- Either or all of 'selenium-webdriver', 'appium_lib', 'phantomjs'
|
298
300
|
rubyforge_project:
|
299
|
-
rubygems_version: 2.
|
301
|
+
rubygems_version: 2.6.11
|
300
302
|
signing_key:
|
301
303
|
specification_version: 4
|
302
304
|
summary: 'Obtain the unobtainable: test code covering multiple platforms'
|