gridium 1.1.4 → 1.1.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5afb000b28c6a5271c7adc72058da0149f08f0c6
4
- data.tar.gz: bacae083805b6a0627a61c9fbf4a24d5ec6eb792
3
+ metadata.gz: 8c37c23107f1ae26c02fd119eaabe1859c735c4c
4
+ data.tar.gz: 7f1d7a20b482758fc98a9846cd5ae868963440d7
5
5
  SHA512:
6
- metadata.gz: 0dcfab74f168f8953be2218760e86a9e63d028f3dc6503497f38746f1ebacb364ec7214042ca7e7ae1f4b0bc9d819efc925de3885e22a027d0468fc5b61a8695
7
- data.tar.gz: 20f2b1fd5b94478555ab99e315bda70d2b8d7075dc488f7897c8a420b687a0670318990456eb1ce26e32449aee9bff164d92c55a2d636c2fd5c2f11e52f74cd8
6
+ metadata.gz: de424541acc114d9ed7704516e9142d853b9dccb7d0042a8b3c35cd2f154fde6e8b4bb083d9a6a5d2deaae2aa414ca0bd307e54600a2689f9527486a106ff384
7
+ data.tar.gz: dd424381fda6c4a185817ef49dac3a6ac81f0f2ac5e9aa0649cc14567107fb9680586941c04a94383465b37242976219116d5b543ecb53f561f931f8921266d6
data/README.md CHANGED
@@ -30,6 +30,7 @@ To get started using Gridium add the Gem to your automated test library. Includ
30
30
  Gridium.configure do |config|
31
31
  config.report_dir = '/path/to/automation/project'
32
32
  config.browser_source = :local
33
+ config.selenium_log_level = 'OFF' #OFF, SEVERE, WARNING, INFO, DEBUG, ALL https://github.com/SeleniumHQ/selenium/wiki/Logging
33
34
  config.target_environment = "Integration"
34
35
  config.browser = :firefox
35
36
  config.url = "http://www.applicationundertest.com"
@@ -95,6 +96,8 @@ You may be saying to yourself - 'Holy Crap that's a lot of settings!'. Yeah. I
95
96
 
96
97
  ##### Gridium Configuration Options:
97
98
  `config.report_dir = '/path/to/automation/project'`: This setting tells Gridium where to write reports (i.e. Log files) out to. This could and probably will be changed at some point to eliminate some required Rspec.configuration options.
99
+ `config.browser_source = :local` = This to use a local or remote (with grid) webdriver
100
+ `config.selenium_log_level = 'OFF'`: This tells gridium which level to use for Selenium's loggingPrefs, which are then logged at the debug level.
98
101
  `config.target_environment = "Stage"`: This is a simple log entry to tell remind you which environment you're testing.
99
102
  `config.browser = :firefox`: This tells gridium which browser you will be testing. Only firefox is working currently. Future browsers to come.
100
103
  `config.url = "http://www.applicationundertest.com"`: Where's the entry point for your web application?
@@ -104,9 +107,9 @@ You may be saying to yourself - 'Holy Crap that's a lot of settings!'. Yeah. I
104
107
  `config.highlight_verifications = true`: Will highlight the element Gridium finds in the browser. This makes watching tests run easier to follow, although it does slow the test execution time down. Recommend this is turned off for automated tests running in Jenkins or headless mode.
105
108
  `config.highlight_duration = 0.100`: How long should the element be highlighted (in milliseconds) before the action is performed on the element.
106
109
  `config.screenshot_on_failure = false`: Take a screenshot on failure. On or off. Obviously.
107
- `config.screenshots_to_s3 = false`: This option allows users to save screenshots to an s3 bucket. AWS S3 buckets need to be setup and configured in AWS. Environment variables needs to be set for S3. See environment variables section.
108
- `config.project_name_for_s3 = 'GRIDIUM'`: This will be appended to the filename in the front of the file. Should not contain spaces.
109
- `config.subdirectory_name_for_s3 = 'TEST NAME'`: This will be the directory in S3 root to store the files. Used primarily to differentiate between project artifacts in the same s3 bucket.
110
+ `config.screenshots_to_s3 = false`: This option allows users to save screenshots to an s3 bucket. AWS S3 buckets need to be setup and configured in AWS. Environment variables needs to be set for S3. See environment variables section.
111
+ `config.project_name_for_s3 = 'GRIDIUM'`: This will be appended to the filename in the front of the file. Should not contain spaces.
112
+ `config.subdirectory_name_for_s3 = 'TEST NAME'`: This will be the directory in S3 root to store the files. Used primarily to differentiate between project artifacts in the same s3 bucket.
110
113
  `config.testrail = true`: This to enable TestRail integration. With this turned on, test results will be updated in your TestRail instance.
