Switch to a recently opened tab with Cucumber

I switch to the new browser tab lets Selenium-enabled tests handle links that open a new tab or window, such as link_to(..., :target => '_blank').

Debugging flickering VCR tests

VCR tests can flicker when recorded requests change because of randomness, timestamps, or generated sequences, making cassette mismatches hard to diagnose.

Run a single test in Test::Unit

Run one Test::Unit file, method, or name-matching subset directly from the command line when a full test suite is unnecessary.

How to provoke Selenium focus issues in parallel test processes

Parallel Selenium scenarios can steal browser focus and make integration tests flicker. A dedicated focus loop helps reproduce and fix timing-sensitive failures.

How to set the user agent in tests

Customizing the User-Agent header in tests makes browser- and crawler-specific behavior reproducible across Rack::Test, Selenium, and request specs.

RSpec: You can super into parent "let" definitions

let can call super() in nested RSpec contexts to reuse parent test data and override one field, but heavy use can make specs harder to read.

How to test Autoprefixer and CSSnext in PostCSS

PostCSS plugin output can be verified by compiling assets and checking Autoprefixer and CSS feature transforms from postcss-preset-env.

How to install a frozen version of Firefox for your Selenium tests

Firefox updates can break Selenium and Cucumber tests; a separate unchanging browser copy avoids auto-updates, profile clashes, and window reuse.

How to disable cookies in cucumber tests

Capybara has no built-in switch for disabling cookies in browser tests; a small Rack middleware can strip request cookies so scenarios can verify sign-in failures without them.

Rails: Concurrent requests in development and tests

Puma concurrency in Rails depends on workers and threads; self-calls during a request can deadlock in development or tests unless multiple workers are enabled.

Mysql::Error: SAVEPOINT active_record_1 does not exist: ROLLBACK TO SAVEPOINT active_record_1 (ActiveRecord::StatementInvalid)

Parallel test runs can trigger missing-savepoint rollback errors when processes share a database or transactional test settings conflict.

How to perform HTTP basic authentication in RSpec

HTTP Basic Authentication sends a Base64-encoded username and password in the Authorization header; RSpec tests can set credentials for request and controller specs.

Rails 2's CookieStore produces invalid cookie data, causing tests to break

Recent Rails 2 CookieStore versions can emit malformed Set-Cookie headers with blank lines, breaking Cucumber integration tests when cookies are written more than once.

How to: Run geordi in a single proccess with parallel test setup

Parallel test runs in Geordi can break terminal I/O during debugging; forcing one process or using vanilla cucumber avoids breakpoint issues.

ActionMailer: How to send a test mail directly from the console

Rails console debugging for mail delivery failures, with ActionMailer settings inspection and a direct test message to verify SMTP and spam score.

Rails: Removing the cucumber-rails warning when setting cache_classes to false without Spring enabled

cucumber-rails emits a transaction warning in test runs when cache_classes stays false without Spring, affecting parallel execution setups.

Protip: Clone large projects multiple times

Long test suites block new work on large projects; cloning the repository into a separate directory lets tests run in parallel while development continues.

Mocks and stubs in Test::Unit when you are used to RSpec

Test::Unit lacks built-in mocks and stubs; Mocha adds them and maps common RSpec double, stub, and expectation patterns to mock, stubs, and expects.

Understanding database cleaning strategies in tests

Test databases need cleanup between examples to keep state isolated; transactions are fastest, while browser-driven tests or MyISAM tables require deletion or truncation.

RSpec & Devise: How to sign in users in request specs

Devise controller helpers do not work in request specs; Warden test helpers provide sign_in and sign_out for authenticating users in integration-style tests.

How to test bundled applications using Aruba and Cucumber

Bundler environment variables can shadow a Rails test app when integration-testing CLI tools with Aruba and Cucumber. Clearing the Bundler env and disabling Spring keeps commands isolated.

Set the accept-language of Chrome in selenium tests

Set browser locale in Selenium tests by configuring intl.accept_languages in a Chrome or Firefox profile, so apps render and negotiate language consistently.

How to clear cookies in Capybara tests (both Selenium and Rack::Test)

Need to remove cookie data during a Capybara scenario when browser state must reset before the test ends.

Cucumber: Test that an element is not overshadowed by another element

Detects whether a visible page element is covered by another layer, such as a modal overlay or higher z-index element, using a browser hit test.