All Projects → dbalatero → capybara-chromedriver-logger

dbalatero / capybara-chromedriver-logger

Licence: MIT license
Enables console.log/error/info output from Javascript feature specs running with Chromedriver

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to capybara-chromedriver-logger

LoggingAdvanced
Improved and patched .NET Core console logger.
Stars: ✭ 20 (-62.96%)
Mutual labels:  console, logger
debug.js
Debugger of JavaScript, by JavaScript, for JavaScript
Stars: ✭ 19 (-64.81%)
Mutual labels:  console, logger
ptkdev-logger
🦒 Beautiful Logger for Node.js: the best alternative to the console.log statement
Stars: ✭ 117 (+116.67%)
Mutual labels:  console, logger
mache
A library for writing cleaner and more expressive acceptance tests using page objects.
Stars: ✭ 40 (-25.93%)
Mutual labels:  rspec, capybara
Laravel Console Logger
Logging and Notifications for Laravel Console Commands.
Stars: ✭ 79 (+46.3%)
Mutual labels:  console, logger
webpack-log
A logger for the Webpack ecosystem
Stars: ✭ 18 (-66.67%)
Mutual labels:  console, logger
logt
🖥️ A colourful logger for the browser
Stars: ✭ 35 (-35.19%)
Mutual labels:  console, logger
LocalSupport
A directory of local support services and volunteer opportunities
Stars: ✭ 60 (+11.11%)
Mutual labels:  rspec, capybara
Signale
Highly configurable logging utility
Stars: ✭ 8,575 (+15779.63%)
Mutual labels:  console, logger
Loglevelnext
A modern logging library for Node.js that provides log level mapping to the console
Stars: ✭ 33 (-38.89%)
Mutual labels:  console, logger
hyperapp-logger
Log Hyperapp state updates and action information to the console.
Stars: ✭ 48 (-11.11%)
Mutual labels:  console, logger
Go Logger
一个简单而强大的 golang 日志工具包,支持同步和异步输出到 命令行,文件, api 接口,文件支持按文件大小,文件行数,日期切分;A simple and powerful golang logging toolkit that supports synchronous and asynchronous output to the console, file, API interfaces, file support by file size, file line number, date sharding.
Stars: ✭ 152 (+181.48%)
Mutual labels:  console, logger
Gradle Test Logger Plugin
A Gradle plugin for printing beautiful logs on the console while running tests
Stars: ✭ 460 (+751.85%)
Mutual labels:  console, logger
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+153.7%)
Mutual labels:  console, logger
capybara-chrome
Chrome driver for Capybara using Chrome's remote debugging protocol
Stars: ✭ 27 (-50%)
Mutual labels:  rspec, capybara
ScribeBot
A highly scriptable automation system full of cool features. Automate everything with a little bit of Lua.
Stars: ✭ 72 (+33.33%)
Mutual labels:  chromedriver
selenium-download
allow downloading of latest selenium standalone server and chromedriver
Stars: ✭ 28 (-48.15%)
Mutual labels:  chromedriver
QLogger
Multi-threading logger for Qt applications
Stars: ✭ 46 (-14.81%)
Mutual labels:  logger
phoenix passwordless login
Phoenix Passwordless Login
Stars: ✭ 28 (-48.15%)
Mutual labels:  logger
LogSwift
Simple yet advanced swift logger
Stars: ✭ 19 (-64.81%)
Mutual labels:  logger

Build Status

capybara-chromedriver-logger

This gem provides console.log debug output for Ruby feature specs running under Chromedriver.

We currently assume you're running:

  • capybara
  • chromedriver + selenium-webdriver
  • rspec

to handle your JS feature specs. I'd love to expand support for other combinations of test environments!

Installation

Add this line to your application's Gemfile:

gem 'capybara-chromedriver-logger'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capybara-chromedriver-logger

Usage

You'll want to modify your spec_helper.rb file to configure Capybara correctly:

Capybara.register_driver(:chrome) do |app|
  # option 1:
  # This wraps Selenium::WebDriver::Remote::Capabilities.chrome() with the
  # correct settings for logging.
  capabilities = Capybara::Chromedriver::Logger.build_capabilities(
    chromeOptions: {
      args: %w[headless]
    }
  )

  Capybara::Selenium::Driver.new(
    app,
    browser: :chrome,
    desired_capabilities: capabilities
  )
end

# Use the driver we've configured
Capybara.default_driver = :chrome
Capybara.javascript_driver = :chrome

# Option 1: Setup hooks for your feature specs
Capybara::Chromedriver::Logger::TestHooks.for_rspec!

# Option 2: if you prefer to hook it in manually:
RSpec.configure do |config|
  config.after :each, type: :feature do
    Capybara::Chromedriver::Logger::TestHooks.after_example!
  end
end

If you don't want to use the capability wrapper above for any reason, you can still manually configure things:

# option 2: manual setup
# Turn on browser logs
capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
  chromeOptions: {
    args: %w[headless],
    # required for Chrome 75+
    w3c: false
  },
  # For up to Chrome 74
  loggingPrefs: {
    browser: 'ALL'
  }
  # for Chrome 75+
  "goog:loggingPrefs" => {
    browser: 'ALL'
  }
)

Configuration

Here are examples of the supported configuration options:

# If you set this to true, any specs that generate console errors
# will automatically raise. This is similar to poltergeist's
# `js_errors: true` config option
#
# If you filter out any errors with the `filters` option, they will
# not trigger an exception in your spec examples.
#
# default: false
Capybara::Chromedriver::Logger.raise_js_errors = true

# If third-party libraries are dumping obnoxious logs into your output,
# you can filter them out here.
#
# default: []
Capybara::Chromedriver::Logger.filters = [
  /Download the React DevTools/i,
  /The SSL certificate used to load resources from/i
]

# If you want to filter out specific severity levels, you can do so here:
#
# default: nil
Capybara::Chromedriver::Logger.filter_levels = %i[
  severe
  info
  warning
  debug
]

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dbalatero/capybara-chromedriver-logger.

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].