gridium 1.1.36 → 1.1.37

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/driver.rb +18 -11
  3. data/lib/testrail.rb +11 -4
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dc394adb83e2168340ced467ae4f27984776bc91
4
- data.tar.gz: 131259a3fb64cbec4df0c59443199f27d15f7aad
3
+ metadata.gz: 2dac960c5339e0c6c9e85e83e4902997b21449c5
4
+ data.tar.gz: d520a854a5490a74a1de76f0ff2f906507c36699
5
5
  SHA512:
6
- metadata.gz: d4bce2e0436804761bc3e6339da75fd0ea37177c4996ffe065cae100b1210d8ac2bed1eb3501256d4768e71bcb72c5e9927e29e258cffc1590f977d35847b572
7
- data.tar.gz: 4dfc11fade041d3309a9ef17c846a380e54fd61b6b8537a775c9c63bf27835576917e44396b44a89497a82e93c91e2f3a3f9198251087e439dcfeda524749824
6
+ metadata.gz: 137f4306f2c7cfe16ffd5616567060d6819f4a3cb660afada004bcfc78d32d00ece4fdfe14d8ecb042adb67a1f8771237a5b456e59b2b32b0ca6adc8009f7247
7
+ data.tar.gz: b8d7276446e1d80b7bf92994a380a0ffc50936598e13fae18ab069c937755f8a527bebbd2615bc6fb13b505ac30c457fbd74f514a3e3678108f84021aa7b5e94
data/lib/driver.rb CHANGED
@@ -206,7 +206,7 @@ class Driver
206
206
  def self.verify_url(given_url)
207
207
  Log.debug('[Gridium::Driver] Verifying URL...')
208
208
  current_url = self.current_url.to_s
209
- current_domain = self.current_domain.to_s
209
+
210
210
  if current_url.include?(given_url)
211
211
  Log.debug("[Gridium::Driver] Confirmed. (#{current_url}) includes (#{given_url}).")
212
212
  $verification_passes += 1
@@ -248,23 +248,30 @@ class Driver
248
248
  driver.execute_script "return #{script}"
249
249
  end
250
250
 
251
+ #
252
+ # Saves the screenshot of browser to local disk. Uploads if S3, if configured
253
+ # @return [String] screenshot_path - Local path, or S3 url
254
+ #
251
255
  def self.save_screenshot(type = 'saved')
252
256
  Log.debug ("[Gridium::Driver] Capturing screenshot of browser...")
253
257
  timestamp = Time.now.strftime("%Y_%m_%d__%H_%M_%S")
254
- screenshot_path = File.join($current_run_dir, "screenshot__#{timestamp}__#{type}.png")
255
- driver.save_screenshot(screenshot_path)
256
- _save_to_s3_if_configured(screenshot_path)
257
- SpecData.screenshots_captured.push("screenshot__#{timestamp}__#{type}.png") # used by custom_formatter.rb for embedding in report
258
- screenshot_path
259
- end
258
+ filename = "screenshot__#{timestamp}__#{type}.png"
259
+ screenshot_path = local_path = File.join($current_run_dir, filename)
260
260
 
261
- def self._save_to_s3_if_configured(screenshot_path)
261
+ # Save screenshot locally
262
+ driver.save_screenshot(local_path)
263
+ Log.info("[Gridium::Driver] screenshot saved to #{local_path}")
264
+
265
+ # Push the screenshot up to S3?
262
266
  if Gridium.config.screenshots_to_s3
263
- url = @s3.save_file(screenshot_path)
264
- Log.info("[Gridium::Driver] #{screenshot_path} saved to #{url}")
267
+ screenshot_path = @s3.save_file(local_path)
268
+ Log.info("[Gridium::Driver] #{filename} uploaded to S3 at '#{screenshot_path}'")
265
269
  end
266
- end
267
270
 
271
+ SpecData.screenshots_captured.push filename # used by custom_formatter.rb for embedding in report
272
+
273
+ screenshot_path
274
+ end
268
275
 
269
276
  def self.list_open_windows
270
277
  handles = driver.window_handles
data/lib/testrail.rb CHANGED
@@ -59,20 +59,28 @@ module Gridium
59
59
  if rspec_test.nil? then
60
60
  Log.error("[GRIDIUM::TestRail] No test added to results. Turn of Gridium.config.testrail\n")
61
61
  end
62
+
62
63
  if rspec_test.exception
63
64
  status = CONFIG[:fail]
64
65
  message = rspec_test.exception.message
66
+ screenshot_url = rspec_test.metadata[:screenshot_url]
67
+ if screenshot_url
68
+ message << "- Screenshot: #{screenshot_url}"
69
+ end
65
70
  else
66
71
  status = CONFIG[:pass]
67
72
  message = 'Test Passed.'
68
73
  end
74
+
69
75
  test_info = {:case_id => rspec_test.metadata[:testrail_id], :status_id => status, :comment => message}
76
+
70
77
  @tc_results.push(test_info)
71
78
  @tc_ids.push(test_info[:case_id])
72
79
  added = true
73
- end
74
- return added
75
- end
80
+ end
81
+
82
+ return added
83
+ end
76
84
 
77
85
  # Updates the existing test run with test cases and results. Adds error text for missing test cases if needed. Closes the run as long as it exists.
78
86
  #
@@ -151,5 +159,4 @@ module Gridium
151
159
  result
152
160
  end
153
161
  end
154
-
155
162
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gridium
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.36
4
+ version: 1.1.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Urban
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-25 00:00:00.000000000 Z
11
+ date: 2017-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler