gridium 1.1.28 → 1.1.30

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 (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/lib/driver.rb +21 -19
  4. data/lib/page.rb +12 -1
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4190f23e60e937600e9f69efcc5ae88da1982718
4
- data.tar.gz: 00261f7a5f7d79bbba3aaed3bd6775117f7b4ed8
3
+ metadata.gz: 213f9190dc88a67d2af81d7295c0c3c800c16d88
4
+ data.tar.gz: 78f067959d4c161ff9785de978cbac955fe026bf
5
5
  SHA512:
6
- metadata.gz: bf9a61f86b883870be6dd8a3bce9e2c53ac871000cf475ed9dd04c2db9560e5567315d3bc829354a9f12cf0f9154bb0958b75f8c0769e0217e89eb9acb62ac8b
7
- data.tar.gz: 9e3ccf4929335bd931da745e69a1b521c17d1d19e4a190150b02409aafd848f0d4927473266f130c8e6d781e4118c01492d9ceab949c75cc157e892da450f5ef
6
+ metadata.gz: 8f57c5e9f4eb48d0cd1ca3c73679de5637a02cb081311b43e43cebd4fef62270744d1a3a95b87112a3b6c8741ccb272668e21b195fe5ffa76a8cf492bce43e8e
7
+ data.tar.gz: 58273f5d07b7daa4017feed916be9f01b17d37be48a6eed00f7a5a1d8798dd0caa891956ca88e873ab8f8ed4623b8924da114e8b85210cdcc9247d435545a6e4
data/README.md CHANGED
@@ -35,7 +35,7 @@ Gridium.configure do |config|
35
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
+ config.page_load_retries = 0
39
39
  config.element_timeout = 30
40
40
  config.visible_elements_only = true
41
41
  config.log_level = :debug
@@ -103,7 +103,7 @@ You may be saying to yourself - 'Holy Crap that's a lot of settings!'. Yeah. I
103
103
  `config.browser = :firefox`: This tells gridium which browser you will be testing. Only firefox is working currently. Future browsers to come.
104
104
  `config.url = "http://www.applicationundertest.com"`: Where's the entry point for your web application?
105
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.
106
+ `config.page_load_retries = 1` On a failure to load the requested page, Gridium will retry loading the page this many times.
107
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.
108
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.
109
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.
data/lib/driver.rb CHANGED
@@ -121,26 +121,28 @@ class Driver
121
121
  Log.debug("[Gridium::Driver] Driver.Visit: #{@@driver}")
122
122
  retries = Gridium.config.page_load_retries
123
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
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
124
+ begin
125
+ if path
126
+ Log.debug("[Gridium::Driver] Navigating to url: (#{path}).")
127
+ driver
128
+ time_start = Time.now
129
+ driver.navigate.to(path)
130
+ time_end = Time.new
131
+ page_load = (time_end - time_start)
132
+ Log.debug("[Gridium::Driver] Page loaded in (#{page_load}) seconds.")
133
+ $verification_passes += 1
134
+ end
135
+ rescue StandardError => e
136
+ Log.debug("[Gridium::Driver] #{e.backtrace.inspect}")
137
+ 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).")
138
+ if retries > 0
139
+ Log.info("[Gridium::Driver] Retrying page load of #{path}")
140
+ retries -= 1
141
+ retry
142
+ end
142
143
 
143
- raise e
144
+ raise e
145
+ end
144
146
  end
145
147
 
146
148
  def self.nav(path)
data/lib/page.rb CHANGED
@@ -53,7 +53,18 @@ module Gridium
53
53
  wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
54
54
 
55
55
  begin
56
- wait.until {Driver.driver.find_element(:link_text, linktext).enabled?}
56
+ elem = nil
57
+ wait.until do
58
+ elem = Driver.driver.find_element(:link_text, linktext)
59
+ elem.enabled?
60
+ end
61
+
62
+ if opts[:href]
63
+ href = elem.attribute 'href'
64
+ raise "Failed to verify link href='#{opts[:href]}': #{href} != #{opts[:href]}" unless href == opts[:href]
65
+ end
66
+
67
+ return true
57
68
  rescue Exception => exception
58
69
  Log.debug("[GRIDIUM::Page] has_link? is false because this exception was rescued: #{exception}")
59
70
  return false
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.28
4
+ version: 1.1.30
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-07-06 00:00:00.000000000 Z
11
+ date: 2017-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler