Fixing flaky E2E tests

E2E tests often fail from race conditions between browser, app and test code; stabilizing them means synchronizing actions, retries and animations.

Using feature flags to stabilize flaky E2E tests

Always-on UI behaviors like polling, animations, autocomplete, and lazy loading can make E2E tests flaky; feature flags disable them by default and re-enable them only where needed.

Capybara: Waiting for pending AJAX requests after a test

Selenium tests can fail when pending AJAX calls are aborted as Capybara closes the browser tab. Blocking new requests and waiting for in-flight work reduces flaky teardown errors.

Capybara: Testing file downloads

File downloads are awkward to verify with Selenium because browsers may prompt, auto-save, or render binaries instead of HTML. Alternative approaches use request specs, Rack::Test, or the browser download folder.

Raising JavaScript errors in Ruby E2E tests (RSpec, Cucumber)

Selenium E2E tests can miss frontend JavaScript errors because browser console logs do not fail specs by default. BrowserConsole raises on console errors and supports ignore rules.

Jasmine: Cleaning up the DOM after each test

DOM-based Jasmine specs can leak leftover elements into later tests; using a dedicated fixture container cleared after each run keeps test state isolated.

Rails disables CSRF protection in tests

Rails test environment turns off CSRF checks by default, so missing authenticity tokens can hide broken POST flows. Enabling forgery protection in JavaScript tests catches these failures.

Capybara: Running tests with headless Chrome

Running Capybara system tests in Chrome without a visible window reduces CI friction and supports Docker, device emulation, PDF handling, and remote debugging.

Timecop: reset after each test

Frozen time in tests can make suites flaky when state leaks between examples. Resetting Timecop after each test or using block form prevents order-dependent failures.

Ensure passing Jasmine specs from your Ruby E2E tests

Run Jasmine specs through Rails E2E tests to catch JavaScript failures in regular test runs and verify the runner finishes with all specs passing.

Jasmine: Mocking ESM imports

Imported ESM functions are hard to spy on in Jasmine; several workarounds keep call counts testable, including wrapper objects, dependency injection, and test runners with module mocking.

How to make changes to a Ruby gem (as a Rails developer)

Ruby gems need manual file loading, multi-version support, and their own release workflow, unlike Rails apps. Safe changes depend on understanding structure, tests, versioning, and packaging.

Capybara: Preventing server errors from failing your test

Capybara can fail tests after all steps when the Rails server raises an error on session cleanup. Filtering known missing-file errors avoids false failures.

Testing ActiveRecord validations with RSpec

Rails model validation tests can be written directly with record.validate and error checks, or shortened with shoulda-matchers for standard cases.

Cucumber: Identifying slow steps that drag down your test speed

Cucumber test suites can hide slow steps that waste most runtime. --format usage measures step durations and highlights optimization candidates, especially when waiting assertions surface previous delays.

RSpec: How to define classes for specs

RSpec constants declared in specs leak into the global namespace, risking name collisions and brittle tests. Use stub_const, a Class.new variable, or self:: to keep helper classes isolated.

Careful: `fresh_when last_modified: ...` without an object does not generate an E-Tag

Passing last_modified without an object skips ETag generation, so second-level timestamps can make distinct responses look identical and break cache-related tests.

Jasmine: Creating DOM elements efficiently

Efficient ways to create DOM test fixtures for Jasmine, from HTML parsing and selector helpers to innerHTML, with readable structure and direct element references.

Custom Angular Test Bootstrap

Custom Angular test bootstraps centralize global providers, matchers, and test-wide setup while preserving CLI strict error checking.

Best practices: Writing a Rails script (and how to test it)

Rails one-off scripts need idempotence, transactions, transparency, and robust error handling; isolating logic from input also makes them testable.

Test your application's e-mail spam scoring with mail-tester.com

Check outbound mail for spam filters and deliverability issues with mail-tester.com; a score around 9/10 is usually fine, while plain-text bodies and proper DNS help avoid false positives.

Automatically validating dependency licenses with License Finder

Dependency licenses can break closed-source projects when unapproved OSS terms slip in. License Finder validates all dependencies during test runs and flags restricted licenses early.

Test-Driven Development with integration and unit tests: a pragmatic approach

Dogmatic red-green-refactor TDD can be tedious; a pragmatic mix of integration and unit tests uses scenario titles as a todo list and supports iterative development.

Faking and testing the network with WebMock

Network-dependent tests can avoid real HTTP by stubbing remote responses and asserting requests with WebMock, including query strings and bodies for GET and POST.