Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console.log not printed to stdout when using capybara-webkit #428

Open
volkergersabeck opened this issue Nov 5, 2015 · 12 comments
Open

Comments

@volkergersabeck
Copy link

using the capybara-webkit driver I was not able to see any output from console.log statements in my javascript on the stdout. switching to phantomjs showed the output immediately.

my configuration is the default:

config.suppress_log = false

from my Gemfile.lock:
capybara-webkit (1.7.1)
teaspoon (1.1.1)
teaspoon-jasmine (2.3.4)

@kprinssu
Copy link

You'll need to run the webserver via rails s and go to http://localhost:3000/teaspoon to get console output.

@jejacks0n
Copy link
Owner

If this isn't working it should probably be -- if for nothing other than parity. If there's any time available we'll look into it.. thanks for the heads up.

@starsirius
Copy link

+1

@jejacks0n
Copy link
Owner

Please try that branch and report back. I have only tested it on the latest capybara-webkit (1.10.1 as of writing) and it appears to work -- no idea about previous versions.

gem "teaspoon-[framework]", github: "modeset/teaspoon", branch: "capybara-webkit-fixes"

@starsirius
Copy link

@jejacks0n Thanks for taking a look. I've tried using the above branch, but now it looks like not running the specs and just exits. Will try to take a closer look, but for your information, this is all I got now:

$ RAILS_ENV=test bundle exec teaspoon
warning: parser/current is loading parser/ruby22, which recognizes
warning: 2.2-compliant syntax, but you are running 2.3.0.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
I, [2016-04-11T16:14:28.244418 #11913]  INFO -- : ** [Raven] Raven 0.13.2 configured not to send errors.
Starting the Teaspoon server...
Teaspoon running default suite at http://127.0.0.1:54923/teaspoon/default


$ 

@jejacks0n
Copy link
Owner

Thanks @starsirius, that's likely because of the capybara-webkit version (I think).. can you make sure you're using 1.10.1 for me as a follow up? That layer changed a lot between versions of capybara-webkit, and so I expected some hassles there. Please provide the version you're using, and what the results are with 1.10.1 if you have the time.

@starsirius
Copy link

@jejacks0n Confirmed that using capybara-webkit 1.10.1 works. It's running the tests and outputting the console.logs as long as outputs from other libraries! 👍 For example, the warning from React:

Warning: React.render is deprecated. Please use ReactDOM.render from require('react-dom') instead.

However, it seems like I can only get at most 2 outputs and the result is not reliable. For example, given the following test

it 'outputs console.log', ->
  console.log 777
  console.log 'string'
  console.log { a: 1, b: 2 }
  console.log [{ a: 1, b: 2 }]
  fixture.set("<h2>Another Title</h2>")

It sometimes outputs

outputs console.log
  # 777
  # string

sometimes

outputs console.log
  # 777[object Object]

@jejacks0n
Copy link
Owner

The timing of them is a bit odd as well. So I don't fully understand why capybara-webkit has it setup the way they do, but I'm using it as best as seems possible at that layer and it 1. doesn't behave as expected, 2. seems to be an area of heavy flux and probably isn't worth trying to maintain compatibility (at least for me -- keeping up with sprockets breakage is hard enough).

So I'll close the issue without complete resolution, but will leave the branch so someone else can potentially dive into it further and see if they can make more sense of how capybara-webkit wants a library like teaspoon to handle that.

@jejacks0n
Copy link
Owner

Decided I'd check with the capybara-webkit team before closing it entirely.

@starsirius
Copy link

Thanks, @jejacks0n!

@thebravoman
Copy link

I am kind of like in a similar situation. Running on a remote machine with 'bundle exec rake teaspoon' and the log is lost and it is useful for some debugging. I can not go to localhost:XXXX/teaspoon on the remote machine and console.log(), console.info(), console.error() do not output anything to teaspoon.

@mathieujobin
Copy link
Collaborator

is this possible this answer here #524 is exactly what this issue is about ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants