I got this error when running Rails 2.3 tests for Rails LTS. More stacktrace: NoMethodError: undefined method `cache' for Gem:Module /vagrant/rails-2-3-lts-repository/railties/lib/rails_generator/lookup.rb:212:in `each' /vagrant/rails-2-3-lts-repository/railties/lib/rails_generator/lookup.rb:146:in `to_a...
...started your screen reader you can simply navigate to whatever application you want to test and the screen reader will start to do its thing. If your screen reader isn...
...the application. If that still does not work, then the application you want to test may not be supported. Since we are usually building websites though, that should not pose...
Cucumber will clean up files you've uploaded in your Cucumber features automatically with the attached code. Put the file...
...are probably using closures to hide local state, e.g. to have private methods. In tests you may find it necessary to inspect a variable that is hidden behind a closure...
...option is available, not that it is selected. There is a separate step to test that an option is selected. Capybara (0.4.1 or higher) Then /^"([^"]*)" should( not)? be an option...
...you don't need to check the input of hidden fields in an integration test. But e.g. waiting for a datepicker library to write the expected value to this field...
...before continuing the test, which prevents flaky tests, is a valid use case...
...rails generators) with rails g -h. generator model migration controller entry in routes.rb views tests scaffold ✔ ✔ ✔ ✔ ✔ ✔ resource ✔ ✔ ✔ ✔ ✔ model ✔ ✔ ✔ controller ✔ ✔ ✔ migration ✔ Also see this blog post...
...you use that "db count" and process the loaded elements. A common example is tests: Imagine a test that sets up a few records and finishes the test setup by...
...records have loaded (i.e. cached) their associations too early and now are missing elements. Tests relying on the setup will fail, because they will operate on the loaded records. You...
...or when you accidentally interact with the browser frame. This will result in flickering tests, which are "randomly" red and green. In fact, this behavior is not random at all...
...better understanding of Selenium focus issues, and what you can do to get your test suite stable again. Preventing accidental interaction with the Selenium window When Selenium windows steal your...
...as pending, include a failing spec body or RSpec 3 will consider the pending test as failing. The reasoning is: If the spec is flagged as pending but passes, it...
...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...