mirror of
https://github.com/appium/appium.git
synced 2026-04-30 07:19:50 -05:00
Make Ruby Sauce example report success, and actually work
This commit is contained in:
@@ -21,7 +21,10 @@ require 'selenium/webdriver/remote/http/persistent'
|
||||
require "rspec"
|
||||
require "rest_client"
|
||||
|
||||
def capabilities
|
||||
SAUCE_USERNAME = ENV['SAUCE_USERNAME']
|
||||
SAUCE_ACCESS_KEY = ENV['SAUCE_ACCESS_KEY']
|
||||
|
||||
def desired_capabilites
|
||||
{
|
||||
"device" => "Android",
|
||||
"browserName" => "",
|
||||
@@ -32,9 +35,9 @@ def capabilities
|
||||
}
|
||||
end
|
||||
|
||||
def url_with_credentials
|
||||
un = ENV["SAUCE_USERNAME"]
|
||||
pw = ENV["SAUCE_ACCESS_KEY"]
|
||||
def auth_details
|
||||
un = SAUCE_USERNAME
|
||||
pw = SAUCE_ACCESS_KEY
|
||||
|
||||
unless un && pw
|
||||
STDERR.puts <<-EOF
|
||||
@@ -51,7 +54,15 @@ def url_with_credentials
|
||||
exit
|
||||
end
|
||||
|
||||
return "http://#{un}:#{pw}@ondemand.saucelabs.com:80/wd/hub"
|
||||
return "#{un}:#{pw}"
|
||||
end
|
||||
|
||||
def server_url
|
||||
return "http://#{auth_details}@ondemand.saucelabs.com:80/wd/hub"
|
||||
end
|
||||
|
||||
def rest_jobs_url
|
||||
"https://#{auth_details}@saucelabs.com/rest/v1/#{SAUCE_USERNAME}/jobs"
|
||||
end
|
||||
|
||||
# Because WebDriver doesn't have the concept of test failure, use the Sauce
|
||||
@@ -67,8 +78,8 @@ describe "Notepad" do
|
||||
|
||||
@driver ||= Selenium::WebDriver.for(
|
||||
:remote,
|
||||
:desired_capabilities => capabilities,
|
||||
:url => url_with_credentials,
|
||||
:desired_capabilities => desired_capabilites,
|
||||
:url => server_url,
|
||||
:http_client => http_client
|
||||
)
|
||||
|
||||
@@ -83,10 +94,6 @@ describe "Notepad" do
|
||||
@driver.quit
|
||||
end
|
||||
|
||||
after :all do
|
||||
@driver.quit if @driver
|
||||
end
|
||||
|
||||
it "can create and save new notes" do
|
||||
new_button = @driver.find_element(:name, "New note")
|
||||
new_button.click
|
||||
|
||||
Reference in New Issue
Block a user