gridium 1.1.24 → 1.1.25

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: 5de1d40afe9f3ad0aa18c4ba6d832e7b631999f3
4
- data.tar.gz: 72737f602a9367424e46e88c6ee6fccfb2033cbb
3
+ metadata.gz: 64e37785b0fd534f29be75224f56e42b00fbe187
4
+ data.tar.gz: 8b543dfb9d00c5740d1dd67dba2049e01b919789
5
5
  SHA512:
6
- metadata.gz: 0adc53ee7d638764b5eacdbde183d70c2e0332e1ddec21af49b1cdbda20ad5bd30429008526ab640bb4d6975c804f9b6ba6c54d70c6bbb1aaa8711d4d2cff682
7
- data.tar.gz: c4deb07b0b3bba2838563ea8e6755a504474c108c0f881f420a66836334c92227f44e46921feb4b24fe70660de595288a2d3ab51b71cff24c266fc8207052932
6
+ metadata.gz: c1310752c003b974f0d86dcddbd81ce06e9b16e0bea2669b3ebfee63c13f3c32a7117462ad353a3523b24ba107421fc8ddf20a6436507efb3864802cb33df8ea
7
+ data.tar.gz: 8f0f77d39ccdf72dc64ad25910bff5409dae93f3c2a6e3b6d2d6d465c6f10277dc82c3f660c2172b33fb588b5d668df4b9d39904559af9a423d4b182cdc08108
data/Gemfile CHANGED
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in gridium.gemspec
4
4
  gemspec
5
+ gem 'selenium-webdriver', '= 3.4.0'
data/README.md CHANGED
@@ -32,9 +32,10 @@ Gridium.configure do |config|
32
32
  config.browser_source = :local
33
33
  config.selenium_log_level = 'OFF' #OFF, SEVERE, WARNING, INFO, DEBUG, ALL https://github.com/SeleniumHQ/selenium/wiki/Logging
34
34
  config.target_environment = "Integration"
35
- config.browser = :firefox
35
+ config.browser = :chrome
36
36
  config.url = "http://www.applicationundertest.com"
37
37
  config.page_load_timeout = 30
38
+ config.page_load_retry = 0
38
39
  config.element_timeout = 30
39
40
  config.visible_elements_only = true
40
41
  config.log_level = :debug
@@ -102,6 +103,7 @@ You may be saying to yourself - 'Holy Crap that's a lot of settings!'. Yeah. I
102
103
  `config.browser = :firefox`: This tells gridium which browser you will be testing. Only firefox is working currently. Future browsers to come.
103
104
  `config.url = "http://www.applicationundertest.com"`: Where's the entry point for your web application?
104
105
  `config.page_load_timeout = 30` Along with Element Timeout, how long (in seconds) should Selenium wait when finding an element?
106
+ `config.page_load_retry = 1` On a failure to load the requested page, Gridium will retry loading the page this many times.
105
107
  `config.visible_elements_only = true`: With this enabled Gridium will only find VISIBLE elements on the page. Hidden elements or non-enabled elements will not be matched.
106
108
  `config.log_level = :debug`: There are a few levels here `:debug` `:info` `:warn` `:error` and `:fatal`. Your Gridium tests objects can have different levels of logging. Adjusting this setting will turn those log levels on or off depending on your needs at the time.
107
109
  `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.
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "webmock", "~>2.3"
34
34
  spec.add_development_dependency "dotenv", "~>2.1"
35
35
 
36
- spec.add_runtime_dependency "selenium-webdriver", "3.3.0"
36
+ spec.add_runtime_dependency "selenium-webdriver", "~> 3.3"
37
37
  spec.add_runtime_dependency "oily_png", "~> 1.2"
38
38
  spec.add_runtime_dependency 'aws-sdk', '~> 2'
39
39
  end
@@ -3,7 +3,6 @@ require 'uri'
3
3
  require 'spec_data'
4
4
 
5
5
  class Driver
6
-
7
6
  @@driver = nil
8
7
 
9
8
  def self.reset
@@ -12,7 +11,6 @@ class Driver
12
11
  driver.manage.timeouts.page_load = Gridium.config.page_load_timeout
13
12
  driver.manage.timeouts.implicit_wait = 0 # always use explicit waits!
14
13
 
15
- # Ensure the browser is maximized to maximize visibility of element
16
14
  # Ensure the browser is maximized to maximize visibility of element
17
15
  # Currently doesn't work with chromedriver, but the following workaround does:
18
16
  if @browser_type.eql?(:chrome)
@@ -26,44 +24,42 @@ class Driver
26
24
  end
27
25
 
28
26
  def self.driver
29
- begin
30
- unless @@driver
31
- Log.debug("[Gridium::Driver] Driver.driver: instantiating new driver")
32
- @browser_type = Gridium.config.browser
33
- ##Adding support for remote browsers
34
- if Gridium.config.browser_source == :remote
35
- @@driver = Selenium::WebDriver.for(:remote, url: Gridium.config.target_environment, desired_capabilities: _set_capabilities())
36
- Log.debug("[Gridium::Driver] Remote Browser Requested: #{@@driver}")
37
-
38
- #this file detector is only used for remote drivers and is needed to upload files from test_host through Grid to browser
39
- @@driver.file_detector = lambda do |args|
40
- str = args.first.to_s
41
- str if File.exist?(str)
42
- end
43
- else
44
- @@driver = Selenium::WebDriver.for(Gridium.config.browser, desired_capabilities: _set_capabilities())
45
- end
46
- if Gridium.config.screenshots_to_s3
47
- #do stuff
48
- s3_project_folder = Gridium.config.project_name_for_s3
49
- s3_subfolder = Gridium.config.subdirectory_name_for_s3
50
- Log.debug("[Gridium::Driver] configuring s3 to save files to this directory: #{s3_project_folder} in addition to being saved locally")
51
- @s3 = Gridium::GridiumS3.new(s3_project_folder, s3_subfolder)
52
- Log.debug("[Gridium::Driver] s3 is #{@s3}")
53
- else
54
- Log.debug("[Gridium::Driver] s3 screenshots not enabled in spec_helper; they will be only be saved locally")
55
- @s3 = nil
27
+ unless @@driver
28
+ Log.debug("[Gridium::Driver] Driver.driver: instantiating new driver")
29
+ @browser_type = Gridium.config.browser
30
+ ##Adding support for remote browsers
31
+ if Gridium.config.browser_source == :remote
32
+ @@driver = Selenium::WebDriver.for(:remote, url: Gridium.config.target_environment, desired_capabilities: _set_capabilities)
33
+ Log.debug("[Gridium::Driver] Remote Browser Requested: #{@@driver}")
34
+
35
+ #this file detector is only used for remote drivers and is needed to upload files from test_host through Grid to browser
36
+ @@driver.file_detector = lambda do |args|
37
+ str = args.first.to_s
38
+ str if File.exist?(str)
56
39
  end
57
- reset
40
+ else
41
+ @@driver = Selenium::WebDriver.for(Gridium.config.browser, desired_capabilities: _set_capabilities)
58
42
  end
59
- _log_shart #push out logs before doing something with selenium
60
- @@driver
61
- rescue Exception => e
62
- Log.debug("[Gridium::Driver] #{e.backtrace.inspect}")
63
- Log.info("[Gridium::Driver] Driver did not load within (#{Gridium.config.page_load_timeout}) seconds. [#{e.message}]")
64
- $fail_test_instantly = true
65
- Kernel.fail(e.message)
43
+ if Gridium.config.screenshots_to_s3
44
+ #do stuff
45
+ s3_project_folder = Gridium.config.project_name_for_s3
46
+ s3_subfolder = Gridium.config.subdirectory_name_for_s3
47
+ Log.debug("[Gridium::Driver] configuring s3 to save files to this directory: #{s3_project_folder} in addition to being saved locally")
48
+ @s3 = Gridium::GridiumS3.new(s3_project_folder, s3_subfolder)
49
+ Log.debug("[Gridium::Driver] s3 is #{@s3}")
50
+ else
51
+ Log.debug("[Gridium::Driver] s3 screenshots not enabled in spec_helper; they will be only be saved locally")
52
+ @s3 = nil
53
+ end
54
+ reset
66
55
  end
56
+ _log_shart #push out logs before doing something with selenium
57
+ @@driver
58
+ rescue StandardError => e
59
+ Log.debug("[Gridium::Driver] #{e.backtrace.inspect}")
60
+ Log.info("[Gridium::Driver] Driver did not load within (#{Gridium.config.page_load_timeout}) seconds. [#{e.message}]")
61
+ $fail_test_instantly = true
62
+ Kernel.fail(e.message)
67
63
  end
68
64
 
69
65
  def self._log_shart
@@ -123,22 +119,28 @@ class Driver
123
119
 
124
120
  def self.visit(path)
125
121
  Log.debug("[Gridium::Driver] Driver.Visit: #{@@driver}")
126
- begin
127
- if path
128
- Log.debug("[Gridium::Driver] Navigating to url: (#{path}).")
129
- driver
130
- time_start = Time.now
131
- driver.navigate.to(path)
132
- time_end = Time.new
133
- page_load = (time_end - time_start)
134
- Log.debug("[Gridium::Driver] Page loaded in (#{page_load}) seconds.")
135
- $verification_passes += 1
136
- end
137
- rescue Exception => e
138
- Log.debug("[Gridium::Driver] #{e.backtrace.inspect}")
139
- Log.error("[Gridium::Driver] Timed out attempting to load #{path} for #{Gridium.config.page_load_timeout} seconds:\n#{e.message}\n - Also be sure to check the url formatting. http:// is required for proper test execution (www is optional).")
140
- raise e
122
+ retries = Gridium.config.page_load_retries
123
+
124
+ if path
125
+ Log.debug("[Gridium::Driver] Navigating to url: (#{path}).")
126
+ driver
127
+ time_start = Time.now
128
+ driver.navigate.to(path)
129
+ time_end = Time.new
130
+ page_load = (time_end - time_start)
131
+ Log.debug("[Gridium::Driver] Page loaded in (#{page_load}) seconds.")
132
+ $verification_passes += 1
141
133
  end
134
+ rescue StandardError => e
135
+ Log.debug("[Gridium::Driver] #{e.backtrace.inspect}")
136
+ Log.error("[Gridium::Driver] Timed out attempting to load #{path} for #{Gridium.config.page_load_timeout} seconds:\n#{e.message}\n - Also be sure to check the url formatting. http:// is required for proper test execution (www is optional).")
137
+ if retries > 0
138
+ Log.info("[Gridium::Driver] Retrying page load of #{path}")
139
+ retries -= 1
140
+ retry
141
+ end
142
+
143
+ raise e
142
144
  end
143
145
 
144
146
  def self.nav(path)
@@ -183,11 +183,11 @@ class Element
183
183
  unless element.enabled?
184
184
  raise "Browser Error: tried to enter #{args} but the input is disabled"
185
185
  end
186
- if only_symbols? *args
187
- append_keys *args
186
+ if only_symbols?(*args)
187
+ append_keys(*args)
188
188
  else
189
- _stomp_input_text *args
190
- field_empty_afterward? *args
189
+ _stomp_input_text(*args)
190
+ field_empty_afterward?(*args)
191
191
  end
192
192
  end
193
193
  alias_method :text=, :send_keys
@@ -227,7 +227,7 @@ class Element
227
227
  end
228
228
 
229
229
  # Raw webdriver mouse over
230
- def mouse_over(x: 0, y: 0)
230
+ def mouse_over(x: 1, y: 1)
231
231
  Log.debug("[GRIDIUM::Element] Triggering mouse over for (#{self.to_s})...")
232
232
  if element.enabled?
233
233
  $verification_passes += 1
@@ -21,7 +21,7 @@ module Gridium
21
21
  end
22
22
 
23
23
  class Config
24
- attr_accessor :report_dir, :browser_source, :target_environment, :browser, :url, :page_load_timeout, :element_timeout, :visible_elements_only, :log_level
24
+ attr_accessor :report_dir, :browser_source, :target_environment, :browser, :url, :page_load_timeout, :page_load_retries, :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
26
  attr_accessor :testrail, :selenium_log_level
27
27
 
@@ -33,6 +33,7 @@ module Gridium
33
33
  @browser = :chrome
34
34
  @url = "about:blank"
35
35
  @page_load_timeout = 15
36
+ @page_load_retries = 0
36
37
  @element_timeout = 15 #This needs to be changed to only look for an element after a page is done loading
37
38
  @visible_elements_only = true
38
39
  @log_level = :fatal
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.24
4
+ version: 1.1.25
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-06-19 00:00:00.000000000 Z
11
+ date: 2017-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,16 +84,16 @@ dependencies:
84
84
  name: selenium-webdriver
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '='
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 3.3.0
89
+ version: '3.3'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '='
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 3.3.0
96
+ version: '3.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: oily_png
99
99
  requirement: !ruby/object:Gem::Requirement