Created
March 13, 2014 15:27
-
-
Save tourdedave/9530563 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV['SAUCE_USERNAME'] = '' | |
ENV['SAUCE_API_KEY'] = '' | |
require 'selenium-webdriver' | |
describe 'Page Title' do | |
before(:each) do | |
browser_name = 'firefox' | |
browser_version = '27' | |
caps = Selenium::WebDriver::Remote::Capabilities.send(browser_name.to_sym) | |
caps.platform = 'Windows XP' | |
caps.version = browser_version.to_s | |
@driver = Selenium::WebDriver.for( | |
:remote, | |
url: "http://#{ENV['SAUCE_USERNAME']}:#{ENV['SAUCE_API_KEY']}@ondemand.saucelabs.com:80/wd/hub", | |
desired_capabilities: caps) | |
$job_message = "Find out more at https://saucelabs.com/tests/#{@driver.session_id}" | |
end | |
after(:each) do | |
@driver.quit | |
end | |
it 'is present' do | |
@driver.get 'http://the-internet.herokuapp.com' | |
@driver.title.include?('The Internet').should_not be_true | |
end | |
end | |
RSpec::Matchers.define :be_true do |expected| | |
match do |actual| | |
actual == true | |
end | |
failure_message_for_should do |actual| | |
"expected: true\n got: #{actual.inspect}#{"\n " + $job_message if $job_message}" | |
end | |
failure_message_for_should_not do |actual| | |
"expected: false\n got: #{actual.inspect}#{"\n " + $job_message if $job_message}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
F | |
Failures: | |
1) Page Title is present | |
Failure/Error: @driver.title.include?('The Internet').should_not be_true | |
expected: false | |
got: true | |
Find out more at https://saucelabs.com/tests/588b87947bf54304977c7cd9dbd54137 | |
# ./selenium_example_spec.rb:28:in `block (2 levels) in <top (required)>' | |
Finished in 14.54 seconds | |
1 example, 1 failure | |
Failed examples: | |
rspec ./selenium_example_spec.rb:26 # Page Title is present | |
shell returned 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment