Skip to content

Instantly share code, notes, and snippets.

druska / native_js_drag_and_drop_helper.js
Created Aug 26, 2015
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
View native_js_drag_and_drop_helper.js
function simulateDragDrop(sourceNode, destinationNode) {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)
techbelly / screenshot-diff.rb
Created Jun 26, 2012
Quick tool for CSS Refactoring - diffs screenshots against a reference
View screenshot-diff.rb
require 'capybara'
require 'capybara/dsl'
require 'capybara/poltergeist'
require 'chunky_png'
require 'tempfile'
Capybara.run_server = false
Capybara.default_driver = :poltergeist
Capybara.javascript_driver = :poltergeist
szimek / capybara_select_dates_and_times.rb
Created Aug 31, 2010
Cucumber steps for selecting time and date (using Capybara)
View capybara_select_dates_and_times.rb
require "xpath" # XPath is a separate gem now
module Cucumber
module Rails
module CapybaraSelectDatesAndTimes
def select_date(field, options = {})
date = Date.parse(options[:with])
selector = %Q{.//fieldset[contains(./legend, "#{field}")]}
within(:xpath, selector) do
find(:xpath, '//select[contains(@id, "_1i")]').find(:xpath, ::XPath::HTML.option(date.year.to_s)).select_option