gridium 1.1.10 → 1.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/start +1 -2
- data/lib/driver.rb +1 -1
- data/lib/element.rb +7 -9
- data/lib/element_verification.rb +12 -9
- data/lib/page.rb +5 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c60d0c86933dc7c134b4a1df4477e7383f7e4b
|
4
|
+
data.tar.gz: ac75c7b23af931d5922504a683a5d7b549ae6d31
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e47b40b45770b778ba05e13a0fee50578cedc829172d66fb40f3bb03b3a6a6e719cd7215403bfb512392751960956e0b219dd63ba563140b108d574cd195ad59
|
7
|
+
data.tar.gz: 0e6d8a037c6fcfd25ec5c88a2b8237fde5be80bbbb05c54478d6f63dfc5a07f10a79f50d34af19e217f0add8d8d7c1b7b591100490da984becd9cf9a1515953f
|
data/bin/start
CHANGED
@@ -7,8 +7,7 @@ main(){
|
|
7
7
|
docker exec $(docker-compose ps -q gridium) bundle install;
|
8
8
|
;;
|
9
9
|
-d) #start in development mode
|
10
|
-
|
11
|
-
export BUILD_NUMBER
|
10
|
+
export BUILD_NUMBER=${BUILD_NUMBER:=dev}
|
12
11
|
docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
|
13
12
|
docker exec $(docker-compose ps -q gridium) bundle install;
|
14
13
|
;;
|
data/lib/driver.rb
CHANGED
@@ -10,7 +10,7 @@ class Driver
|
|
10
10
|
Log.debug("[Gridium::Driver] Driver.reset: #{@@driver}")
|
11
11
|
driver.manage.delete_all_cookies
|
12
12
|
driver.manage.timeouts.page_load = Gridium.config.page_load_timeout
|
13
|
-
driver.manage.timeouts.implicit_wait =
|
13
|
+
driver.manage.timeouts.implicit_wait = 0 # always use explicit waits!
|
14
14
|
|
15
15
|
# Ensure the browser is maximized to maximize visibility of element
|
16
16
|
# Ensure the browser is maximized to maximize visibility of element
|
data/lib/element.rb
CHANGED
@@ -29,9 +29,11 @@ class Element
|
|
29
29
|
"'#{@name}' (By:#{@by} => '#{@locator}')"
|
30
30
|
end
|
31
31
|
|
32
|
-
def element
|
32
|
+
def element(opts = {})
|
33
|
+
timeout = opts[:timeout].nil? ? Gridium.config.element_timeout : opts[:timeout]
|
34
|
+
|
33
35
|
if stale?
|
34
|
-
wait = Selenium::WebDriver::Wait.new :timeout =>
|
36
|
+
wait = Selenium::WebDriver::Wait.new :timeout => timeout, :interval => 1
|
35
37
|
if Gridium.config.visible_elements_only
|
36
38
|
wait.until { @element = displayed_element }
|
37
39
|
else
|
@@ -76,16 +78,14 @@ class Element
|
|
76
78
|
# ================ #
|
77
79
|
|
78
80
|
# soft failure, will not kill test immediately
|
79
|
-
def verify(timeout:
|
81
|
+
def verify(timeout: Gridium.config.element_timeout)
|
80
82
|
Log.debug('[GRIDIUM::Element] Verifying new element...')
|
81
|
-
timeout = Gridium.config.element_timeout if timeout.nil?
|
82
83
|
ElementVerification.new(self, timeout)
|
83
84
|
end
|
84
85
|
|
85
86
|
# hard failure, will kill test immediately
|
86
|
-
def wait_until(timeout:
|
87
|
+
def wait_until(timeout: Gridium.config.element_timeout)
|
87
88
|
Log.debug('[GRIDIUM::Element] Waiting for new element...')
|
88
|
-
timeout = Gridium.config.element_timeout if timeout.nil?
|
89
89
|
ElementVerification.new(self, timeout, fail_test: true)
|
90
90
|
end
|
91
91
|
|
@@ -97,8 +97,6 @@ class Element
|
|
97
97
|
element.css_value(name)
|
98
98
|
end
|
99
99
|
|
100
|
-
|
101
|
-
|
102
100
|
def present?
|
103
101
|
return element.enabled?
|
104
102
|
rescue StandardError => error
|
@@ -258,7 +256,7 @@ class Element
|
|
258
256
|
else
|
259
257
|
Log.error('[GRIDIUM::Element] Cannot jquery_click. Element is not present.')
|
260
258
|
end
|
261
|
-
end
|
259
|
+
end
|
262
260
|
|
263
261
|
def size
|
264
262
|
element.size
|
data/lib/element_verification.rb
CHANGED
@@ -29,10 +29,10 @@ class Gridium::ElementVerification
|
|
29
29
|
end
|
30
30
|
|
31
31
|
if should_have_text
|
32
|
-
fail_message = "Element should contain text (#{text}), but does not."
|
32
|
+
fail_message = "Element should contain text (#{text}), but does not. timed out after #{@timeout} seconds"
|
33
33
|
pass_message = "contains text (#{text})."
|
34
34
|
else
|
35
|
-
fail_message = "Element should not contain text (#{text}), but does."
|
35
|
+
fail_message = "Element should not contain text (#{text}), but does. timed out after #{@timeout} seconds"
|
36
36
|
pass_message = "does not contain text (#{text}). Actual text is: (#{element_text})."
|
37
37
|
end
|
38
38
|
|
@@ -49,6 +49,7 @@ class Gridium::ElementVerification
|
|
49
49
|
ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
|
50
50
|
log_success(pass_message)
|
51
51
|
else
|
52
|
+
# TODO: @rizzza: This `.not` case is wrong. It bails too early and does not evaluate with the wait block
|
52
53
|
log_issue("#{fail_message} Element's text is: (#{element_text}).")
|
53
54
|
end
|
54
55
|
end
|
@@ -62,17 +63,17 @@ class Gridium::ElementVerification
|
|
62
63
|
should_be_visible = @should_exist
|
63
64
|
|
64
65
|
if should_be_visible
|
65
|
-
fail_message = "Element should be visible."
|
66
|
+
fail_message = "Element should be visible. timed out after #{@timeout} seconds"
|
66
67
|
pass_message = "Element is visible."
|
67
68
|
else
|
68
|
-
fail_message = "Element should not be visible."
|
69
|
+
fail_message = "Element should not be visible. timed out after #{@timeout} seconds"
|
69
70
|
pass_message = "Element is not visible."
|
70
71
|
end
|
71
72
|
|
72
73
|
wait = Selenium::WebDriver::Wait.new :timeout => @timeout, :interval => 1
|
73
74
|
begin
|
74
75
|
wait.until do
|
75
|
-
element_is_displayed = @element.displayed?
|
76
|
+
element_is_displayed = @element.element(timeout: @timeout).displayed?
|
76
77
|
if element_is_displayed && should_be_visible
|
77
78
|
ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
|
78
79
|
log_success(pass_message)
|
@@ -81,6 +82,7 @@ class Gridium::ElementVerification
|
|
81
82
|
Log.debug("[GRIDIUM::ElementVerification] Confirming element is NOT visible...")
|
82
83
|
log_success(pass_message)
|
83
84
|
else
|
85
|
+
# TODO: @rizzza: This `.not` case is wrong. It bails too early and does not evaluate with the wait block
|
84
86
|
log_issue(fail_message)
|
85
87
|
end
|
86
88
|
end
|
@@ -94,17 +96,17 @@ class Gridium::ElementVerification
|
|
94
96
|
should_be_present = @should_exist
|
95
97
|
|
96
98
|
if should_be_present
|
97
|
-
fail_message = "Element should be present."
|
99
|
+
fail_message = "Element should be present. timed out after #{@timeout} seconds"
|
98
100
|
pass_message = "is present."
|
99
101
|
else
|
100
|
-
fail_message = "Element should NOT be present."
|
102
|
+
fail_message = "Element should NOT be present. timed out after #{@timeout} seconds"
|
101
103
|
pass_message = "is not present."
|
102
104
|
end
|
103
105
|
|
104
106
|
wait = Selenium::WebDriver::Wait.new :timeout => @timeout, :interval => 1
|
105
107
|
begin
|
106
108
|
wait.until do
|
107
|
-
element_is_present = @element.present?
|
109
|
+
element_is_present = @element.element(timeout: @timeout).present?
|
108
110
|
if element_is_present && should_be_present
|
109
111
|
ElementExtensions.highlight(@element) if Gridium.config.highlight_verifications
|
110
112
|
log_success(pass_message)
|
@@ -113,6 +115,7 @@ class Gridium::ElementVerification
|
|
113
115
|
Log.debug("[GRIDIUM::ElementVerification] Confirming element is NOT present...")
|
114
116
|
log_success(pass_message)
|
115
117
|
else
|
118
|
+
# TODO: @rizzza: This `.not` case is wrong. It bails too early and does not evaluate with the wait block
|
116
119
|
log_issue(fail_message)
|
117
120
|
end
|
118
121
|
end
|
@@ -147,7 +150,7 @@ class Gridium::ElementVerification
|
|
147
150
|
if @fail_test
|
148
151
|
Log.error("[GRIDIUM::ElementVerification] #{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
|
149
152
|
$fail_test_instantly = true
|
150
|
-
|
153
|
+
raise Selenium::WebDriver::Error::TimeOutError, message
|
151
154
|
else
|
152
155
|
Log.error("[GRIDIUM::ElementVerification] #{message} ['#{@element.name}' (By:(#{@element.by} => '#{@element.locator}'))].")
|
153
156
|
$fail_test_at_end = true
|
data/lib/page.rb
CHANGED
@@ -89,6 +89,8 @@ module Gridium
|
|
89
89
|
Timeout.timeout(Gridium.config.page_load_timeout) do
|
90
90
|
loop until jquery_loaded?
|
91
91
|
end
|
92
|
+
rescue Timeout::Error => e
|
93
|
+
Log.warn("[GRIDIUM::Page] Timed-out waiting for ajax")
|
92
94
|
end
|
93
95
|
|
94
96
|
def self.jquery_loaded?
|
@@ -98,9 +100,9 @@ module Gridium
|
|
98
100
|
#
|
99
101
|
# JQuery click
|
100
102
|
# @param [String] CSS selector
|
101
|
-
#
|
102
|
-
# Occasionaly selenium is unable to click on elements in the DOM which have some
|
103
|
-
# interesting React goodies around the element.
|
103
|
+
#
|
104
|
+
# Occasionaly selenium is unable to click on elements in the DOM which have some
|
105
|
+
# interesting React goodies around the element.
|
104
106
|
#
|
105
107
|
def self.jquery_click(selector)
|
106
108
|
Driver.evaluate_script("$(\"#{selector}\").click().change();")
|
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.11
|
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-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|