File tree 1 file changed +13
-5
lines changed
1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change 116
116
ensure
117
117
# take a screenshot and upload it to imgur
118
118
begin
119
- browser . save_screenshot ( 'screenshot.png' )
120
- response = RestClient . post ( 'https://api.imgur.com/3/upload' ,
121
- { image : File . open ( 'screenshot.png' ) } ,
122
- { 'Authorization' => 'Client-ID 1979876fe2a097e' } )
119
+ upload = lambda do |filepath |
120
+ response = RestClient . post ( 'https://api.imgur.com/3/upload' ,
121
+ { image : File . open ( filepath ) } ,
122
+ { 'Authorization' => 'Client-ID 1979876fe2a097e' } )
123
+
124
+ print JSON . parse ( response . to_str ) [ 'data' ] [ 'link' ]
125
+ end
123
126
124
127
print " ("
125
- print JSON . parse ( response . to_str ) [ 'data' ] [ 'link' ]
128
+ browser . save_screenshot ( 'screenshot.png' )
129
+ upload [ 'screenshot.png' ]
130
+ print ", entire page: "
131
+ browser . capture_entire_page_screenshot ( 'full-screenshot.png' )
132
+ upload [ 'full-screenshot.png' ]
126
133
puts ")"
134
+
127
135
rescue Exception
128
136
puts
129
137
end
You can’t perform that action at this time.
0 commit comments