111
114
 
112
115
  ##### Environment variables
@@ -146,7 +149,7 @@ $errors_total = 0
146
149
  Spec_data.load_suite_state
147
150
  Spec_data.load_spec_state
148
151
  ```
149
- ##Saving screenshots to S3
152
+ ## Saving screenshots to S3
150
153
 
151
154
  S3 support is available for persisting screenshots online. This is especially helpful when running tests in CI and/or Docker environments.
152
155
 
@@ -203,6 +206,17 @@ Page object are made up of Elements. The methods on the page object tells the t
203
206
 
204
207
  This action will return a new page, that our test is setup to handle.
205
208
 
209
+ ## Logging
210
+ A log file will always be created with at least one line, showing whichever config.log_level is set to.
211
+ This file can be found in `spec_reports/spec_results_{timestamp}/{timestamp}_spec.log` alongside any screenshots taken.
212
+ Any log statements using a level equal or lower than config.log_level will be logged.
213
+
214
+ #### Selenium Logging
215
+ The supported log levels in selenium are OFF, SEVERE, WARNING, INFO, DEBUG, ALL
216
+ To open the firehose to selenium's logging (https://github.com/SeleniumHQ/selenium/wiki/Logging):
217
+ 1. Set `config.selenium_log_level = 'ALL'` to set each type of selenium logging (browser, driver, client, server) to 'ALL'
218
+ 2. Set `config.log_level = :debug` to have them picked up by gridium's logger.
219
+
206
220
  ## Elements
207
221
 
208
222
  Elements are the building blocks of page objects. Elements are anything that a user, or a test would care about on the page. To create a new Element, you will need three things:
data/docker-compose.yml CHANGED
@@ -16,7 +16,7 @@ services:
16
16
  - no_proxy=localhost
17
17
  - HUB_ENV_no_proxy=localhost
18
18
  ports:
19
- - "5900"
19
+ - "5900:5900"
20
20
  mustadio:
21
21
  image: yetanotherlucas/mustadio
22
22
  ports:
data/lib/driver.rb CHANGED
@@ -31,7 +31,7 @@ class Driver
31
31
  @browser_type = Gridium.config.browser
32
32
  ##Adding support for remote browsers
33
33
  if Gridium.config.browser_source == :remote
34
- @@driver = Selenium::WebDriver.for(:remote, url: Gridium.config.target_environment, desired_capabilities: Gridium.config.browser)
34
+ @@driver = Selenium::WebDriver.for(:remote, url: Gridium.config.target_environment, desired_capabilities: _set_capabilities())
35
35
  Log.debug("[Gridium::Driver] Remote Browser Requested: #{@@driver}")
36
36
  #this file detector is only used for remote drivers and is needed to upload files from test_host through Grid to browser
37
37
  @@driver.file_detector = lambda do |args|
@@ -54,6 +54,7 @@ class Driver
54
54
  end
55
55
  reset
56
56
  end
57
+ _log_shart #push out logs before doing something with selenium
57
58
  @@driver
58
59
  rescue Exception => e
59
60
  Log.debug("[Gridium::Driver] #{e.backtrace.inspect}")
@@ -63,6 +64,28 @@ class Driver
63
64
  end
64
65
  end
65
66
 
67
+ def self._log_shart
68
+ #squeeze out the logs between each selenium call
69
+ unless Gridium.config.selenium_log_level == 'OFF'
70
+ @@driver.manage.logs.available_types.each {|log_type|
71
+ @@driver.manage.logs.get(log_type).each {|log_statement|
72
+ Log.debug("[SELENIUM::LOGS::#{log_type.upcase}] #{log_statement}")
73
+ }
74
+ }
75
+ end
76
+ end
77
+
78
+ def self._set_capabilities()
79
+ log_level = Gridium.config.selenium_log_level
80
+ Selenium::WebDriver::Remote::Capabilities.new(
81
+ :browser_name => Gridium.config.browser,
82
+ # log all the things
83
+ :loggingPrefs => {:browser => log_level,
84
+ :client => log_level,
85
+ :driver => log_level,
86
+ :server => log_level}
87
+ )
88
+ end
66
89
 
67
90
  def self.s3
68
91
  #TODO figure out why I can't just use attr_reader :s3
@@ -105,6 +128,7 @@ class Driver
105
128
 
106
129
  def self.quit
107
130
  if @@driver
131
+ _log_shart #push out the last logs
108
132
  Log.debug('[Gridium::Driver] Shutting down web driver...')
109
133
  @@driver.quit
110
134
  @@driver = nil
data/lib/element.rb CHANGED
@@ -35,7 +35,7 @@ class Element
35
35
  if Gridium.config.visible_elements_only
36
36
  wait.until { @element = displayed_element }
37
37
  else
38
- wait.until { @element = @parent.find_element(@by, @locator); Log.debug("Finding element #{self}..."); @element.enabled? }
38
+ wait.until { @element = @parent.find_element(@by, @locator); Log.debug("[GRIDIUM::Element] Finding element #{self}..."); @element.enabled? }
39
39
  end
40
40
 
41
41
  end
@@ -57,14 +57,14 @@ class Element
57
57
  end
58
58
  end
59
59
  if found_element.nil?
60
- Log.debug "found #{elements.length} element(s) via #{@by} and #{@locator} and 0 are displayed"
60
+ Log.debug "[GRIDIUM::Element] found #{elements.length} element(s) via #{@by} and #{@locator} and 0 are displayed"
61
61
  end
62
62
  rescue StandardError => error
63
- Log.debug("element.displayed_element rescued: #{error}")
63
+ Log.debug("[GRIDIUM::Element] element.displayed_element rescued: #{error}")
64
64
  if found_element
65
- Log.warn("An element was found, but it was not displayed on the page. Gridium.config.visible_elements_only set to: #{Gridium.config.visible_elements_only} Element: #{self.to_s}")
65
+ Log.warn("[GRIDIUM::Element] An element was found, but it was not displayed on the page. Gridium.config.visible_elements_only set to: #{Gridium.config.visible_elements_only} Element: #{self.to_s}")
66
66
  else
67
- Log.warn("Could not find Element: #{self.to_s}")
67
+ Log.warn("[GRIDIUM::Element] Could not find Element: #{self.to_s}")
68
68
  end
69
69
  end
70
70
 
@@ -77,14 +77,14 @@ class Element
77
77
 
78
78
  # soft failure, will not kill test immediately
79
79
  def verify(timeout: nil)
80
- Log.debug('Verifying new element...')
80
+ Log.debug('[GRIDIUM::Element] Verifying new element...')
81
81
  timeout = Gridium.config.element_timeout if timeout.nil?
82
82
  ElementVerification.new(self, timeout)
83
83
  end
84
84
 
85
85
  # hard failure, will kill test immediately
86
86
  def wait_until(timeout: nil)
87
- Log.debug('Waiting for new element...')
87
+ Log.debug('[GRIDIUM::Element] Waiting for new element...')
88
88
  timeout = Gridium.config.element_timeout if timeout.nil?
89
89
  ElementVerification.new(self, timeout, fail_test: true)
90
90
  end
@@ -102,14 +102,14 @@ class Element
102
102
  def present?
103
103
  return element.enabled?
104
104
  rescue StandardError => error
105
- Log.debug("element.present? is false because this error was rescued: #{error}")
105
+ Log.debug("[GRIDIUM::Element] element.present? is false because this error was rescued: #{error}")
106
106
  return false
107
107
  end
108
108
 
109
109
  def displayed?
110
110
  return element.displayed?
111
111
  rescue StandardError => error
112
- Log.debug("element.displayed? is false because this error was rescued: #{error}")
112
+ Log.debug("[GRIDIUM::Element] element.displayed? is false because this error was rescued: #{error}")
113
113
  return false
114
114
  end
115
115
 
@@ -198,7 +198,7 @@ class Element
198
198
  end
199
199
 
200
200
  def hover_over
201
- Log.debug("Hovering over element (#{self.to_s})...")
201
+ Log.debug("[GRIDIUM::Element] Hovering over element (#{self.to_s})...")
202
202
  # @driver.mouse.move_to(element) # Note: Doesn't work with Selenium 2.42 bindings for Firefox v31
203
203
  # @driver.action.move_to(element).perform
204
204
  # @driver.mouse_over(@locator)
@@ -206,28 +206,28 @@ class Element
206
206
  $verification_passes += 1
207
207
  ElementExtensions.hover_over(self) # Javascript workaround to above issue
208
208
  else
209
- Log.error('Cannot hover over element. Element is not present.')
209
+ Log.error('[GRIDIUM::Element] Cannot hover over element. Element is not present.')
210
210
  end
211
211
  end
212
212
 
213
213
  def hover_away
214
- Log.debug("Hovering away from element (#{self.to_s})...")
214
+ Log.debug("[GRIDIUM::Element] Hovering away from element (#{self.to_s})...")
215
215
  if element.enabled?
216
216
  $verification_passes += 1
217
217
  ElementExtensions.hover_away(self) # Javascript workaround to above issue
218
218
  else
219
- Log.error('Cannot hover away from element. Element is not present.')
219
+ Log.error('[GRIDIUM::Element] Cannot hover away from element. Element is not present.')
220
220
  end
221
221
  end
222
222
 
223
223
  # Raw webdriver mouse over
224
224
  def mouse_over
225
- Log.debug("Triggering mouse over for (#{self.to_s})...")
225
+ Log.debug("[GRIDIUM::Element] Triggering mouse over for (#{self.to_s})...")
226
226
  if element.enabled?
227
227
  $verification_passes += 1
228
228
  ElementExtensions.mouse_over(self)
229
229
  else
230
- Log.error('Cannot mouse over. Element is not present.')
230
+ Log.error('[GRIDIUM::Element] Cannot mouse over. Element is not present.')
231
231
  end
232
232
  end
233
233
 
@@ -236,17 +236,17 @@ class Element
236
236
  $verification_passes += 1
237
237
  ElementExtensions.scroll_to(self)
238
238
  else
239
- Log.error('Cannot scroll element into view. Element is not present.')
239
+ Log.error('[GRIDIUM::Element] Cannot scroll element into view. Element is not present.')
240
240
  end
241
241
  end
242
242
 
243
243
  def trigger_onblur
244
- Log.debug("Triggering onblur for (#{self.to_s})...")
244
+ Log.debug("[GRIDIUM::Element] Triggering onblur for (#{self.to_s})...")
245
245
  if element.enabled?
246
246
  $verification_passes += 1
247
247
  ElementExtensions.trigger_onblur(self)
248
248
  else
249
- Log.error('Cannot trigger onblur. Element is not present.')
249
+ Log.error('[GRIDIUM::Element] Cannot trigger onblur. Element is not present.')
250
250
  end
251
251
  end
252
252
 
@@ -280,7 +280,7 @@ class Element
280
280
  # @return [Element] element
281
281
  #
282
282
  def find_element(by, locator)
283
- Log.debug('Finding element...')
283
+ Log.debug('[GRIDIUM::Element] Finding element...')
284
284
  Element.new("Child of #{@name}", by, locator, parent: @element)
285
285
  end
286
286
 
@@ -298,7 +298,7 @@ class Element
298
298
  end
299
299
 
300
300
  def save_element_screenshot
301
- Log.debug ("Capturing screenshot of element...")
301
+ Log.debug ("[GRIDIUM::Element] Capturing screenshot of element...")
302
302
  self.scroll_into_view
303
303
 
304
304
  timestamp = Time.now.strftime("%Y_%m_%d__%H_%M_%S")
@@ -324,28 +324,28 @@ class Element
324
324
  def compare_element_screenshot(base_image_path)
325
325
  #Returns TRUE if there are no differences, FALSE if there are
326
326
  begin
327
- Log.debug("Loading Images for Comparison...")
327
+ Log.debug("[GRIDIUM::Element] Loading Images for Comparison...")
328
328
  images = [
329
329
  ChunkyPNG::Image.from_file(base_image_path),
330
330
  ChunkyPNG::Image.from_file(@element_screenshot)
331
331
  ]
332
332
  #used to store image x,y diff
333
333
  diff = []
334
- Log.debug("Comparing Images...")
334
+ Log.debug("[GRIDIUM::Element] Comparing Images...")
335
335
  images.first.height.times do |y|
336
336
  images.first.row(y).each_with_index do |pixel, x|
337
337
  diff << [x,y] unless pixel == images.last[x,y]
338
338
  end
339
339
  end
340
340
 
341
- Log.debug("Pixels total: #{images.first.pixels.length}")
342
- Log.debug("Pixels changed: #{diff.length}")
343
- Log.debug("Pixels changed: #{(diff.length.to_f / images.first.pixels.length) * 100}%")
341
+ Log.debug("[GRIDIUM::Element] Pixels total: #{images.first.pixels.length}")
342
+ Log.debug("[GRIDIUM::Element] Pixels changed: #{diff.length}")
343
+ Log.debug("[GRIDIUM::Element] Pixels changed: #{(diff.length.to_f / images.first.pixels.length) * 100}%")
344
344
 
345
345
  x, y = diff.map{|xy| xy[0]}, diff.map{|xy| xy[1]}
346
346
 
347
347
  if x.any? && y.any?
348
- Log.debug("Differences Detected! Writing Diff Image...")
348
+ Log.debug("[GRIDIUM::Element] Differences Detected! Writing Diff Image...")
349
349
  name = self.name.gsub(' ', '_')
350
350
  #timestamp = Time.now.strftime("%Y_%m_%d__%H_%M_%S")
351
351
  element_screenshot_path = File.join($current_run_dir, "#{name}__diff_.png")
@@ -361,7 +361,7 @@ class Element
361
361
  end
362
362
 
363
363
  def method_missing(method_sym, *arguments, &block)
364
- Log.debug("called #{method_sym} on element #{@locator} by #{@by_type}")
364
+ Log.debug("[GRIDIUM::Element] called #{method_sym} on element #{@locator} by #{@by_type}")
365
365
  if @element.respond_to?(method_sym)
366
366
  @element.method(method_sym).call(*arguments, &block)
367
367
  else
@@ -373,10 +373,10 @@ class Element
373
373
 
374
374
  def stale?
375
375
  return true if @element.nil?
376
- @element.disabled?
376
+ @element.displayed?
377
377
  rescue StandardError => error
378
- Log.debug("element.stale? is true because this error was rescued: #{error}")
379
- Log.warn("Stale element detected.... #{self.to_s}")
378
+ Log.debug("[GRIDIUM::Element] element.stale? is true because this error was rescued: #{error}")
379
+ Log.warn("[GRIDIUM::Element] Stale element detected.... #{self.to_s}")
380
380
  return true
381
381
  end
382
382
 
@@ -385,10 +385,10 @@ class Element
385
385
  #
386
386
 
387
387
  def _stomp_input_text(*args)
388
- Log.debug("Clearing \"#{value}\" from element: (#{self})")
388
+ Log.debug("[GRIDIUM::Element] Clearing \"#{value}\" from element: (#{self})")
389
389
  element.clear
390
390
  sleep @text_padding_time
391
- Log.debug("Typing: #{args} into element: (#{self}).")
391
+ Log.debug("[GRIDIUM::Element] Typing: #{args} into element: (#{self}).")
392
392
  element.send_keys(*args)
393
393
  sleep @text_padding_time
394
394
  end
@@ -400,7 +400,7 @@ class Element
400
400
  #
401
401
 
402
402
  def field_empty_afterward?(*args)
403
- Log.debug("Checking the field after sending #{args}, to see if it's empty")
403
+ Log.debug("[GRIDIUM::Element] Checking the field after sending #{args}, to see if it's empty")
404
404
  check_again = (has_characters? *args and no_symbols? *args)
405
405
  field_is_empty_but_should_not_be = (check_again and field_empty?)
406
406
  if field_is_empty_but_should_not_be
@@ -2,7 +2,7 @@ include Gridium
2
2
 
3
3
  class Gridium::ElementExtensions
4
4
  def self.highlight(element)
5
- Log.debug("Highlighting element...")
5
+ Log.debug("[GRIDIUM::ElementExtensions] Highlighting element...")
6
6
  original_border = Driver.execute_script("return arguments[0].style.border", element.element)
7
7
  original_background = Driver.execute_script("return arguments[0].style.backgroundColor", element.element)
8
8
  Driver.execute_script("arguments[0].style.border='3px solid lime'; return;", element.element)
@@ -13,7 +13,7 @@ class Gridium::ElementExtensions
13
13
  end
14
14
 
15
15
  def self.scroll_to(element)
16
- Log.debug("Scrolling element into view...")
16
+ Log.debug("[GRIDIUM::ElementExtensions] Scrolling element into view...")
17
17
  Driver.execute_script("arguments[0].scrollIntoView(); return;", element.element)
18
18
  sleep 1
19
19
  end
@@ -14,7 +14,7 @@ class Gridium::ElementVerification
14
14
  end
15
15
 
16
16
  def not
17
- ElementVerification.new(@element, @timeout, @fail_test, element_should_exist: false)
17
+ ElementVerification.new(@element, @timeout, fail_test: @fail_test, element_should_exist: false)
18
18
  end
19
19
 
20
20
  def text(text)
@@ -25,7 +25,7 @@ class Gridium::ElementVerification
25
25
  if @element.present?
26
26
  $verification_passes += 1
27
27
  else
28
- Log.error("Cannot determine element text. Element is not present.")
28
+ Log.error("[GRIDIUM::ElementVerification] Cannot determine element text. Element is not present.")
29
29
  end
30
30
 
31
31
  if should_have_text
@@ -41,11 +41,11 @@ class Gridium::ElementVerification
41
41
  wait.until do
42
42
  element_contains_text = element_text.eql?(text)
43
43
  if should_have_text && element_contains_text
44
- Log.debug("Confirming text (#{text}) is within element...")
44
+ Log.debug("[GRIDIUM::ElementVerification] Confirming text (#{text}) is within element...")
45
45
  ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
46
46
  log_success(pass_message)
47
47
  elsif !should_have_text && !element_contains_text
48
- Log.debug("Confirming text (#{text}) is NOT within element...")
48
+ Log.debug("[GRIDIUM::ElementVerification] Confirming text (#{text}) is NOT within element...")
49
49
  ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
50
50
  log_success(pass_message)
51
51
  else
@@ -78,7 +78,7 @@ class Gridium::ElementVerification
78
78
  log_success(pass_message)
79
79
  return @element
80
80
  elsif !element_is_displayed && !should_be_visible
81
- Log.debug("Confirming element is NOT visible...")
81
+ Log.debug("[GRIDIUM::ElementVerification] Confirming element is NOT visible...")
82
82
  log_success(pass_message)
83
83
  else
84
84
  log_issue(fail_message)
@@ -110,7 +110,7 @@ class Gridium::ElementVerification
110
110
  log_success(pass_message)
111
111
  return @element
112
112
  elsif !element_is_present && !should_be_present
113
- Log.debug("Confirming element is NOT present...")
113
+ Log.debug("[GRIDIUM::ElementVerification] Confirming element is NOT present...")
114
114
  log_success(pass_message)
115
115
  else
116
116
  log_issue(fail_message)
@@ -145,17 +145,17 @@ class Gridium::ElementVerification
145
145
 
146
146
  def log_issue(message)
147
147
  if @fail_test
148
- Log.error("#{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
148
+ Log.error("[GRIDIUM::ElementVerification] #{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
149
149
  $fail_test_instantly = true
150
150
  Kernel.fail(message)
151
151
  else
152
- Log.error("#{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
152
+ Log.error("[GRIDIUM::ElementVerification] #{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
153
153
  $fail_test_at_end = true
154
154
  end
155
155
  end
156
156
 
157
157
  def log_success(pass_message)
158
158
  $verification_passes += 1
159
- Log.debug("Verified: '#{@element.name}' (By:(#{@element.by} => '#{@element.locator}')) #{pass_message}")
159
+ Log.debug("[GRIDIUM::ElementVerification] Verified: '#{@element.name}' (By:(#{@element.by} => '#{@element.locator}')) #{pass_message}")
160
160
  end
161
161
  end
data/lib/gridium.rb CHANGED
@@ -23,13 +23,14 @@ module Gridium
23
23
  class Config
24
24
  attr_accessor :report_dir, :browser_source, :target_environment, :browser, :url, :page_load_timeout, :element_timeout, :visible_elements_only, :log_level
25
25
  attr_accessor :highlight_verifications, :highlight_duration, :screenshot_on_failure, :screenshots_to_s3, :project_name_for_s3, :subdirectory_name_for_s3
26
- attr_accessor :testrail
26
+ attr_accessor :testrail, :selenium_log_level
27
27
 
28
28
  def initialize
29
29
  @report_dir = Dir.home
30
30
  @browser_source = :local #if browser source is set to remote, target environment needs to be set properly
31
+ @selenium_log_level = 'OFF' #OFF, SEVERE, WARNING, INFO, DEBUG, ALL https://github.com/SeleniumHQ/selenium/wiki/Logging
31
32
  @target_environment = "localhost"
32
- @browser = :firefox
33
+ @browser = :chrome
33
34
  @url = "about:blank"
34
35
  @page_load_timeout = 15
35
36
  @element_timeout = 15 #This needs to be changed to only look for an element after a page is done loading
data/lib/page.rb CHANGED
@@ -14,7 +14,7 @@ module Gridium
14
14
  if asserted_element.eql? nil
15
15
  fail("Could not find element on page with locator #{locator} using #{by}")
16
16
  else
17
- Log.info("Asserted Element present with locator #{locator} using #{by}")
17
+ Log.info("[GRIDIUM::Page] Asserted Element present with locator #{locator} using #{by}")
18
18
  end
19
19
  end
20
20
 
@@ -58,7 +58,7 @@ module Gridium
58
58
  element = wait.until {Driver.html.include? text}
59
59
  rescue Exception => exception
60
60
  Log.debug("[GRIDIUM::Page] has_flash? exception was rescued: #{exception}")
61
- Log.warn("Could not find the flash message!")
61
+ Log.warn("[GRIDIUM::Page] Could not find the flash message!")
62
62
  end
63
63
 
64
64
  if element
data/lib/spec_data.rb CHANGED
@@ -29,29 +29,29 @@ class SpecData
29
29
 
30
30
  def self.determine_spec_result
31
31
  if execution_warnings.empty?
32
- Log.info("No warnings detected during test run.")
32
+ Log.info("[GRIDIUM::SpecData] No warnings detected during test run.")
33
33
  else
34
- Log.info("Warnings detected during test run: (#{execution_warnings.length} total).")
34
+ Log.info("[GRIDIUM::SpecData]Warnings detected during test run: (#{execution_warnings.length} total).")
35
35
  msg = "Warning detected during test execution:"
36
36
  execution_warnings.each { |error_message| msg << "\n\t" + error_message }
37
37
  end
38
38
 
39
39
  if verification_errors.empty?
40
- Log.info("No errors detected during test run.")
40
+ Log.info("[GRIDIUM::SpecData]No errors detected during test run.")
41
41
  else
42
- Log.info("Errors detected during test run: (#{verification_errors.length} total).")
42
+ Log.info("[GRIDIUM::SpecData]Errors detected during test run: (#{verification_errors.length} total).")
43
43
  msg = "TEST FAILURE: Errors detected during test execution:"
44
44
  verification_errors.each { |error_message| msg << "\n\t" + error_message }
45
45
  end
46
46
 
47
47
  if $fail_test_instantly
48
- Log.info("TEST FAILED - CRITICAL ERROR DETECTED")
48
+ Log.info("[GRIDIUM::SpecData]TEST FAILED - CRITICAL ERROR DETECTED")
49
49
  Kernel.fail("TEST FAILED - CRITICAL ERROR DETECTED\n")
50
50
  elsif $fail_test_at_end
51
- Log.info("TEST FAILED - VERIFICATION ERRORS DETECTED")
51
+ Log.info("[GRIDIUM::SpecData]TEST FAILED - VERIFICATION ERRORS DETECTED")
52
52
  Kernel.fail("TEST FAILED - VERIFICATION ERRORS DETECTED\n")
53
53
  else
54
- Log.info("TEST PASSED\n")
54
+ Log.info("[GRIDIUM::SpecData]TEST PASSED\n")
55
55
  end
56
56
  end
57
57
 
data/lib/testrail.rb CHANGED
@@ -88,7 +88,7 @@ module Gridium
88
88
  r = _send_request('POST', "#{@url}add_results_for_cases/#{@run_info[:id]}", {results: @tc_results})
89
89
  Log.debug("[GRIDIUM::TestRail] ADD RESULTS: #{r}")
90
90
  sleep 0.25
91
- Log.debug("#{r.class}")
91
+ Log.debug("[GRIDIUM::TestRail] #{r.class}")
92
92
  if r.is_a?(Hash)
93
93
  r = _send_request('POST', "#{@url}update_run/#{@run_info[:id]}", {:name => "ER:#{@run_info[:name]}", :description => "#{@run_info[:desc]}\nThe following was returned when adding cases: #{r}"})
94
94
  Log.warn("[GRIDIUM::TestRail] ERROR: #{r}")
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.4
4
+ version: 1.1.6
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-03-24 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler