true_automation 0.5.6 → 0.5.9

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: 7817185c09008c4bbfc9eb5bc706d7282e4a60309aa85d169c6d663000664c61
4
- data.tar.gz: a13df17aadc21dd127a0a65d4acff2fd18c631f64e46fbf1d2b660459da31776
3
+ metadata.gz: 5899752657a55d787cd0d34e450485baa81ccd00fcb04b39299646dd016404de
4
+ data.tar.gz: 961a54b9115cc568ec44cfafbc9cb5c530a0d9126a3c3cfcfb0efd6efca81eda
5
5
  SHA512:
6
- metadata.gz: a0cea005c2118dc1ea284e7f697b07ecf31b1cbab7d47fcd95d71cb31d8f1eedc7145a721e5d7206a03941f474b1369e5ea8315d5e946bd40da5f2420a664dd1
7
- data.tar.gz: 0ec109cf392b6345449b74928c7c3f1588dd35765da9203b80bb84a5faf33058197dfdd9ced67a643bc953b68fee1ddc018c4438b9a6a81126b8f03ca4712636
6
+ metadata.gz: '0966514008a28ac8a073065c605b63c41d248159279560042da26459ade761fbed733fe31710a174d9e9450cd335e8ea934cfa8d20776b03a2084cb7984aab58'
7
+ data.tar.gz: 81eb2f5120ec29af5bc8be0ca2794fd1a947d0a138a192dbe5a16626db5fe3489e6c03a57923ac8037a3a85b2d26c75e6d7a43331e9224350cf99c086dfcb75a
@@ -81,7 +81,7 @@ module TrueAutomation
81
81
  @ta_service = options.delete(:ta_service)
82
82
  end
83
83
 
84
- super(app, options)
84
+ super(app, **options)
85
85
 
86
86
  @ta_client = TrueAutomation::Client.new
87
87
  @remote = ''
@@ -89,19 +89,26 @@ module TrueAutomation
89
89
  options ||= {}
90
90
  ta_url = options[:ta_url] || "http://localhost:#{@port}/"
91
91
 
92
- capabilities = options[:desired_capabilities] || {}
92
+ capabilities = options[:capabilities] || {}
93
93
 
94
94
  if options and options[:browser] == :remote
95
95
  raise 'Remote driver URL is not specified' unless options[:url]
96
- capabilities[:taRemoteUrl] = options[:url]
96
+ input_caps = options[:capabilities]&.as_json || {}
97
+ input_caps = options[:capabilities]&.as_json || {}
98
+ browser = opts_browser(options[:capabilities] || Selenium::WebDriver::Chrome::Capabilities.new)
99
+ browser_class_name = browser.to_s.slice(0,1).capitalize + browser.to_s.slice(1..-1)
100
+ capabilities = browser.to_s == 'remote' ?
101
+ Selenium::WebDriver::Remote::Options.new :
102
+ self.class.class_eval("Selenium::WebDriver::#{browser_class_name}::Options").send(browser)
103
+ copy_options(capabilities, input_caps)
104
+
105
+ capabilities.add_preference(:taRemoteUrl, options[:url])
97
106
  @remote = ' --remote'
98
- else
99
- capabilities[:browser] = options[:browser] || :chrome
100
107
  end
101
108
 
102
109
  @options.merge!(browser: :remote,
103
110
  url: ta_url,
104
- desired_capabilities: capabilities)
111
+ capabilities: capabilities)
105
112
  end
106
113
 
107
114
  def browser
@@ -142,18 +149,30 @@ module TrueAutomation
142
149
  end
143
150
 
144
151
  private
152
+
153
+ def opts_browser(opts)
154
+ opts.class.name.split('::')[2].downcase.to_sym
155
+ end
156
+
145
157
  def fetch_options(options)
146
158
  if options.key?(:options)
147
- browser = options[:options].class.name.split('::')[2]
159
+ browser = opts_browser(options[:options])
148
160
  desCaps = Selenium::WebDriver::Remote::Capabilities.send(browser.downcase)
149
161
  opts = options[:options].as_json
150
- desCaps[opts.keys.first] = opts[opts.keys.first]
151
- options[:desired_capabilities] = desCaps
162
+ copy_options(desCaps, opts)
163
+ options[:capabilities] = desCaps
152
164
  options.delete(:options)
153
165
  end
154
166
  options
155
167
  end
156
168
 
169
+ def copy_options(caps, opts)
170
+ # Add options to capabilities mapping if required
171
+ opts.keys.each do |key|
172
+ caps.add_preference(key, opts[key])
173
+ end
174
+ end
175
+
157
176
  def find_available_port(host)
158
177
  server = TCPServer.new(host, rand(9515..65515))
159
178
  server.addr[1]
@@ -1,3 +1,3 @@
1
1
  module TrueAutomation
2
- VERSION = '0.5.6'
2
+ VERSION = '0.5.9'
3
3
  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.5.6
4
+ version: 0.5.9
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-04-04 00:00:00.000000000 Z
11
+ date: 2023-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -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.2.3
140
+ rubygems_version: 3.4.10
141
141
  signing_key:
142
142
  specification_version: 4
143
143
  summary: TrueAutomation.IO