mirror of
https://github.com/teampoltergeist/poltergeist.git
synced 2022-11-09 12:05:00 -05:00
Merge pull request #430 from laserlemon/json-logger
Log raw JSON messages/responses rather than Ruby-parsed and inspected
This commit is contained in:
commit
09c6570dea
4 changed files with 18 additions and 12 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -2,7 +2,8 @@
|
|||
|
||||
#### Features ####
|
||||
|
||||
* Added ability to set zoom_factor(Dmytro Budnyk)
|
||||
* Added ability to set zoom_factor (Dmytro Budnyk)
|
||||
* Write JSON to the logger, rather than Ruby [Issue #430]
|
||||
|
||||
#### Bug fixes ####
|
||||
|
||||
|
@ -12,6 +13,7 @@
|
|||
### 1.5.0 ###
|
||||
|
||||
#### Features ####
|
||||
|
||||
* Added ability to clear network traffic (Vick Vu)
|
||||
* Added ability to set paper_size via a driver setter (Philippe Lehoux)
|
||||
* Can support Basic HTTP authentication
|
||||
|
@ -20,6 +22,7 @@
|
|||
element and Capybara 2.2 support (Pedro Carriço)
|
||||
|
||||
#### Bug fixes ####
|
||||
|
||||
* Use `Capybara::Helpers.normalize_whitespace` in filter_text to strip unicode
|
||||
whitespace (Wataru Miyaguni)
|
||||
* Fix missed interpolation on deprecated error classes
|
||||
|
@ -32,6 +35,7 @@
|
|||
### 1.4.1 ###
|
||||
|
||||
#### Bug fixes ####
|
||||
|
||||
* Kill thread first off and then close IO [Issue #385]
|
||||
|
||||
### 1.4.0 ###
|
||||
|
@ -100,7 +104,7 @@
|
|||
|
||||
### 1.1.2 ###
|
||||
|
||||
#### Bug fixes #####
|
||||
#### Bug fixes ####
|
||||
|
||||
* Tie to faye-websocket 0.4 as 0.5 introduces incompatibilities.
|
||||
|
||||
|
@ -246,7 +250,7 @@
|
|||
[Issue #83]
|
||||
* Added status code support. (Dmitriy Nesteryuk and Jon Leighton) [Issue #37]
|
||||
|
||||
#### Bug fixes ###
|
||||
#### Bug fixes ####
|
||||
|
||||
* Fix issue with `ClickFailed` exception happening with a negative
|
||||
co-ordinate (which should be impossible). (Jon Leighton, Gabriel
|
||||
|
|
|
@ -268,11 +268,13 @@ module Capybara::Poltergeist
|
|||
end
|
||||
|
||||
def command(name, *args)
|
||||
message = { 'name' => name, 'args' => args }
|
||||
log message.inspect
|
||||
message = JSON.dump({ 'name' => name, 'args' => args })
|
||||
log message
|
||||
|
||||
json = JSON.load(server.send(JSON.dump(message)))
|
||||
log json.inspect
|
||||
response = server.send(message)
|
||||
log response
|
||||
|
||||
json = JSON.load(response)
|
||||
|
||||
if json['error']
|
||||
klass = ERROR_MAPPINGS[json['error']['name']] || BrowserError
|
||||
|
|
|
@ -540,7 +540,7 @@ describe Capybara::Session do
|
|||
@session.visit("/")
|
||||
@session.find(:css, "a").click
|
||||
|
||||
position = eval(TestSessions.logger.messages.last)["response"]["position"]
|
||||
position = JSON.load(TestSessions.logger.messages.last)["response"]["position"]
|
||||
expect(position["x"]).to_not be_nil
|
||||
expect(position["y"]).to_not be_nil
|
||||
end
|
||||
|
|
|
@ -11,13 +11,13 @@ module Capybara::Poltergeist
|
|||
subject { Browser.new(server, client, logger) }
|
||||
|
||||
it 'logs requests and responses to the client' do
|
||||
request = { 'name' => 'where is', 'args' => ["the love?"] }
|
||||
response = { 'response' => '<3' }
|
||||
server.stub(:send).with(MultiJson.dump(request)).and_return(JSON.dump(response))
|
||||
request = %({"name":"where is","args":["the love?"]})
|
||||
response = %({"response":"<3"})
|
||||
server.stub(:send).with(request).and_return(response)
|
||||
|
||||
subject.command('where is', 'the love?')
|
||||
|
||||
expect(logger.string).to eq("#{request.inspect}\n#{response.inspect}\n")
|
||||
expect(logger.string).to eq("#{request}\n#{response}\n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue