true_automation 0.5.5 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/true_automation/driver/appium_lib.rb +27 -0
- data/lib/true_automation/driver/capybara.rb +28 -9
- data/lib/true_automation/version.rb +1 -1
- data/true_automation.gemspec +3 -1
- metadata +37 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5899752657a55d787cd0d34e450485baa81ccd00fcb04b39299646dd016404de
|
4
|
+
data.tar.gz: 961a54b9115cc568ec44cfafbc9cb5c530a0d9126a3c3cfcfb0efd6efca81eda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0966514008a28ac8a073065c605b63c41d248159279560042da26459ade761fbed733fe31710a174d9e9450cd335e8ea934cfa8d20776b03a2084cb7984aab58'
|
7
|
+
data.tar.gz: 81eb2f5120ec29af5bc8be0ca2794fd1a947d0a138a192dbe5a16626db5fe3489e6c03a57923ac8037a3a85b2d26c75e6d7a43331e9224350cf99c086dfcb75a
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative '../client'
|
2
|
+
|
3
|
+
module TrueAutomation
|
4
|
+
module Driver
|
5
|
+
class AppiumLib < Appium::Core::Driver
|
6
|
+
def initialize(*args)
|
7
|
+
@ta_client = TrueAutomation::Client.new
|
8
|
+
@remote = ''
|
9
|
+
super
|
10
|
+
end
|
11
|
+
|
12
|
+
def start_driver(*args)
|
13
|
+
@ta_client.start(port: @port,
|
14
|
+
remote: @remote,
|
15
|
+
ta_debug: @ta_debug,
|
16
|
+
driver: 'appium')
|
17
|
+
|
18
|
+
@ta_client.wait_until_start
|
19
|
+
|
20
|
+
at_exit do
|
21
|
+
@ta_client.stop
|
22
|
+
end
|
23
|
+
super
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -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[:
|
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
|
-
|
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
|
-
|
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]
|
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
|
151
|
-
options[:
|
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]
|
data/true_automation.gemspec
CHANGED
@@ -25,8 +25,10 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
|
-
spec.add_development_dependency 'bundler', '~>
|
28
|
+
spec.add_development_dependency 'bundler', '~> 2.4'
|
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', '~> 11.2'
|
33
|
+
spec.add_development_dependency 'appium_lib_core', '~> 4.2'
|
32
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.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TrueAutomation.IO
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.4'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: appium_lib
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '11.2'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '11.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: appium_lib_core
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.2'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.2'
|
69
97
|
description: " true_automation gem enables awesome TrueAutomation.IO features for
|
70
98
|
Capybara and Watir projects.\n"
|
71
99
|
email:
|
@@ -83,6 +111,7 @@ files:
|
|
83
111
|
- bin/setup
|
84
112
|
- lib/true_automation.rb
|
85
113
|
- lib/true_automation/client.rb
|
114
|
+
- lib/true_automation/driver/appium_lib.rb
|
86
115
|
- lib/true_automation/driver/capybara.rb
|
87
116
|
- lib/true_automation/dsl.rb
|
88
117
|
- lib/true_automation/helpers.rb
|
@@ -93,7 +122,7 @@ homepage: http://trueautomation.io
|
|
93
122
|
licenses:
|
94
123
|
- MIT
|
95
124
|
metadata: {}
|
96
|
-
post_install_message:
|
125
|
+
post_install_message:
|
97
126
|
rdoc_options: []
|
98
127
|
require_paths:
|
99
128
|
- lib
|
@@ -108,8 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
137
|
- !ruby/object:Gem::Version
|
109
138
|
version: '0'
|
110
139
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
140
|
+
rubygems_version: 3.4.10
|
141
|
+
signing_key:
|
113
142
|
specification_version: 4
|
114
143
|
summary: TrueAutomation.IO
|
115
144
|
test_files: []
|