testingbot 0.1.5 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/test.yml +26 -0
- data/.travis.yml +7 -3
- data/LICENSE +1 -1
- data/README.md +207 -0
- data/bin/testingbot +4 -3
- data/lib/testingbot.rb +1 -5
- data/lib/testingbot/api.rb +153 -35
- data/lib/testingbot/version.rb +1 -1
- data/spec/integration/api_spec.rb +38 -18
- data/spec/resources/test.apk +1 -0
- data/spec/spec_helper.rb +6 -3
- metadata +55 -94
- data/README.rdoc +0 -237
- data/examples/android.rb +0 -14
- data/examples/capybara.rb +0 -22
- data/examples/capybara_multiple_browsers.rb +0 -38
- data/examples/cucumber/README.rdoc +0 -15
- data/examples/cucumber/Rakefile +0 -20
- data/examples/cucumber/features/support/env.rb +0 -13
- data/examples/cucumber/features/youtube.feature +0 -10
- data/examples/cucumber/features/youtube_steps.rb +0 -15
- data/examples/test_rspec.rb +0 -17
- data/examples/test_rspec1.rb +0 -36
- data/examples/test_unit.rb +0 -30
- data/lib/testingbot/capybara.rb +0 -66
- data/lib/testingbot/config.rb +0 -125
- data/lib/testingbot/cucumber.rb +0 -35
- data/lib/testingbot/hooks.rb +0 -287
- data/lib/testingbot/jasmine.rb +0 -29
- data/lib/testingbot/jasmine/README.rdoc +0 -16
- data/lib/testingbot/jasmine/Rakefile +0 -35
- data/lib/testingbot/jasmine/public/javascripts/Player.js +0 -22
- data/lib/testingbot/jasmine/public/javascripts/Song.js +0 -7
- data/lib/testingbot/jasmine/runner.rb +0 -4
- data/lib/testingbot/jasmine/spec/javascripts/PlayerSpec.js +0 -58
- data/lib/testingbot/jasmine/spec/javascripts/helpers/SpecHelper.js +0 -9
- data/lib/testingbot/jasmine/spec/javascripts/support/jasmine.yml +0 -73
- data/lib/testingbot/jasmine/test/Rakefile +0 -9
- data/lib/testingbot/jasmine/test/public/javascripts/Player.js +0 -22
- data/lib/testingbot/jasmine/test/public/javascripts/Song.js +0 -7
- data/lib/testingbot/jasmine/test/spec/javascripts/PlayerSpec.js +0 -58
- data/lib/testingbot/jasmine/test/spec/javascripts/helpers/SpecHelper.js +0 -9
- data/lib/testingbot/jasmine/test/spec/javascripts/support/jasmine.yml +0 -73
- data/lib/testingbot/selenium.rb +0 -127
- data/lib/testingbot/tunnel.rb +0 -104
- data/spec/integration/selenium1_spec.rb +0 -53
- data/spec/integration/selenium2_spec.rb +0 -60
- data/spec/integration/tunnel_spec.rb +0 -84
- data/spec/unit/api_spec.rb +0 -17
- data/spec/unit/config_spec.rb +0 -73
- data/spec/unit/tunnel_spec.rb +0 -41
- data/testingbot.gemspec +0 -25
- data/vendor/Testingbot-Tunnel.jar +0 -0
data/examples/android.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
require "rubygems"
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/../lib/testingbot/config.rb')
|
4
|
-
require File.expand_path(File.dirname(__FILE__) + '/../lib/testingbot/selenium.rb')
|
5
|
-
|
6
|
-
TestingBot::config do |config|
|
7
|
-
config[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.android
|
8
|
-
end
|
9
|
-
|
10
|
-
driver = TestingBot::SeleniumWebdriver.new
|
11
|
-
|
12
|
-
driver.navigate.to "http://testingbot.com/"
|
13
|
-
puts driver.title
|
14
|
-
driver.quit
|
data/examples/capybara.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'capybara/rspec'
|
3
|
-
require 'testingbot'
|
4
|
-
require 'testingbot/capybara'
|
5
|
-
|
6
|
-
TestingBot::config do |config|
|
7
|
-
config[:desired_capabilities] = { :browserName => "firefox", :version => 9, :platform => "WINDOWS" }
|
8
|
-
config[:options] = { :screenshot => false, :extra => "Some extra data" }
|
9
|
-
#config.require_tunnel
|
10
|
-
end
|
11
|
-
|
12
|
-
describe "People", :type => :request do
|
13
|
-
before :all do
|
14
|
-
Capybara.current_driver = :testingbot
|
15
|
-
Capybara.app_host = "http://testingbot.com"
|
16
|
-
end
|
17
|
-
|
18
|
-
it 'has a homepage with the word Selenium' do
|
19
|
-
visit '/'
|
20
|
-
page.should have_content('Selenium')
|
21
|
-
end
|
22
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'capybara/rspec'
|
3
|
-
require 'testingbot'
|
4
|
-
require 'testingbot/capybara'
|
5
|
-
|
6
|
-
browsers = [{ :browserName => "firefox", :version => 9, :platform => "WINDOWS" }, { :browserName => "firefox", :version => 10, :platform => "WINDOWS" }]
|
7
|
-
|
8
|
-
browsers.each do |browser|
|
9
|
-
|
10
|
-
shared_examples "an example test on #{browser[:browserName]} #{browser[:version]}" do |actions|
|
11
|
-
describe "Demo", :type => :request do
|
12
|
-
before :all do
|
13
|
-
TestingBot::config do |config|
|
14
|
-
config[:desired_capabilities] = browser
|
15
|
-
end
|
16
|
-
Capybara.run_server = false
|
17
|
-
Capybara.current_driver = :testingbot
|
18
|
-
Capybara.app_host = "http://testingbot.com"
|
19
|
-
end
|
20
|
-
|
21
|
-
after :all do
|
22
|
-
TestingBot.reset_config!
|
23
|
-
Capybara.current_driver = :testingbot
|
24
|
-
page.driver.browser.quit
|
25
|
-
page.driver.instance_variable_set(:@browser, nil)
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'has a homepage with the word Selenium' do
|
29
|
-
visit '/'
|
30
|
-
page.should have_content('Selenium')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe "Sample", :type => :request do
|
36
|
-
it_behaves_like "an example test on #{browser[:browserName]} #{browser[:version]}"
|
37
|
-
end
|
38
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Testing with Cucumber, Selenium and Capybara
|
2
|
-
|
3
|
-
== Usage
|
4
|
-
|
5
|
-
This example contains a basic Cucumber story which will run on TestingBot.
|
6
|
-
Included you will find a Rakefile which contains a cucumber task.
|
7
|
-
If you run this Rake task you can run the same Cucumber story on multiple browsers.
|
8
|
-
|
9
|
-
rake cucumber
|
10
|
-
|
11
|
-
You can specify the browser list inside the Rakefile.
|
12
|
-
|
13
|
-
=== More information
|
14
|
-
|
15
|
-
More info at http://testingbot.com/support/getting-started/ruby.html
|
data/examples/cucumber/Rakefile
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require "rubygems"
|
2
|
-
require 'rake'
|
3
|
-
require 'rake/testtask'
|
4
|
-
require 'cucumber/rake/task'
|
5
|
-
require 'selenium/rake/tasks'
|
6
|
-
|
7
|
-
task :cucumber do
|
8
|
-
browsers = [{ :browserName => "firefox", :version => 9, :platform => "WINDOWS" }, { :browserName => "firefox", :version => 10, :platform => "WINDOWS" }]
|
9
|
-
|
10
|
-
browsers.each do |browser|
|
11
|
-
ENV['SELENIUM_BROWSERNAME'] = browser[:browserName]
|
12
|
-
ENV['SELENIUM_BROWSERVERSION'] = browser[:version].to_s
|
13
|
-
ENV['SELENIUM_BROWSERPLATFORM'] = browser[:platform]
|
14
|
-
Rake::Task[:run_cucumber].execute(browser)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
Cucumber::Rake::Task.new(:run_cucumber) do |t|
|
19
|
-
t.cucumber_opts = ["features"]
|
20
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
require 'capybara'
|
2
|
-
require 'capybara/cucumber'
|
3
|
-
require 'rspec'
|
4
|
-
require 'selenium/webdriver'
|
5
|
-
require 'testingbot/cucumber'
|
6
|
-
|
7
|
-
unless ENV['SELENIUM_BROWSERNAME'].nil?
|
8
|
-
TestingBot::config do |config|
|
9
|
-
config[:desired_capabilities] = { :browserName => ENV['SELENIUM_BROWSERNAME'], :version => ENV['SELENIUM_BROWSERVERSION'], :platform => ENV['SELENIUM_BROWSERPLATFORM'] }
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
Capybara.default_driver = :testingbot
|
@@ -1,10 +0,0 @@
|
|
1
|
-
@selenium
|
2
|
-
Feature: YouTube has a search function.
|
3
|
-
|
4
|
-
Background:
|
5
|
-
Given I am on YouTube
|
6
|
-
|
7
|
-
Scenario: Search for a term
|
8
|
-
When I fill in "search_query" with "text adventure"
|
9
|
-
And I press "search-btn"
|
10
|
-
Then I should see "GET LAMP: The Text Adventure Documentary"
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Given /^I am on (.+)$/ do |url|
|
2
|
-
visit "http://www.youtube.com"
|
3
|
-
end
|
4
|
-
|
5
|
-
When /^I fill in "([^"]*)" with "([^"]*)"$/ do |field, value|
|
6
|
-
fill_in(field, :with => value)
|
7
|
-
end
|
8
|
-
|
9
|
-
When /^I press "([^"]*)"$/ do |button|
|
10
|
-
click_button(button)
|
11
|
-
end
|
12
|
-
|
13
|
-
Then /^I should see "([^"]*)"$/ do |text|
|
14
|
-
page.should have_content(text)
|
15
|
-
end
|
data/examples/test_rspec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require "selenium/client"
|
3
|
-
require 'rspec'
|
4
|
-
require 'testingbot'
|
5
|
-
require 'testingbot/tunnel'
|
6
|
-
|
7
|
-
TestingBot::config do |config|
|
8
|
-
config[:desired_capabilities] = [{ :browserName => "firefox", :version => 9, :platform => "WINDOWS" }, { :browserName => "firefox", :version => 11, :platform => "WINDOWS" }]
|
9
|
-
end
|
10
|
-
|
11
|
-
# rspec 2
|
12
|
-
describe "People", :type => :selenium, :multibrowser => true do
|
13
|
-
it "can find the right title" do
|
14
|
-
page.navigate.to "http://www.google.com"
|
15
|
-
page.title.should eql("Google")
|
16
|
-
end
|
17
|
-
end
|
data/examples/test_rspec1.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
gem "rspec", "<2"
|
3
|
-
gem "selenium-client"
|
4
|
-
require "selenium/client"
|
5
|
-
require "selenium/rspec/spec_helper"
|
6
|
-
gem "testingbot"
|
7
|
-
require "testingbot"
|
8
|
-
|
9
|
-
describe "People" do
|
10
|
-
attr_reader :selenium_driver
|
11
|
-
alias :page :selenium_driver
|
12
|
-
|
13
|
-
before(:all) do
|
14
|
-
@selenium_driver = Selenium::Client::Driver.new \
|
15
|
-
:host => "hub.testingbot.com",
|
16
|
-
:port => 4444,
|
17
|
-
:browser => "firefox",
|
18
|
-
:url => "http://www.google.com",
|
19
|
-
:timeout_in_second => 60,
|
20
|
-
:platform => "WINDOWS",
|
21
|
-
:version => "10"
|
22
|
-
end
|
23
|
-
|
24
|
-
before(:each) do
|
25
|
-
@selenium_driver.start_new_browser_session
|
26
|
-
end
|
27
|
-
|
28
|
-
append_after(:each) do
|
29
|
-
@selenium_driver.close_current_browser_session
|
30
|
-
end
|
31
|
-
|
32
|
-
it "can find the right title" do
|
33
|
-
page.open "/"
|
34
|
-
page.title.should eql("Google")
|
35
|
-
end
|
36
|
-
end
|
data/examples/test_unit.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'test/unit'
|
3
|
-
require "selenium/client"
|
4
|
-
require 'testingbot'
|
5
|
-
|
6
|
-
class ExampleTest < TestingBot::TestCase
|
7
|
-
attr_reader :browser
|
8
|
-
|
9
|
-
def setup
|
10
|
-
@browser = Selenium::Client::Driver.new \
|
11
|
-
:host => "hub.testingbot.com",
|
12
|
-
:port => 4444,
|
13
|
-
:browser => "firefox",
|
14
|
-
:platform => "WINDOWS",
|
15
|
-
:version => "10",
|
16
|
-
:url => "http://www.google.com",
|
17
|
-
:timeout_in_second => 60
|
18
|
-
|
19
|
-
browser.start_new_browser_session
|
20
|
-
end
|
21
|
-
|
22
|
-
def teardown
|
23
|
-
browser.close_current_browser_session
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_page_search
|
27
|
-
browser.open "/"
|
28
|
-
assert_equal "Google", browser.title
|
29
|
-
end
|
30
|
-
end
|
data/lib/testingbot/capybara.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
require 'capybara'
|
2
|
-
require 'testingbot/config'
|
3
|
-
require 'testingbot/tunnel'
|
4
|
-
require 'testingbot/selenium'
|
5
|
-
require 'capybara/dsl'
|
6
|
-
|
7
|
-
@tunnel = nil
|
8
|
-
|
9
|
-
module TestingBot
|
10
|
-
module Capybara
|
11
|
-
|
12
|
-
def self.start_tunnel
|
13
|
-
return @tunnel unless @tunnel.nil?
|
14
|
-
|
15
|
-
@tunnel = TestingBot::Tunnel.new(TestingBot.get_config[:tunnel_options] || {})
|
16
|
-
@tunnel.start
|
17
|
-
end
|
18
|
-
|
19
|
-
class CustomDriver < ::Capybara::Selenium::Driver
|
20
|
-
|
21
|
-
def session_id
|
22
|
-
@browser.session_id
|
23
|
-
end
|
24
|
-
|
25
|
-
def browser
|
26
|
-
unless @browser
|
27
|
-
if TestingBot.get_config[:require_tunnel]
|
28
|
-
TestingBot::Capybara.start_tunnel
|
29
|
-
end
|
30
|
-
|
31
|
-
@browser = TestingBot::SeleniumWebdriver.new(@options || {})
|
32
|
-
|
33
|
-
main = Process.pid
|
34
|
-
at_exit do
|
35
|
-
if @browser
|
36
|
-
begin
|
37
|
-
@browser.quit
|
38
|
-
rescue
|
39
|
-
end
|
40
|
-
end
|
41
|
-
if TestingBot.get_config[:require_tunnel]
|
42
|
-
@tunnel.stop unless @tunnel.nil?
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
@browser
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
module Capybara
|
53
|
-
class Session
|
54
|
-
def stop
|
55
|
-
driver.quit
|
56
|
-
end
|
57
|
-
|
58
|
-
def session_id
|
59
|
-
driver.session_id
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
Capybara.register_driver :testingbot do |app|
|
65
|
-
TestingBot::Capybara::CustomDriver.new(app)
|
66
|
-
end
|
data/lib/testingbot/config.rb
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
module TestingBot
|
2
|
-
@@config = nil
|
3
|
-
def self.get_config
|
4
|
-
@@config = TestingBot::Config.new if @@config.nil?
|
5
|
-
@@config
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.reset_config!
|
9
|
-
@@config = nil
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.config
|
13
|
-
yield self.get_config
|
14
|
-
end
|
15
|
-
|
16
|
-
class Config
|
17
|
-
|
18
|
-
attr_reader :options
|
19
|
-
|
20
|
-
def initialize(options = {})
|
21
|
-
@options = default_options
|
22
|
-
@options = @options.merge(load_config_file)
|
23
|
-
@options = @options.merge(load_config_environment)
|
24
|
-
@options = @options.merge(options)
|
25
|
-
end
|
26
|
-
|
27
|
-
def [](key)
|
28
|
-
@options[key]
|
29
|
-
end
|
30
|
-
|
31
|
-
def add_options(options = {})
|
32
|
-
@options = @options.merge(options)
|
33
|
-
end
|
34
|
-
|
35
|
-
def []=(key, value)
|
36
|
-
@options[key] = value
|
37
|
-
end
|
38
|
-
|
39
|
-
def options
|
40
|
-
@options
|
41
|
-
end
|
42
|
-
|
43
|
-
def require_tunnel(host = "127.0.0.1", port = 4445)
|
44
|
-
@options[:require_tunnel] = true
|
45
|
-
@options[:host] = host
|
46
|
-
@options[:port] = port
|
47
|
-
end
|
48
|
-
|
49
|
-
def client_key
|
50
|
-
@options[:client_key]
|
51
|
-
end
|
52
|
-
|
53
|
-
def client_secret
|
54
|
-
@options[:client_secret]
|
55
|
-
end
|
56
|
-
|
57
|
-
def desired_capabilities
|
58
|
-
# check if instance of Selenium::WebDriver::Remote::Capabilities
|
59
|
-
unless @options[:desired_capabilities].instance_of?(Hash) || @options[:desired_capabilities].instance_of?(Array)
|
60
|
-
return symbolize_keys @options[:desired_capabilities].as_json
|
61
|
-
end
|
62
|
-
@options[:desired_capabilities]
|
63
|
-
end
|
64
|
-
|
65
|
-
private
|
66
|
-
|
67
|
-
def symbolize_keys(hash)
|
68
|
-
hash.inject({}) {|new_hash, key_value|
|
69
|
-
key, value = key_value
|
70
|
-
value = symbolize_keys(value) if value.is_a?(Hash)
|
71
|
-
new_hash[key.to_sym] = value
|
72
|
-
new_hash
|
73
|
-
}
|
74
|
-
end
|
75
|
-
|
76
|
-
def default_desired_capabilities
|
77
|
-
{ :browserName => "firefox", :version => 9, :platform => "WINDOWS" }
|
78
|
-
end
|
79
|
-
|
80
|
-
def default_options
|
81
|
-
{
|
82
|
-
:host => "hub.testingbot.com",
|
83
|
-
:port => 4444,
|
84
|
-
:jenkins_output => true,
|
85
|
-
:desired_capabilities => default_desired_capabilities
|
86
|
-
}
|
87
|
-
end
|
88
|
-
|
89
|
-
def load_config_file
|
90
|
-
options = {}
|
91
|
-
|
92
|
-
is_windows = false
|
93
|
-
|
94
|
-
begin
|
95
|
-
require 'rbconfig'
|
96
|
-
is_windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
|
97
|
-
rescue
|
98
|
-
is_windows = (RUBY_PLATFORM =~ /w.*32/) || (ENV["OS"] && ENV["OS"] == "Windows_NT")
|
99
|
-
end
|
100
|
-
|
101
|
-
if is_windows
|
102
|
-
config_file = "#{ENV['HOMEDRIVE']}\\.testingbot"
|
103
|
-
else
|
104
|
-
config_file = File.expand_path("~/.testingbot")
|
105
|
-
end
|
106
|
-
|
107
|
-
if File.exists?(config_file)
|
108
|
-
str = File.open(config_file) { |f| f.readline }.chomp
|
109
|
-
options[:client_key], options[:client_secret] = str.split(':')
|
110
|
-
end
|
111
|
-
|
112
|
-
options
|
113
|
-
end
|
114
|
-
|
115
|
-
def load_config_environment
|
116
|
-
options = {}
|
117
|
-
options[:client_key] = ENV['TESTINGBOT_CLIENTKEY']
|
118
|
-
options[:client_secret] = ENV['TESTINGBOT_CLIENTSECRET']
|
119
|
-
|
120
|
-
options.delete_if { |key, value| value.nil?}
|
121
|
-
|
122
|
-
options
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
data/lib/testingbot/cucumber.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'testingbot/config'
|
2
|
-
require 'testingbot/capybara'
|
3
|
-
require 'testingbot/api'
|
4
|
-
|
5
|
-
if defined?(Cucumber)
|
6
|
-
Before('@selenium') do
|
7
|
-
::Capybara.current_driver = :testingbot
|
8
|
-
end
|
9
|
-
|
10
|
-
After('@selenium') do |scenario|
|
11
|
-
if !TestingBot.get_config[:client_key].nil?
|
12
|
-
begin
|
13
|
-
driver = ::Capybara.current_session.driver
|
14
|
-
if driver.browser.respond_to?(:session_id)
|
15
|
-
session_id = driver.browser.session_id
|
16
|
-
else
|
17
|
-
session_id = driver.browser.instance_variable_get("@bridge").instance_variable_get("@session_id")
|
18
|
-
end
|
19
|
-
|
20
|
-
api = TestingBot::Api.new
|
21
|
-
params = {
|
22
|
-
"session_id" => session_id,
|
23
|
-
"status_message" => (scenario.failed? ? scenario.exception.message : ""),
|
24
|
-
"success" => !scenario.failed? ? 1 : 0,
|
25
|
-
"name" => scenario.title,
|
26
|
-
"kind" => 2
|
27
|
-
}
|
28
|
-
|
29
|
-
data = api.update_test(session_id, params)
|
30
|
-
rescue Exception => e
|
31
|
-
p "Could not determine sessionID, can not send results to TestingBot.com #{e.message}"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|