blade-sauce_labs_plugin 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blade/sauce_labs_plugin/client.rb +29 -16
- data/lib/blade/sauce_labs_plugin/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13a784ec9bda8cf14efc6a5102650249b77ef8a
|
4
|
+
data.tar.gz: 4acbde7b286b404ff8ceb2c3af154e4f3c2836dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ae0ebe2054a00738274df8386e83617c2012ae26ca9f480b98264d0d56bab64e2cc12299cc95776d752e051397b84e42e44e8fd6e0a85214331582d11485142
|
7
|
+
data.tar.gz: b17d0ee9c25efaa8da7812798953a8892defd55f6f6d166d8fff40c918cb7fd902f5f4f3864afed22428876bc0230a4ddc512411203256db06b914018ed42915
|
@@ -4,13 +4,6 @@ require "json"
|
|
4
4
|
module Blade::SauceLabsPlugin::Client
|
5
5
|
extend self
|
6
6
|
|
7
|
-
ALIASES = {
|
8
|
-
"ie" => "Internet Explorer",
|
9
|
-
"IE" => "Internet Explorer"
|
10
|
-
}
|
11
|
-
|
12
|
-
MOBILE_PATTERN = /iphone|ipad|android/i
|
13
|
-
|
14
7
|
delegate :config, :username, :access_key, :debug?, to: Blade::SauceLabsPlugin
|
15
8
|
|
16
9
|
def request(method, path, params = {})
|
@@ -68,8 +61,7 @@ module Blade::SauceLabsPlugin::Client
|
|
68
61
|
end
|
69
62
|
|
70
63
|
def platforms_for_browser(browser)
|
71
|
-
|
72
|
-
platforms = available_platforms_by_browser[long_name]
|
64
|
+
platforms = available_platforms_for_browser(browser)
|
73
65
|
|
74
66
|
versions_by_os = {}
|
75
67
|
platforms.each do |os, details|
|
@@ -112,19 +104,32 @@ module Blade::SauceLabsPlugin::Client
|
|
112
104
|
end
|
113
105
|
end
|
114
106
|
|
115
|
-
def
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
107
|
+
def available_platforms_for_browser(browser)
|
108
|
+
{}.tap do |platforms|
|
109
|
+
find_browser_long_names(browser[:name]).each do |long_name|
|
110
|
+
available_platforms_by_browser[long_name].each do |os, details|
|
111
|
+
|
112
|
+
if platforms[os]
|
113
|
+
platforms[os][:versions] = (platforms[os][:versions] + details[:versions]).compact.uniq
|
114
|
+
|
115
|
+
details[:api].each do |key, values|
|
116
|
+
if platforms[os][:api][key]
|
117
|
+
platforms[os][:api][key] = (platforms[os][:api][key] + values).compact.uniq
|
118
|
+
else
|
119
|
+
platforms[os][:api][key] = values
|
120
|
+
end
|
121
|
+
end
|
122
|
+
else
|
123
|
+
platforms[os] = details
|
124
|
+
end
|
125
|
+
end
|
121
126
|
end
|
122
127
|
end
|
123
128
|
end
|
124
129
|
|
125
130
|
def available_platforms_by_browser
|
126
131
|
@available_platforms_by_browser ||= {}.tap do |by_browser|
|
127
|
-
available_platforms.group_by { |p| p[:api_name] }.each do |api_name, platforms|
|
132
|
+
available_platforms.group_by { |p| [ p[:device], p[:api_name] ].compact.join(":") }.each do |api_name, platforms|
|
128
133
|
long_name = platforms.first[:long_name]
|
129
134
|
by_browser[long_name] = {}
|
130
135
|
|
@@ -158,6 +163,14 @@ module Blade::SauceLabsPlugin::Client
|
|
158
163
|
end
|
159
164
|
end
|
160
165
|
|
166
|
+
def find_browser_long_names(name)
|
167
|
+
pattern = Regexp.new(name, Regexp::IGNORECASE)
|
168
|
+
available_platforms_by_browser.keys.select do |long_name|
|
169
|
+
long_name =~ pattern
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
|
161
174
|
def available_platforms
|
162
175
|
@available_platforms ||= JSON.parse(connection.get("/rest/v1/info/platforms/webdriver").body).map(&:symbolize_keys)
|
163
176
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blade-sauce_labs_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javan Makhmali
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -192,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
192
|
version: '0'
|
193
193
|
requirements: []
|
194
194
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.
|
195
|
+
rubygems_version: 2.6.10
|
196
196
|
signing_key:
|
197
197
|
specification_version: 4
|
198
198
|
summary: Blade Runner plugin for Sauce Labs (saucelabs.com)
|