gridium 1.1.22 → 1.1.23
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.
- checksums.yaml +4 -4
- data/lib/driver.rb +12 -9
- data/lib/element.rb +4 -6
- data/lib/page.rb +17 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99d9a0327b2766d11841ca658aa1d89dacfeebaa
|
4
|
+
data.tar.gz: 1a722adc617c41d31257a7e92aa1eb16839e1d87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d89cbb80dcaca9d578e5575621716a61d0e696b59939b85041d163a7ef5b4da295508504be504997364aeed004d24b5dbad58ed3e308cb05d79e8a9962da21e5
|
7
|
+
data.tar.gz: 13b284321a6065f614b86d2e111c6d7129f4311be765ab27acff7067df715327978f69d4d892e9ecab8abc45906932fa8ac0a72d56db3a7cac26082bd262416f
|
data/lib/driver.rb
CHANGED
@@ -89,16 +89,19 @@ class Driver
|
|
89
89
|
:server => log_level
|
90
90
|
},
|
91
91
|
chrome_options: {
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
92
|
+
args: ['--start-maximized', '--privileged', '--disable-web-security'],
|
93
|
+
prefs: {
|
94
|
+
# Need configurable download directory. Currently not supported on Selenium Grid
|
95
|
+
download: {
|
96
|
+
prompt_for_download: false,
|
97
|
+
directory_upgrade: true,
|
98
|
+
default_directory: Dir.pwd,
|
99
|
+
extensions_to_open: ""
|
98
100
|
},
|
99
|
-
|
100
|
-
|
101
|
-
}
|
101
|
+
save_file: {
|
102
|
+
default_directory: Dir.pwd
|
103
|
+
},
|
104
|
+
credentials_enable_service: false
|
102
105
|
}
|
103
106
|
}
|
104
107
|
)
|
data/lib/element.rb
CHANGED
@@ -10,6 +10,7 @@ class Element
|
|
10
10
|
@name = name
|
11
11
|
@by = by
|
12
12
|
@locator = locator
|
13
|
+
@timeout = opts[:timeout] || Gridium.config.element_timeout
|
13
14
|
@element_screenshot = nil #used to store the path of element screenshots for comparison
|
14
15
|
|
15
16
|
# wrapped driver
|
@@ -23,8 +24,6 @@ class Element
|
|
23
24
|
|
24
25
|
#how long to wait between clearing an input and sending keys to it
|
25
26
|
@text_padding_time = 0.15
|
26
|
-
|
27
|
-
@default_timeout = Gridium.config.element_timeout
|
28
27
|
end
|
29
28
|
|
30
29
|
def to_s
|
@@ -32,8 +31,7 @@ class Element
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def element(opts = {})
|
35
|
-
timeout = opts[:timeout]
|
36
|
-
|
34
|
+
timeout = opts[:timeout] || @timeout
|
37
35
|
if stale?
|
38
36
|
wait = Selenium::WebDriver::Wait.new :timeout => timeout, :interval => 1
|
39
37
|
if Gridium.config.visible_elements_only
|
@@ -80,13 +78,13 @@ class Element
|
|
80
78
|
# ================ #
|
81
79
|
|
82
80
|
# soft failure, will not kill test immediately
|
83
|
-
def verify(timeout:
|
81
|
+
def verify(timeout: @timeout)
|
84
82
|
Log.debug('[GRIDIUM::Element] Verifying new element...')
|
85
83
|
ElementVerification.new(self, timeout)
|
86
84
|
end
|
87
85
|
|
88
86
|
# hard failure, will kill test immediately
|
89
|
-
def wait_until(timeout:
|
87
|
+
def wait_until(timeout: @timeout)
|
90
88
|
Log.debug('[GRIDIUM::Element] Waiting for new element...')
|
91
89
|
ElementVerification.new(self, timeout, fail_test: true)
|
92
90
|
end
|
data/lib/page.rb
CHANGED
@@ -48,8 +48,10 @@ module Gridium
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
def self.has_link?(linktext)
|
52
|
-
|
51
|
+
def self.has_link?(linktext, opts = {})
|
52
|
+
timeout = opts[:timeout] || 5
|
53
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
|
54
|
+
|
53
55
|
begin
|
54
56
|
wait.until {Driver.driver.find_element(:link_text, linktext).enabled?}
|
55
57
|
rescue Exception => exception
|
@@ -58,6 +60,18 @@ module Gridium
|
|
58
60
|
end
|
59
61
|
end
|
60
62
|
|
63
|
+
def self.has_button?(button_text, opts = {})
|
64
|
+
timeout = opts[:timeout] || 5
|
65
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
|
66
|
+
|
67
|
+
begin
|
68
|
+
elem = Element.new("#{button_text} button", :xpath, "//button[contains(., \"#{button_text}\")]", timeout: timeout)
|
69
|
+
wait.until {elem.enabled?}
|
70
|
+
rescue Exception => exception
|
71
|
+
Log.debug("[GRIDIUM::Page] has_button? is false because this exception was rescued: #{exception}")
|
72
|
+
return false
|
73
|
+
end
|
74
|
+
end
|
61
75
|
|
62
76
|
def self.has_text?(text, opts = {})
|
63
77
|
has_flash?(text, opts)
|
@@ -68,7 +82,7 @@ module Gridium
|
|
68
82
|
wait = Selenium::WebDriver::Wait.new(:timeout => timeout)
|
69
83
|
begin
|
70
84
|
if opts[:visible]
|
71
|
-
element = wait.until { Element.new("Finding text '#{text}'", :xpath, "//*[text()=\"#{text}\"]").displayed? }
|
85
|
+
element = wait.until { Element.new("Finding text '#{text}'", :xpath, "//*[text()=\"#{text}\"]", timeout: timeout).displayed? }
|
72
86
|
else
|
73
87
|
element = wait.until { Driver.html.include? text }
|
74
88
|
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.
|
4
|
+
version: 1.1.23
|
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-
|
11
|
+
date: 2017-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubyforge_project:
|
184
|
-
rubygems_version: 2.6.
|
184
|
+
rubygems_version: 2.6.12
|
185
185
|
signing_key:
|
186
186
|
specification_version: 4
|
187
187
|
summary: This Gem is used to make building Selenium Tests without Capybara Easier.
|