lib/percy.rb in percy-capybara-4.1.0 vs lib/percy.rb in percy-capybara-4.1.1
- old
+ new
@@ -31,11 +31,18 @@
url: page.current_url,
domSnapshot: domSnapshot,
clientInfo: Percy.client_info,
environmentInfo: Percy.environment_info,
}
+
body = body.merge(self._keys_to_json(options))
+
+ if self._is_debug?
+ self._logger.info { "passed snapshot options: #{options}" }
+ self._logger.info { "snapshot object to POST: #{body}" }
+ end
+
self._post_snapshot_to_agent(body)
end
private
@@ -92,9 +99,13 @@
http = Net::HTTP.new(AGENT_HOST, AGENT_PORT)
request = Net::HTTP::Post.new('/percy/snapshot', { 'Content-Type': 'application/json' })
request.body = body.to_json
begin
response = http.request(request)
+
+ if self._is_debug?
+ self._logger.info { "Response from agent: #{response}" }
+ end
rescue => e
self._logger.error { "Agent rejected snapshot request. Error: #{e}" }
end
end