Skip to content

Instantly share code, notes, and snippets.

@tomazy
tomazy / index.html
Last active December 27, 2015 17:59
backbone.js + knockout.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script>
<script type='text/javascript' src="http://underscorejs.org/underscore-min.js"></script>
<script type='text/javascript' src="http://backbonejs.org/backbone-min.js"></script>
<script type='text/javascript' src="http://knockoutjs.com/downloads/knockout-3.0.0.js"></script>
</head>
</body>
require 'selenium/webdriver'
class Selenium::WebDriver::Navigation
alias_method :original_to, :to
def to(url)
url = 'file://reset-session-hack' if url == 'about:blank'
original_to(url)
end
end
@tomazy
tomazy / base.rb
Last active December 17, 2015 20:49
Using data- attributes in SitePrism/Capybara
Capybara.add_selector(:test_element) do
xpath { |name| XPath.css("[data-test-element='#{name}']") }
end
module TestElement
def test_element(name)
element(name, :test_element, name.to_s)
end
def test_sections(section_name, section_class, matcher_name)