Skip to content

Instantly share code, notes, and snippets.

@DimaSamodurov
Created July 7, 2011 15:58
Show Gist options
  • Save DimaSamodurov/1069837 to your computer and use it in GitHub Desktop.
Save DimaSamodurov/1069837 to your computer and use it in GitHub Desktop.
Check if Capybara opens firefox
# coding: utf-8
# Upgrading ruby or firefox selenium tests stopped working.
# Use selenium-webdriver >= 0.2.2 with ruby 1.9.2 and Firefox 5.
require "rubygems"
require "capybara/dsl"
class Test
include Capybara::DSL
Capybara.run_server = false
Capybara.register_driver :selenium_firefox do |app|
Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => ENV["firefox_profile"])
end
Capybara.current_driver = :selenium_firefox
Capybara.app_host = "http://www.simpletest.org/"
def run
visit("/");
puts page.has_content?("Familiar with unit testing")
click_on("JUnit")
puts page.has_content?("Welcome to JUnit.org!")
puts page.driver.browser.navigate.back
puts page.has_content?("Familiar with unit testing")
end
end
Test.new.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment