true_automation 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0bf53dc1f2d8755f2b13e7c63a2b62172225fcc26c8fddfc461963a77ecc595
|
4
|
+
data.tar.gz: 1ca188644cd2411f68f4153b7352fc31a9bf821c5d6613718d6202ef939f641d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7945c55acaa37f7bf931aed7760648d0abc941ed4b8607ff7166a92290c1a7556eebff9b3627e2bad3d926d0df4fec06a9e9ba969b686052d19567b40ac10baa
|
7
|
+
data.tar.gz: baba5d0a9b3d6ee227cc3c7d89ca759db46d5f9b25c8c57ff0f57ebf870e45cf55ad45df2800b977f0fd49f8f5e53f8b77c98c4bf44c6a32db868874c170b8f4
|
@@ -10,6 +10,7 @@ module TrueAutomation
|
|
10
10
|
def start(options)
|
11
11
|
@port = options[:port]
|
12
12
|
remote = options[:remote]
|
13
|
+
recorder = options[:ta_recorder]
|
13
14
|
ta_debug = options[:ta_debug]
|
14
15
|
|
15
16
|
if options[:ta_service]
|
@@ -31,7 +32,7 @@ module TrueAutomation
|
|
31
32
|
Dir.mkdir('log') unless File.exist?('log')
|
32
33
|
logfile = "log/trueautomation-#{Time.now.strftime('%Y%m%dT%H%M%S')}.log"
|
33
34
|
|
34
|
-
@pid = spawn("#{@executable} --log-file #{logfile} --port #{@port}#{driver_path}#{remote}#{ta_debug}")
|
35
|
+
@pid = spawn("#{@executable} --log-file #{logfile} --port #{@port}#{driver_path}#{remote}#{ta_debug}#{recorder}")
|
35
36
|
puts "Started TrueAutomation.IO client with pid #{@pid} listening to port #{@port}"
|
36
37
|
|
37
38
|
@pid
|
@@ -3,13 +3,13 @@ require_relative '../client'
|
|
3
3
|
module TrueAutomation
|
4
4
|
module Driver
|
5
5
|
class AppiumLib < Appium::Core::Driver
|
6
|
-
def initialize(
|
6
|
+
def initialize(**opts)
|
7
7
|
@ta_client = TrueAutomation::Client.new
|
8
8
|
@remote = ''
|
9
|
-
super
|
9
|
+
super(**opts)
|
10
10
|
end
|
11
11
|
|
12
|
-
def start_driver(
|
12
|
+
def start_driver(**opts)
|
13
13
|
@ta_client.start(port: @port,
|
14
14
|
remote: @remote,
|
15
15
|
ta_debug: @ta_debug,
|
@@ -20,7 +20,7 @@ module TrueAutomation
|
|
20
20
|
at_exit do
|
21
21
|
@ta_client.stop
|
22
22
|
end
|
23
|
-
super
|
23
|
+
super(**opts)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -68,6 +68,10 @@ module TrueAutomation
|
|
68
68
|
class Capybara < Capybara::Selenium::Driver
|
69
69
|
def initialize(app, **options)
|
70
70
|
options = fetch_options(options)
|
71
|
+
if options[:browser].to_s != 'remote'
|
72
|
+
default_options = Selenium::WebDriver::Options.send(options[:browser] || :chrome)
|
73
|
+
end
|
74
|
+
options[:capabilities] ||= default_options
|
71
75
|
@port = options.delete(:port) || find_available_port('localhost')
|
72
76
|
@driver = options.delete(:driver)
|
73
77
|
@driver_version = options.delete(:driver_version)
|
@@ -81,7 +85,7 @@ module TrueAutomation
|
|
81
85
|
@ta_service = options.delete(:ta_service)
|
82
86
|
end
|
83
87
|
|
84
|
-
super(app, options)
|
88
|
+
super(app, **options)
|
85
89
|
|
86
90
|
@ta_client = TrueAutomation::Client.new
|
87
91
|
@remote = ''
|
@@ -89,19 +93,20 @@ module TrueAutomation
|
|
89
93
|
options ||= {}
|
90
94
|
ta_url = options[:ta_url] || "http://localhost:#{@port}/"
|
91
95
|
|
92
|
-
capabilities = options[:
|
96
|
+
capabilities = options[:capabilities] || {}
|
93
97
|
|
94
|
-
if options
|
98
|
+
if options && options[:browser] == :remote
|
95
99
|
raise 'Remote driver URL is not specified' unless options[:url]
|
96
|
-
|
100
|
+
input_caps = opts_to_json(options[:capabilities]) || {}
|
101
|
+
browser = opts_browser(options[:capabilities] || Selenium::WebDriver::Options.chrome)
|
102
|
+
capabilities = options_class(browser).new(**input_caps)
|
103
|
+
capabilities.add_preference(:taRemoteUrl, options[:url])
|
97
104
|
@remote = ' --remote'
|
98
|
-
else
|
99
|
-
capabilities[:browser] = options[:browser] || :chrome
|
100
105
|
end
|
101
106
|
|
102
107
|
@options.merge!(browser: :remote,
|
103
108
|
url: ta_url,
|
104
|
-
|
109
|
+
capabilities: capabilities)
|
105
110
|
end
|
106
111
|
|
107
112
|
def browser
|
@@ -111,7 +116,8 @@ module TrueAutomation
|
|
111
116
|
ta_debug: @ta_debug,
|
112
117
|
driver: @driver,
|
113
118
|
ta_service_path: @ta_service&.executable_path,
|
114
|
-
driver_version: @driver_version
|
119
|
+
driver_version: @driver_version,
|
120
|
+
ta_recorder: @ta_recorder)
|
115
121
|
|
116
122
|
@ta_client.wait_until_start
|
117
123
|
|
@@ -142,18 +148,48 @@ module TrueAutomation
|
|
142
148
|
end
|
143
149
|
|
144
150
|
private
|
151
|
+
|
152
|
+
def options_class(browser)
|
153
|
+
browser.to_s == 'remote' ?
|
154
|
+
Selenium::WebDriver::Remote::Options :
|
155
|
+
eval("Selenium::WebDriver::#{browser_class_name(browser)}::Options")
|
156
|
+
end
|
157
|
+
|
158
|
+
def browser_class_name(browser)
|
159
|
+
browser.to_s.slice(0,1).capitalize + browser.to_s.slice(1..-1)
|
160
|
+
end
|
161
|
+
|
162
|
+
def opts_browser(opts)
|
163
|
+
opts.class.name.split('::')[2].downcase.to_sym
|
164
|
+
end
|
165
|
+
|
166
|
+
def opts_to_json(opts)
|
167
|
+
opts.is_a?(Selenium::WebDriver::Options) ?
|
168
|
+
opts&.options :
|
169
|
+
opts&.as_json
|
170
|
+
end
|
171
|
+
|
145
172
|
def fetch_options(options)
|
173
|
+
if options.delete(:ta_recorder)
|
174
|
+
@ta_recorder = ' --ta-recorder'
|
175
|
+
end
|
146
176
|
if options.key?(:options)
|
147
|
-
browser = options[:options]
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
options[:desired_capabilities] = desCaps
|
177
|
+
browser = opts_browser(options[:options])
|
178
|
+
opts = opts_to_json(options[:options])
|
179
|
+
desCaps = options_class(browser).new(**opts)
|
180
|
+
options[:capabilities] = desCaps
|
152
181
|
options.delete(:options)
|
153
182
|
end
|
154
183
|
options
|
155
184
|
end
|
156
185
|
|
186
|
+
def copy_options(caps, opts)
|
187
|
+
# Add options to capabilities mapping if required
|
188
|
+
opts.keys.each do |key|
|
189
|
+
caps.add_option(key, opts[key])
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
157
193
|
def find_available_port(host)
|
158
194
|
server = TCPServer.new(host, rand(9515..65515))
|
159
195
|
server.addr[1]
|
data/true_automation.gemspec
CHANGED
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
30
30
|
spec.add_development_dependency 'rake', '~> 10.0'
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
32
|
-
spec.add_development_dependency 'appium_lib', '~>
|
33
|
-
spec.add_development_dependency 'appium_lib_core', '~> 4.
|
32
|
+
spec.add_development_dependency 'appium_lib', '~> 12.2.2'
|
33
|
+
spec.add_development_dependency 'appium_lib_core', '~> 6.4.1'
|
34
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: true_automation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrueAutomation.IO
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 12.2.2
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 12.2.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: appium_lib_core
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 6.4.1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 6.4.1
|
97
97
|
description: " true_automation gem enables awesome TrueAutomation.IO features for
|
98
98
|
Capybara and Watir projects.\n"
|
99
99
|
email:
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
requirements: []
|
140
|
-
rubygems_version: 3.
|
140
|
+
rubygems_version: 3.4.13
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: TrueAutomation.IO
|