smartshot 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smartshot/screenshot.rb +16 -12
- data/lib/smartshot/version.rb +1 -1
- metadata +20 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5a8b8b6712dfbed40b02fd7c365947b9d5c5148
|
4
|
+
data.tar.gz: ae69f75e228ccd0a388657c6904ea422f4001d7e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 460afd5d7289e4e380a36aaf520c693d08bd9df50eb178f8a7572b23694f21e49bb7716e28f94b72253ac5c74237298fdf6257657b45d1944a0d473dff7a5143
|
7
|
+
data.tar.gz: 513e8679ebc581f449bc4695c744181be00df5c308f3ec1270255d8aba038d0f611b18c69f242848bfd0996a387ab4afbf2afbfc462f894ca21c005ebcd2f493
|
data/lib/smartshot/screenshot.rb
CHANGED
@@ -9,28 +9,32 @@ module Smartshot
|
|
9
9
|
end
|
10
10
|
Capybara.run_server = options.delete(:run_server) || false
|
11
11
|
Capybara.current_driver = :poltergeist
|
12
|
-
Capybara.
|
12
|
+
Capybara.default_max_wait_time = options.delete(:default_wait_time) || 30
|
13
13
|
end
|
14
14
|
|
15
15
|
def initialize(options = {})
|
16
16
|
Smartshot::Screenshot.setup_capybara(options)
|
17
17
|
end
|
18
18
|
|
19
|
-
def take_screenshot
|
19
|
+
def take_screenshot(params = {})
|
20
20
|
options = { full: true, output: 'screenshot.png', url: 'http://ca.ios.ba', wait_for_element: 'body', frames_path: [] }.merge(params)
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
page.find element, visible: visible
|
27
|
-
end
|
21
|
+
visit options.delete(:url)
|
22
|
+
inside_frames options.delete(:frames_path) do
|
23
|
+
[options.delete(:wait_for_element)].flatten.each do |element|
|
24
|
+
visible = (element =~ /^(link|meta)/).nil?
|
25
|
+
page.find element, visible: visible
|
28
26
|
end
|
27
|
+
end
|
29
28
|
|
30
|
-
|
31
|
-
|
29
|
+
timeout = options.delete(:sleep)
|
30
|
+
sleep timeout unless timeout.nil?
|
32
31
|
|
33
|
-
|
32
|
+
page.driver.save_screenshot(options.delete(:output), options)
|
33
|
+
end
|
34
|
+
|
35
|
+
def take_screenshot!(params = {})
|
36
|
+
begin
|
37
|
+
take_screenshot(params)
|
34
38
|
rescue => e
|
35
39
|
raise SmartshotError.new("Error: #{e.message.inspect}")
|
36
40
|
end
|
data/lib/smartshot/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caio Almeida
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: gem-release
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activesupport
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: poltergeist
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: 1.6.0
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.6.0
|
97
97
|
description: |-
|
@@ -103,8 +103,8 @@ executables: []
|
|
103
103
|
extensions: []
|
104
104
|
extra_rdoc_files: []
|
105
105
|
files:
|
106
|
-
- .gitignore
|
107
|
-
- .travis.yml
|
106
|
+
- ".gitignore"
|
107
|
+
- ".travis.yml"
|
108
108
|
- CONTRIBUTORS
|
109
109
|
- Gemfile
|
110
110
|
- LICENSE.txt
|
@@ -127,17 +127,17 @@ require_paths:
|
|
127
127
|
- lib
|
128
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
|
-
- -
|
130
|
+
- - ">="
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- -
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.5.1
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Captures a web page as a screenshot using Poltergeist, Capybara and PhantomJS,
|
@@ -145,3 +145,4 @@ summary: Captures a web page as a screenshot using Poltergeist, Capybara and Pha
|
|
145
145
|
test_files:
|
146
146
|
- test/smartshot_test.rb
|
147
147
|
- test/test_helper.rb
|
148
|
+
has_rdoc:
|