gridium 1.1.13 → 1.1.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/element.rb +3 -1
  3. data/lib/page.rb +14 -8
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acd1b2c1b0d1f4e0f4e5990735247e7cdac1cb20
4
- data.tar.gz: 9009bf8fc720f0042065e4ffad60e48533c56b8a
3
+ metadata.gz: fb7127799f6a1c83d18a5a139f7b84f9d54f7844
4
+ data.tar.gz: 9af4c6ec7a7ebd639158cd076cb9f7d55326abff
5
5
  SHA512:
6
- metadata.gz: 30fc0a6d19199d5175527b402315665b6fce86c3cd957d139c44b8e3f8a4b249cebf4eea89590b6895f82ecd1963391bd3e0b8a4f0f1a4bdc7d967d1caf2640c
7
- data.tar.gz: 965bf7126e8e29131c66c402d555f26d5b6cdb8e39d73c55f75140c8cbe5a794971790f6d2cac64d1230403ebc61ecb4abae7f503d4558754f826984fe2e3918
6
+ metadata.gz: 20f987944c09a29fa4ce3d58feb17c2415a4bcf3d0fee50b3823ab4f06c3b8b084033b68be4215779089e4822de734dc968bf98ed88db8a0d1dab9f2fc0c2b6e
7
+ data.tar.gz: 0f3de5442e613dfb7955f4562b10ffa9fc22bb0745aa978998674f4df4a387fd8cbf6402f6615e2d5ce3dd2b0325f36fcfb63de7ffdb921acde08e47ae36f1b2
@@ -23,6 +23,8 @@ class Element
23
23
 
24
24
  #how long to wait between clearing an input and sending keys to it
25
25
  @text_padding_time = 0.15
26
+
27
+ @default_timeout = Gridium.config.element_timeout
26
28
  end
27
29
 
28
30
  def to_s
@@ -30,7 +32,7 @@ class Element
30
32
  end
31
33
 
32
34
  def element(opts = {})
33
- timeout = opts[:timeout].nil? ? Gridium.config.element_timeout : opts[:timeout]
35
+ timeout = opts[:timeout].nil? ? @default_timeout : opts[:timeout]
34
36
 
35
37
  if stale?
36
38
  wait = Selenium::WebDriver::Wait.new :timeout => timeout, :interval => 1
@@ -48,17 +48,23 @@ module Gridium
48
48
  end
49
49
  end
50
50
 
51
- def self.has_text?(text)
52
- has_flash?(text)
51
+
52
+ def self.has_text?(text, opts = {})
53
+ has_flash?(text, opts)
53
54
  end
54
55
 
55
- def self.has_flash?(text)
56
- wait = Selenium::WebDriver::Wait.new(:timeout => 5) #5 seconds every 500ms
56
+ def self.has_flash?(text, opts = {})
57
+ timeout = opts[:timeout] || 5
58
+ wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
57
59
  begin
58
- element = wait.until {Driver.html.include? text}
60
+ if opts[:visible]
61
+ element = wait.until { Element.new("Finding text '#{text}'", :xpath, "//*[text()='#{text}']").displayed? }
62
+ else
63
+ element = wait.until { Driver.html.include? text }
64
+ end
59
65
  rescue Exception => exception
60
- Log.debug("[GRIDIUM::Page] has_flash? exception was rescued: #{exception}")
61
- Log.warn("[GRIDIUM::Page] Could not find the flash message!")
66
+ Log.debug("[GRIDIUM::Page] exception was rescued: #{exception}")
67
+ Log.warn("[GRIDIUM::Page] Could not find the text '#{text}'!")
62
68
  end
63
69
 
64
70
  if element
@@ -122,7 +128,7 @@ module Gridium
122
128
  end
123
129
 
124
130
  def click_on(text)
125
- Element.new("Clicking #{text}", :xpath, "//*[text()='#{text}')]").click
131
+ Element.new("Clicking #{text}", :xpath, "//*[text()='#{text}']").click
126
132
  end
127
133
 
128
134
  # Click the link on the page
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.13
4
+ version: 1.1.14
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-05-11 00:00:00.000000000 Z
11
+ date: 2017-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler