cuprite
cuprite copied to clipboard
rspec fails on Windows
Hey!
Ran rspec on Windows (mingw64) and a few test broke:
Failures:
1) Capybara::Cuprite::Driver supports a custom path
Failure/Error: @pid = ::Process.spawn(*@cmd, process_options)
Errno::ENOEXEC:
Exec format error - C:/Users/pniez/Documents/cuprite/spec/support/custom_chrome
# ./lib/capybara/cuprite/browser/process.rb:104:in `spawn'
# ./lib/capybara/cuprite/browser/process.rb:104:in `block in start'
# ./lib/capybara/cuprite/browser/process.rb:153:in `redirect_stdout'
# ./lib/capybara/cuprite/browser/process.rb:99:in `start'
# ./lib/capybara/cuprite/browser/process.rb:39:in `tap'
# ./lib/capybara/cuprite/browser/process.rb:39:in `start'
# ./lib/capybara/cuprite/browser.rb:252:in `start'
# ./lib/capybara/cuprite/browser.rb:60:in `initialize'
# ./lib/capybara/cuprite/browser.rb:23:in `new'
# ./lib/capybara/cuprite/browser.rb:23:in `start'
# ./lib/capybara/cuprite/driver.rb:26:in `browser'
# ./spec/integration/driver_spec.rb:49:in `ensure in block (2 levels) in <module:Cuprite>'
# ./spec/integration/driver_spec.rb:49:in `block (2 levels) in <module:Cuprite>'
# ./spec/integration/driver_spec.rb:14:in `block (2 levels) in <module:Cuprite>'
# ------------------
# --- Caused by: ---
# Errno::ENOEXEC:
# Exec format error - C:/Users/pniez/Documents/cuprite/spec/support/custom_chrome
# ./lib/capybara/cuprite/browser/process.rb:104:in `spawn'
2) Capybara::Cuprite::Driver raises an error and restarts the client if the client dies while executing a command
Failure/Error: expect { driver.browser.crash }.to raise_error(DeadBrowser)
expected Capybara::Cuprite::DeadBrowser, got #<Errno::ECONNRESET: Une connexion existante a d¹ Ûtre fermÚe par lÆh¶te distant.> with backtrace:
# ./lib/capybara/cuprite/browser/web_socket.rb:61:in `write'
# ./lib/capybara/cuprite/browser/web_socket.rb:61:in `write'
# ./lib/capybara/cuprite/browser/web_socket.rb:65:in `close'
# ./lib/capybara/cuprite/browser/client.rb:56:in `close'
# ./lib/capybara/cuprite/browser.rb:218:in `quit'
# ./lib/capybara/cuprite/browser.rb:213:in `restart'
# ./lib/capybara/cuprite/browser.rb:240:in `rescue in command'
# ./lib/capybara/cuprite/browser.rb:236:in `command'
# ./lib/capybara/cuprite/browser.rb:224:in `crash'
# ./spec/integration/driver_spec.rb:73:in `block (3 levels) in <module:Cuprite>'
# ./spec/integration/driver_spec.rb:73:in `block (2 levels) in <module:Cuprite>'
# ./spec/integration/driver_spec.rb:14:in `block (2 levels) in <module:Cuprite>'
# ./spec/integration/driver_spec.rb:73:in `block (2 levels) in <module:Cuprite>'
# ./spec/integration/driver_spec.rb:14:in `block (2 levels) in <module:Cuprite>'
Finished in 8 minutes 15 seconds (files took 3.96 seconds to load)
1553 examples, 2 failures, 27 pending
Failed examples:
rspec ./spec/integration/driver_spec.rb:25 # Capybara::Cuprite::Driver supports a custom path
rspec ./spec/integration/driver_spec.rb:71 # Capybara::Cuprite::Driver raises an error and restarts the client if the client dies while executing a command
Thank you! Never ran it on windows.
No problem! We did have to fix a few things to get it to run in the first place though: https://github.com/DragonBox/cuprite/tree/wwtk_stable if you're curious (we're planning to open PRs for fixes)
Does it work after merging your PR?
I looked a bit at the failure.
Test #1 is caused because that test is platform specific, invoking a shell script that probably doesn't work on Windows. It might be better to rewrite it using some expectations and avoid invoking ::Process.spawn altogether.
Test #2 not 100% sure yet.
Hey @route !
Just ran the tests on my machine, and the two issues are still here. Interestingly enough I stumbled onto a non replicable issue (see #62 as I was not sure if it was necessarily Windows related), but also onto a replicable one!
3) Capybara::Cuprite::Driver#save_screenshot supports rendering the page with different quality settings
Failure/Error: expect(File.size(file)).to be > File.size(file2) # png by defult is bigger
expected: > 7013
got: 6661
# ./spec/integration/driver_spec.rb:261:in `block (3 levels) in <module:Cuprite>'
# ./spec/integration/driver_spec.rb:14:in `block (2 levels) in <module:Cuprite>'
I'm really not sure why this one was passing before, I should be running in pretty much the same context.
I think test 2) Capybara::Cuprite::Driver raises an error and restarts the client if the client dies while executing a command is platform specific I had a fight with it on Mac, but turned out to be bug in specific version of chrome and chromium. Try using latest chromium
I need windows to play with all of it, but unfortunately travelling with laptop right now, so it will be no sooner than end of this month ;)
@route WRT Windows, would it be useful to add an AppVeyor config? We've done it in some of our projects. E.g. See https://github.com/DragonBox/freshsales/blob/master/appveyor.yml
@lacostej Dunno I think Travis also has Windows as an option it's just hard for me to debug anything remotely. I prefer playing with stuff locally.
@route appveyor definitely supports windows, we can submit CI run for (let's try maybe). I did request access:
