eyes_selenium 2.5.0 → 2.7.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8ba2453778c9eb7863f0d5c086033065137972a
|
4
|
+
data.tar.gz: 98f3873d83dfefdf27f95c77898bf2cfb95028bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51556719e486c1da48c5a3c462eae36ab209c090f1eea2a62c17bd91fbf3c3203fd5e33cc7b3eb154873f6cd4268c0515f6fa9067315ef759a6b76c589201e32
|
7
|
+
data.tar.gz: c5ce2f9c41eb260b2881e6b7c65b44c5a8639b5e3aff45fe37787e053cc7d6ce9eb4d93c821a6a90f596b3f1ed04eb5710902186540b46ba7388bb5808b97d40
|
@@ -35,8 +35,10 @@ class Applitools::AgentConnector
|
|
35
35
|
def start_session(session_start_info)
|
36
36
|
self.class.headers 'Content-Type' => 'application/json'
|
37
37
|
res = self.class.post(@endpoint_uri, query: {apiKey: api_key}, body: { startInfo: session_start_info.to_hash }.to_json)
|
38
|
+
EyesLogger.debug "Got response! #{res}"
|
38
39
|
status_code = res.response.message
|
39
40
|
parsed_res = res.parsed_response
|
41
|
+
EyesLogger.debug "Parsed response #{parsed_res}"
|
40
42
|
Applitools::Session.new(parsed_res['id'], parsed_res['url'], status_code == 'Created' )
|
41
43
|
end
|
42
44
|
|
@@ -1,24 +1,27 @@
|
|
1
1
|
class Applitools::ViewportSize
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
JS_GET_VIEWPORT_HEIGHT =
|
4
|
+
'var height = undefined;' +
|
5
|
+
' if (window.innerHeight) {height = window.innerHeight;}' +
|
6
|
+
' else if (document.documentElement ' +
|
7
|
+
'&& document.documentElement.clientHeight) ' +
|
8
|
+
'{height = document.documentElement.clientHeight;}' +
|
9
|
+
' else { var b = document.getElementsByTagName("body")[0]; ' +
|
10
|
+
'if (b.clientHeight) {height = b.clientHeight;}' +
|
11
|
+
'};' +
|
12
|
+
'return height;'
|
13
|
+
|
14
|
+
JS_GET_VIEWPORT_WIDTH =
|
15
|
+
'var width = undefined;' +
|
16
|
+
' if (window.innerWidth) {width = window.innerWidth;}' +
|
17
|
+
' else if (document.documentElement ' +
|
18
|
+
'&& document.documentElement.clientWidth) ' +
|
19
|
+
'{width = document.documentElement.clientWidth;}' +
|
20
|
+
' else { var b = document.getElementsByTagName("body")[0]; ' +
|
21
|
+
'if (b.clientWidth) {' +
|
22
|
+
'width = b.clientWidth;}' +
|
23
|
+
'};' +
|
24
|
+
'return width;'
|
22
25
|
|
23
26
|
attr_reader :driver
|
24
27
|
attr_accessor :dimension
|
@@ -28,23 +31,11 @@ class Applitools::ViewportSize
|
|
28
31
|
end
|
29
32
|
|
30
33
|
def extract_viewport_width
|
31
|
-
|
32
|
-
return driver.execute_script(GET_VIEWPORT_WIDTH_JAVASCRIPT_FOR_NORMAL_BROWSER)
|
33
|
-
rescue => e
|
34
|
-
EyesLogger.info "getViewportSize(): Browser does not support innerWidth (#{e.message})"
|
35
|
-
end
|
36
|
-
|
37
|
-
driver.execute_script(GET_VIEWPORT_WIDTH_JAVASCRIPT_FOR_BAD_BROWSERS)
|
34
|
+
driver.execute_script(JS_GET_VIEWPORT_WIDTH)
|
38
35
|
end
|
39
36
|
|
40
37
|
def extract_viewport_height
|
41
|
-
|
42
|
-
return driver.execute_script(GET_VIEWPORT_HEIGHT_JAVASCRIPT_FOR_NORMAL_BROWSER)
|
43
|
-
rescue => e
|
44
|
-
EyesLogger.info "getViewportSize(): Browser does not support innerHeight (#{e.message})"
|
45
|
-
end
|
46
|
-
|
47
|
-
driver.execute_script(GET_VIEWPORT_HEIGHT_JAVASCRIPT_FOR_BAD_BROWSERS)
|
38
|
+
driver.execute_script(JS_GET_VIEWPORT_HEIGHT)
|
48
39
|
end
|
49
40
|
|
50
41
|
def extract_viewport_from_browser!
|
@@ -52,12 +43,17 @@ class Applitools::ViewportSize
|
|
52
43
|
end
|
53
44
|
|
54
45
|
def extract_viewport_from_browser
|
55
|
-
width
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
46
|
+
width, height = nil, nil
|
47
|
+
begin
|
48
|
+
width = extract_viewport_width
|
49
|
+
height = extract_viewport_height
|
50
|
+
rescue => e
|
51
|
+
EyesLogger.info "getViewportSize(): failed to extract viewport size using Javascript: (#{e.message})"
|
52
|
+
end
|
53
|
+
if width.nil? || height.nil?
|
54
|
+
EyesLogger.info 'getViewportSize(): using window size as viewport size.'
|
55
|
+
width, height = *browser_size.values
|
56
|
+
end
|
61
57
|
Applitools::Dimension.new(width,height)
|
62
58
|
end
|
63
59
|
alias_method :viewport_size, :extract_viewport_from_browser
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eyes_selenium
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Applitools team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: selenium-webdriver
|