superbot 0.1.24 → 0.1.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/bin/e2e +2 -4
- data/lib/superbot/capybara/convert.rb +5 -1
- data/lib/superbot/cli/run_command.rb +1 -1
- data/lib/superbot/version.rb +1 -1
- data/lib/superbot/web.rb +10 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f1a95abee93db19f4d05c95636d8c1ad1b75a39cba9795c83225c2264761714
|
4
|
+
data.tar.gz: 7fc91f95945fbc53a0d4d3141aefe5acf5f0037ac1fa67b60abff95b38de11c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b8c20515406511a5c735932872ff79eff222228158e5bcbcd4d00720028d13fbac61137d0b5857b815c5225dcfb7c348983dab811c1567d038638a1b1d53123
|
7
|
+
data.tar.gz: 5f9a88a3316ab7379c0b0315031b2f1564c382c4e6db8a219fb9d172d121eafd493df0bfb1e202b93632d01c77c585dc90b1b9f461c34db0010f9cdddd725eac
|
data/Gemfile.lock
CHANGED
data/bin/e2e
CHANGED
@@ -28,7 +28,7 @@ module Superbot
|
|
28
28
|
when 'resolution' then "page.driver.browser.manage.window.resize_to(#{action[:resolution].join(',')})"
|
29
29
|
when 'has-text' then "page.assert_text('#{action[:text]}')"
|
30
30
|
when 'input' then "find('#{action[:selector]}', match: :first).set('#{action[:value]}')"
|
31
|
-
when 'key-press' then "page.driver.browser.action.send_keys(#{action[:keys]
|
31
|
+
when 'key-press' then "page.driver.browser.action.send_keys(#{coerced_keys(action[:keys])}).perform"
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -36,6 +36,10 @@ module Superbot
|
|
36
36
|
return json.map { |action| convert_action(action) }.join('; ') if json.is_a?(Array)
|
37
37
|
return convert_action(json) if json.is_a?(Hash)
|
38
38
|
end
|
39
|
+
|
40
|
+
def coerced_keys(incoming_keys)
|
41
|
+
incoming_keys.map { |k| k = k.delete(':'); k.length > 1 && k.to_sym || k.to_s }
|
42
|
+
end
|
39
43
|
end
|
40
44
|
end
|
41
45
|
end
|
data/lib/superbot/version.rb
CHANGED
data/lib/superbot/web.rb
CHANGED
@@ -11,7 +11,7 @@ module Superbot
|
|
11
11
|
class Web
|
12
12
|
def initialize(webdriver_type: 'cloud', region: nil)
|
13
13
|
@sinatra = Sinatra.new
|
14
|
-
@sinatra.set :bind, "127.0.0.1"
|
14
|
+
@sinatra.set :bind, ENV.fetch('TELEPORT_BIND_IP', "127.0.0.1")
|
15
15
|
@sinatra.set :silent_sinatra, true
|
16
16
|
@sinatra.set :silent_webrick, true
|
17
17
|
@sinatra.set :silent_access_log, false
|
@@ -34,8 +34,13 @@ module Superbot
|
|
34
34
|
end
|
35
35
|
|
36
36
|
@sinatra.post "/__superbot/v1/convert" do
|
37
|
-
|
38
|
-
|
37
|
+
begin
|
38
|
+
converted_script = Superbot::Capybara::Convert.call(request.body.read)
|
39
|
+
instance.capybara_runner.run(converted_script)
|
40
|
+
halt 200
|
41
|
+
rescue SystemExit => e
|
42
|
+
e.message
|
43
|
+
end
|
39
44
|
end
|
40
45
|
|
41
46
|
@webdriver_type = webdriver_type
|
@@ -77,6 +82,7 @@ module Superbot
|
|
77
82
|
end
|
78
83
|
|
79
84
|
def remote_webdriver_request(type, path, query_string, body, new_headers)
|
85
|
+
start_time = Time.now
|
80
86
|
uri = URI.const_get(@request_settings[:scheme].upcase).build(
|
81
87
|
@request_settings.merge(
|
82
88
|
path: @request_settings[:path] + path,
|
@@ -103,6 +109,7 @@ module Superbot
|
|
103
109
|
http.read_timeout = Superbot.cloud_timeout
|
104
110
|
http.request(req)
|
105
111
|
end.tap do |response|
|
112
|
+
puts "Got response in #{Time.now - start_time} seconds"
|
106
113
|
output_response_errors(response)
|
107
114
|
end
|
108
115
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superbot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Superbots
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|