{"id":13879485,"url":"https://github.com/dbalatero/capybara-chromedriver-logger","last_synced_at":"2025-04-07T15:09:40.254Z","repository":{"id":29510112,"uuid":"121886680","full_name":"dbalatero/capybara-chromedriver-logger","owner":"dbalatero","description":"Enables console.log/error/info output from Javascript feature specs running with Chromedriver","archived":false,"fork":false,"pushed_at":"2022-10-19T13:32:04.000Z","size":518,"stargazers_count":54,"open_issues_count":11,"forks_count":28,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T13:18:02.262Z","etag":null,"topics":["capybara","chrome","chromedriver","console","logger","logging","rspec","ruby","testing"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbalatero.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-17T19:44:13.000Z","updated_at":"2022-02-13T15:30:02.000Z","dependencies_parsed_at":"2022-09-12T13:53:01.360Z","dependency_job_id":null,"html_url":"https://github.com/dbalatero/capybara-chromedriver-logger","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalatero%2Fcapybara-chromedriver-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalatero%2Fcapybara-chromedriver-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalatero%2Fcapybara-chromedriver-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalatero%2Fcapybara-chromedriver-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbalatero","download_url":"https://codeload.github.com/dbalatero/capybara-chromedriver-logger/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675607,"owners_count":20977377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capybara","chrome","chromedriver","console","logger","logging","rspec","ruby","testing"],"created_at":"2024-08-06T08:02:22.537Z","updated_at":"2025-04-07T15:09:40.236Z","avatar_url":"https://github.com/dbalatero.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/dbalatero/capybara-chromedriver-logger.svg?branch=master)](https://travis-ci.org/dbalatero/capybara-chromedriver-logger)\n\n# capybara-chromedriver-logger\n\nThis gem provides `console.log` debug output for Ruby feature specs running under Chromedriver.\n\nWe currently assume you're running:\n\n* capybara\n* chromedriver + selenium-webdriver\n* rspec\n\nto handle your JS feature specs. I'd love to expand support for other combinations of test environments!\n\n\u003cimg src=\"https://raw.githubusercontent.com/dbalatero/capybara-chromedriver-logger/master/images/example.png\" /\u003e\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'capybara-chromedriver-logger'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install capybara-chromedriver-logger\n\n## Usage\n\nYou'll want to modify your `spec_helper.rb` file to configure Capybara correctly:\n\n```ruby\nCapybara.register_driver(:chrome) do |app|\n  # option 1:\n  # This wraps Selenium::WebDriver::Remote::Capabilities.chrome() with the\n  # correct settings for logging.\n  capabilities = Capybara::Chromedriver::Logger.build_capabilities(\n    chromeOptions: {\n      args: %w[headless]\n    }\n  )\n\n  Capybara::Selenium::Driver.new(\n    app,\n    browser: :chrome,\n    desired_capabilities: capabilities\n  )\nend\n\n# Use the driver we've configured\nCapybara.default_driver = :chrome\nCapybara.javascript_driver = :chrome\n\n# Option 1: Setup hooks for your feature specs\nCapybara::Chromedriver::Logger::TestHooks.for_rspec!\n\n# Option 2: if you prefer to hook it in manually:\nRSpec.configure do |config|\n  config.after :each, type: :feature do\n    Capybara::Chromedriver::Logger::TestHooks.after_example!\n  end\nend\n```\n\nIf you don't want to use the capability wrapper above for any reason, you can\nstill manually configure things:\n\n```ruby\n# option 2: manual setup\n# Turn on browser logs\ncapabilities = Selenium::WebDriver::Remote::Capabilities.chrome(\n  chromeOptions: {\n    args: %w[headless],\n    # required for Chrome 75+\n    w3c: false\n  },\n  # For up to Chrome 74\n  loggingPrefs: {\n    browser: 'ALL'\n  }\n  # for Chrome 75+\n  \"goog:loggingPrefs\" =\u003e {\n    browser: 'ALL'\n  }\n)\n```\n\n## Configuration\n\nHere are examples of the supported configuration options:\n\n```ruby\n# If you set this to true, any specs that generate console errors\n# will automatically raise. This is similar to poltergeist's\n# `js_errors: true` config option\n#\n# If you filter out any errors with the `filters` option, they will\n# not trigger an exception in your spec examples.\n#\n# default: false\nCapybara::Chromedriver::Logger.raise_js_errors = true\n\n# If third-party libraries are dumping obnoxious logs into your output,\n# you can filter them out here.\n#\n# default: []\nCapybara::Chromedriver::Logger.filters = [\n  /Download the React DevTools/i,\n  /The SSL certificate used to load resources from/i\n]\n\n# If you want to filter out specific severity levels, you can do so here:\n#\n# default: nil\nCapybara::Chromedriver::Logger.filter_levels = %i[\n  severe\n  info\n  warning\n  debug\n]\n```\n\n## Development\n\nAfter 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.\n\nTo 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](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/dbalatero/capybara-chromedriver-logger.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbalatero%2Fcapybara-chromedriver-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbalatero%2Fcapybara-chromedriver-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbalatero%2Fcapybara-chromedriver-logger/lists"}