...work the way you how you would like it to. To create a nice test coverage report, copy the attached file to lib/tasks/rcov.rake. After that rake rcov:all will run...
...app/controllers/shared and app/models/shared (which may or may not be entirely correct for your case). Tested that it works with Selenium features Doesn't add rake tasks outside development environment
...should way of writing specs for expecting things to happen. However, if you have tests you cannot change (e.g. because they are inside a gem, spanning multiple versions of Rails...
...Solution: Add gem 'minitest' to your Gemfile, before any rspec gem. Another MiniTest::Unit::TestCase is now Minitest::Test. From /Users/makandra/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/1.9.1/test/unit/testcase.rb:8:in ` ' In order to remove this message, you...
...problem of pending AJAX requests dying in the browser when the server ends a test or switches scenarios. We were able to work around this issue in most projects by...
...Listening on localhost:36309, CTRL+C to stop If you are running parallel tests with thin, this will clutter you output. Disable thin logging with these lines: # e.g. in features/support/thin.rb...
Thin::Logging.silent = true Note that this disables all logging in tests. Instead, you also might set a different logger with Thin::Logging.logger = . See Thin::Logging for details...
...gem will show a default of 30 records per page. If you want to test pagination in a Cucumber feature, you don't want to create 31 records just for...
...Using Capybara RSpec matchers One rule of thumb I try to follow in capybara tests is using capybara matchers and not plain rspec matchers. One example: visit(some_page)
...sure the datepicker is loaded before interacting with it See also Fixing flaky E2E tests
...above commands does, see explainshell. Note that we use geordi cucumber to run our tests. If you don't, xargs cucumber or similar might work for you. Part of Geordi...
Note that if you plan to freeze your Firefox versions because your Selenium tests break whenever Firefox updates, there is a better way that lets you keep an up-to...
betterspecs.org is a documentation on how to write better RSpec tests. Note that there are also other approaches like The Self-Contained Test, which is complementary to the dry-approches...
Fix missing require for Fileutils in the dump load command (#145) Document PARALLEL_TEST_PROCESSORS
Preface: Normally, you would not need this in integrations tests (probably that's why it is so hard to achieve), because it is no actual "integration testing". If you use...
You can use the code below to check whether the browser can make connections to the current site: await isOnline...
...in features/support/paths.rb. Capybara The step definition is part of Spreewald. The step has been tested with multiple versions of Capybara, Rack::Test and Selenium. Webrat (legacy) This is a simpler...
The linked MDN article is quite informative of a neat feature supported by all major browsers: Unicode character class escape...
...visit url_for(request.params) end For a step that distinguishes between drivers (Selenium, Rack::Test, Culerity), check n4k3d.com...
...a transformable example of katapult's features Development Add katapult update script Speed up tests (now running in about 9 min) Improve development workflow (see README) No bundler issues in...
...tests any more
CarrierWave comes with some RSpec matchers which will make testing more comfortable. Let's say you have an Uploader like this: class MyUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick
...a class Movie with an attribute poster. In your spec file, you can add tests to check the dimensions of the several versions by writing RSpec.describe Movie, type: :model do...
Usually our code lives on GitLab, therefore our documentation for CI testing is extensive in this environment. If you are tied to GitHub e.g. because your customer uses it, you...
...template uses two such custom actions: setup-node and setup-ruby .github/workflows/integration-testing.yml name: Integration Testing on: push: branches: [ main, production ] pull_request: branches: [ main, production ] # Display "Run Workflow" button on...
...they are wrapping the same native DOM elements: $('body') == $('body') // false In order to test if two jQuery objects refer to the same native DOM elements, use is:
Jasmine equality matcher for jQuery See here for a custom Jasmine matcher that tests if two jQuery objects are equal...
If you want to have routes that are only available in tests (e.g. for testing obscure redirects), you can use the with_routing helper -- but that one destroys existing routes...
...may break a specs that require them to work. To keep both "regular" and test routes, do this: class MyApplicationController < ActionController::Base def show render text: 'Welcome to my application...
This step tests whether a given select option comes preselected in the HTML. There is another step to test that an option is available at all. Capybara Then /^"([^"]*)" should be...
...web browser. It's pretty convenient. By installing a Chrome addon you can also test your local code on http://localhost...
...to record communication with remote APIs is a great way to stub requests in tests. However, you may still want to look at the request data like the payload your...
...have_requested(:post, 'http://example.com').with(body: 'yolo') Easy peasy. Related cards Faking and testing the network with WebMock