Upgrading Cucumber and Capybara to the latest versions available for Rails 2
Rails 2-compatible versions of Cucumber, Capybara, and related gems avoid breakage from newer dependencies and Capybara API changes.
How to display an unsaved changes alert
Unsaved form edits can be lost when a tab closes or a full page unload occurs. beforeunload with preventDefault() triggers the browser's standard warning.
Middleman configuration for Rails Developers
Rails-friendly Middleman setup for live reload, asset pipeline, i18n, environment-specific config, browser testing, and Capistrano deployment.
Virtual scrolling: A solution for scrolling wide content on desktops
Wide tables on desktop can be hard to scroll without moving the rest of the page or hiding the scrollbar off screen. Reusing the page scrollbar with position: sticky and translateX keeps the content centered.
Capybara: Pretending to interact with the document
Browsers block autoplay and popup APIs until a user gesture occurs; a tiny clicked element can unlock them in Capybara tests.
Jasmine: Testing complex types for equality
toBe only checks reference identity; toEqual handles arrays, objects, dates, regular expressions, NaN, exceptions, and custom equality testers.
Copy to clipboard without flash (clipboard.js)
Flash-free copy-to-clipboard handling with clipboard.js, including success and error callbacks, text selection feedback, and support for text fields or data attributes.
Capturing signatures on a touch device
Touch-device signature capture for web forms with jQuery Signature Pad, plus server-side PNG generation from the stored stroke data.
Capybara: Most okayest helper to download and inspect files
Reliable file-download testing in Capybara, including filename, content type, disposition, and text inspection across Selenium and Rack::Test without leaving the page.
The HTML5 video element
Browser video playback needs format fallbacks, subtitles, and careful state handling; poster, controls, and the HTMLVideoElement API help build reliable players.
parallel_tests: Disable parallel run for tagged scenarios
Tag specific Cucumber scenarios so they avoid running together when they contend for a shared resource or browser focus, at the cost of slower tests.
Asset Pipeline Basics
Rails asset delivery relies on manifests and explicit requires; precompilation output helps verify URLs and troubleshoot missing or misplaced assets.
Nested Spreewald patiently blocks are now patient
Nested patiently blocks now wait independently in Spreewald, preventing detached DOM failures when with_scope reuses cached elements.
How to make Webpacker compile once for parallel tests, and only if necessary
Compile Webpacker assets once in parallel test runs and skip recompilation when files are unchanged, avoiding duplicate work and Capybara timeouts.
Testing focus/blur events with Cucumber
Firefox and Selenium can delay real blur events in Cucumber tests, making focus-dependent listeners hard to exercise; ChromeDriver and a custom event workaround avoid the issue.
Rails 3: Make "link_to :remote => true" replace HTML elements with jQuery
Rails 3 remote links can replace page content with returned HTML, restoring the Rails 2 link_to_remote update behavior through jQuery and rails-ujs.
Clicking issues with chromedriver
ChromeDriver click targeting can hit the wrong point on an element, causing intercepted or non-clickable errors when overlays or nearby elements overlap.
Unpoly 2: Don't try to download files through AJAX requests
AJAX downloads fail because browsers try to render files instead of saving them. Exclude download links from Unpoly link handling and use Content-Disposition: attachment or download.
How to detect touch-capable browsers
Touch-capable browser detection is imperfect, but checking for touch events offers the best tradeoff when feature-based detection is needed instead of device detection.
When does Webpacker compile?
Webpacker compiles assets on demand in Rails, which can freeze helpers and slow page reloads when no dev server is running.
Cucumber: Wait until CKEditor is loaded
Timing issues can cause undefined errors when interacting with CKEditor in Cucumber tests. Waiting for the editor to reach ready avoids flaky WYSIWYG input steps.
How to call overwritten methods of parent classes in Backbone.js
Backbone models often need overridden methods to keep parent behavior. __super__ lets an երեխա class call inherited initialize with the same arguments.
How to open a new tab with Selenium
Browser popup blocking prevents window.open from Selenium; injecting a clickable temporary link opens a new tab reliably in Chrome.
Upgrade guide for moving a Rails app from Webpack 3 to Webpack 4
Webpacker 4 and Babel 7 change config files, package names, asset paths, and polyfill imports when upgrading a Rails app from Webpack 3.