mini_autobot 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mini_autobot.rb +1 -1
- data/lib/mini_autobot/parallel.rb +2 -13
- data/lib/mini_autobot/settings.rb +26 -0
- data/lib/mini_autobot/utils/page_object_helper.rb +18 -24
- data/lib/mini_autobot/version.rb +1 -1
- data/mini_autobot.gemspec +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: e3d3f8c199d91925344353710e03c578672d7b81
|
4
|
+
data.tar.gz: a382bb4d189785fdd3bc0246fea2f9932bcb4c31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ff48851c618fc2ded94312117c6f158ffc3ab3b2c579d24f53a9ea5a678c15abccbd1b6c32cb541b10a227c8208e5f968444a69b72fdf955730add380cd99ca
|
7
|
+
data.tar.gz: 290267038060aa30ce6da5d93ac7558b4b76fabc6b2fa1b8e72373cfcf371491ee5ccf514048e99da4a498ecb3b99805f7278ca3f100fd263967536a41152f96
|
data/lib/mini_autobot.rb
CHANGED
@@ -122,19 +122,8 @@ module MiniAutobot
|
|
122
122
|
# call saucelabs REST API to get last #{limit} jobs' statuses
|
123
123
|
# possible job status: complete, error, in progress
|
124
124
|
def saucelabs_last_n_statuses(limit)
|
125
|
-
|
126
|
-
|
127
|
-
file_name = overrides.shift
|
128
|
-
path = MiniAutobot.root.join('config/mini_autobot', 'connectors')
|
129
|
-
filepath = path.join("#{file_name}.yml")
|
130
|
-
raise ArgumentError, "Cannot load profile #{file_name.inspect} because #{filepath.inspect} does not exist" unless filepath.exist?
|
131
|
-
cfg = YAML.load(File.read(filepath))
|
132
|
-
cfg = Connector.resolve(cfg, overrides)
|
133
|
-
cfg.freeze
|
134
|
-
username = cfg["hub"]["user"]
|
135
|
-
access_key = cfg["hub"]["pass"]
|
136
|
-
|
137
|
-
require 'json'
|
125
|
+
username = MiniAutobot.settings.sauce_username
|
126
|
+
access_key = MiniAutobot.settings.sauce_access_key
|
138
127
|
|
139
128
|
# call api to get most recent #{limit} jobs' ids
|
140
129
|
http_auth = "https://#{username}:#{access_key}@saucelabs.com/rest/v1/#{username}/jobs?limit=#{limit}"
|
@@ -33,6 +33,19 @@ module MiniAutobot
|
|
33
33
|
hsh.fetch(:env, :rent_qa).to_s
|
34
34
|
end
|
35
35
|
|
36
|
+
def sauce_session_http_auth(driver)
|
37
|
+
session_id = driver.session_id
|
38
|
+
"https://#{sauce_username}:#{sauce_access_key}@saucelabs.com/rest/v1/#{sauce_username}/jobs/#{session_id}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def sauce_username
|
42
|
+
sauce_user["user"]
|
43
|
+
end
|
44
|
+
|
45
|
+
def sauce_access_key
|
46
|
+
sauce_user["pass"]
|
47
|
+
end
|
48
|
+
|
36
49
|
def io
|
37
50
|
hsh[:io]
|
38
51
|
end
|
@@ -83,6 +96,19 @@ module MiniAutobot
|
|
83
96
|
private
|
84
97
|
attr_reader :hsh
|
85
98
|
|
99
|
+
def sauce_user
|
100
|
+
overrides = connector.split(/:/)
|
101
|
+
file_name = overrides.shift
|
102
|
+
path = MiniAutobot.root.join('config/mini_autobot', 'connectors')
|
103
|
+
filepath = path.join("#{file_name}.yml")
|
104
|
+
raise ArgumentError, "Cannot load profile #{file_name.inspect} because #{filepath.inspect} does not exist" unless filepath.exist?
|
105
|
+
|
106
|
+
cfg = YAML.load(File.read(filepath))
|
107
|
+
cfg = Connector.resolve(cfg, overrides)
|
108
|
+
cfg.freeze
|
109
|
+
cfg["hub"]
|
110
|
+
end
|
111
|
+
|
86
112
|
end
|
87
113
|
|
88
114
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
module MiniAutobot
|
3
2
|
module Utils
|
4
3
|
|
@@ -32,6 +31,13 @@ module MiniAutobot
|
|
32
31
|
@driver = override_driver if !override_driver.nil?
|
33
32
|
instance = klass.new(@driver)
|
34
33
|
|
34
|
+
# Set SauceLabs session(job) name to test's name if running on Saucelabs
|
35
|
+
begin
|
36
|
+
update_sauce_session_name if connector_is_saucelabs? && !@driver.nil?
|
37
|
+
rescue
|
38
|
+
self.logger.debug "Failed setting saucelabs session name for #{name()}"
|
39
|
+
end
|
40
|
+
|
35
41
|
# Before visiting the page, do any pre-processing necessary, if any,
|
36
42
|
# but only visit the page if the pre-processing succeeds
|
37
43
|
if block_given?
|
@@ -63,10 +69,9 @@ module MiniAutobot
|
|
63
69
|
take_screenshot
|
64
70
|
end
|
65
71
|
begin
|
66
|
-
|
67
|
-
self.logger.debug "Finished setting saucelabs session name for #{name()}"
|
72
|
+
update_sauce_session_status if connector_is_saucelabs? && !@driver.nil? && !skipped?
|
68
73
|
rescue
|
69
|
-
self.logger.debug "Failed setting saucelabs session
|
74
|
+
self.logger.debug "Failed setting saucelabs session status for #{name()}"
|
70
75
|
end
|
71
76
|
|
72
77
|
MiniAutobot::Connector.finalize!
|
@@ -124,27 +129,16 @@ module MiniAutobot
|
|
124
129
|
end
|
125
130
|
|
126
131
|
# Update SauceLabs session(job) name
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
file_name = overrides.shift
|
133
|
-
path = MiniAutobot.root.join('config/mini_autobot', 'connectors')
|
134
|
-
filepath = path.join("#{file_name}.yml")
|
135
|
-
raise ArgumentError, "Cannot load profile #{file_name.inspect} because #{filepath.inspect} does not exist" unless filepath.exist?
|
136
|
-
|
137
|
-
cfg = YAML.load(File.read(filepath))
|
138
|
-
cfg = Connector.resolve(cfg, overrides)
|
139
|
-
cfg.freeze
|
140
|
-
username = cfg["hub"]["user"]
|
141
|
-
access_key = cfg["hub"]["pass"]
|
132
|
+
def update_sauce_session_name
|
133
|
+
http_auth = MiniAutobot.settings.sauce_session_http_auth(@driver)
|
134
|
+
body = { "name" => name() }
|
135
|
+
RestClient.put(http_auth, body.to_json, {:content_type => "application/json"})
|
136
|
+
end
|
142
137
|
|
143
|
-
|
144
|
-
|
145
|
-
http_auth =
|
146
|
-
body = { "
|
147
|
-
body["passed"] = passed? unless skipped?
|
138
|
+
# Update session(job) status if test is not skipped
|
139
|
+
def update_sauce_session_status
|
140
|
+
http_auth = MiniAutobot.settings.sauce_session_http_auth(@driver)
|
141
|
+
body = { "passed" => passed? }
|
148
142
|
RestClient.put(http_auth, body.to_json, {:content_type => "application/json"})
|
149
143
|
end
|
150
144
|
|
data/lib/mini_autobot/version.rb
CHANGED
data/mini_autobot.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = %q{Wrapper of minitest and selenium-webdriver that supports multiple webapps
|
12
12
|
and multiple OS/browser ui automation testing, ready to be integrated in
|
13
13
|
development pipeline with jenkins and saucelabs.}
|
14
|
-
s.homepage = "https://github.com/rentpath/
|
14
|
+
s.homepage = "https://github.com/rentpath/mini_autobot"
|
15
15
|
s.license = "MIT"
|
16
16
|
|
17
17
|
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_autobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ripta Pasay
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-12-
|
13
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -229,7 +229,7 @@ files:
|
|
229
229
|
- lib/tapout/custom_reporters/fancy_tap_reporter.rb
|
230
230
|
- lib/yard/tagged_test_case_handler.rb
|
231
231
|
- mini_autobot.gemspec
|
232
|
-
homepage: https://github.com/rentpath/
|
232
|
+
homepage: https://github.com/rentpath/mini_autobot
|
233
233
|
licenses:
|
234
234
|
- MIT
|
235
235
|
metadata: {}
|