testingbot 0.1.5 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/test.yml +26 -0
  3. data/.travis.yml +7 -3
  4. data/LICENSE +1 -1
  5. data/README.md +207 -0
  6. data/bin/testingbot +4 -3
  7. data/lib/testingbot.rb +1 -5
  8. data/lib/testingbot/api.rb +153 -35
  9. data/lib/testingbot/version.rb +1 -1
  10. data/spec/integration/api_spec.rb +38 -18
  11. data/spec/resources/test.apk +1 -0
  12. data/spec/spec_helper.rb +6 -3
  13. metadata +55 -94
  14. data/README.rdoc +0 -237
  15. data/examples/android.rb +0 -14
  16. data/examples/capybara.rb +0 -22
  17. data/examples/capybara_multiple_browsers.rb +0 -38
  18. data/examples/cucumber/README.rdoc +0 -15
  19. data/examples/cucumber/Rakefile +0 -20
  20. data/examples/cucumber/features/support/env.rb +0 -13
  21. data/examples/cucumber/features/youtube.feature +0 -10
  22. data/examples/cucumber/features/youtube_steps.rb +0 -15
  23. data/examples/test_rspec.rb +0 -17
  24. data/examples/test_rspec1.rb +0 -36
  25. data/examples/test_unit.rb +0 -30
  26. data/lib/testingbot/capybara.rb +0 -66
  27. data/lib/testingbot/config.rb +0 -125
  28. data/lib/testingbot/cucumber.rb +0 -35
  29. data/lib/testingbot/hooks.rb +0 -287
  30. data/lib/testingbot/jasmine.rb +0 -29
  31. data/lib/testingbot/jasmine/README.rdoc +0 -16
  32. data/lib/testingbot/jasmine/Rakefile +0 -35
  33. data/lib/testingbot/jasmine/public/javascripts/Player.js +0 -22
  34. data/lib/testingbot/jasmine/public/javascripts/Song.js +0 -7
  35. data/lib/testingbot/jasmine/runner.rb +0 -4
  36. data/lib/testingbot/jasmine/spec/javascripts/PlayerSpec.js +0 -58
  37. data/lib/testingbot/jasmine/spec/javascripts/helpers/SpecHelper.js +0 -9
  38. data/lib/testingbot/jasmine/spec/javascripts/support/jasmine.yml +0 -73
  39. data/lib/testingbot/jasmine/test/Rakefile +0 -9
  40. data/lib/testingbot/jasmine/test/public/javascripts/Player.js +0 -22
  41. data/lib/testingbot/jasmine/test/public/javascripts/Song.js +0 -7
  42. data/lib/testingbot/jasmine/test/spec/javascripts/PlayerSpec.js +0 -58
  43. data/lib/testingbot/jasmine/test/spec/javascripts/helpers/SpecHelper.js +0 -9
  44. data/lib/testingbot/jasmine/test/spec/javascripts/support/jasmine.yml +0 -73
  45. data/lib/testingbot/selenium.rb +0 -127
  46. data/lib/testingbot/tunnel.rb +0 -104
  47. data/spec/integration/selenium1_spec.rb +0 -53
  48. data/spec/integration/selenium2_spec.rb +0 -60
  49. data/spec/integration/tunnel_spec.rb +0 -84
  50. data/spec/unit/api_spec.rb +0 -17
  51. data/spec/unit/config_spec.rb +0 -73
  52. data/spec/unit/tunnel_spec.rb +0 -41
  53. data/testingbot.gemspec +0 -25
  54. data/vendor/Testingbot-Tunnel.jar +0 -0
@@ -1,53 +0,0 @@
1
- require "uri"
2
- require "net/http"
3
- require 'rspec'
4
-
5
- @@success = true
6
- @@check_api = true
7
-
8
- # disabled until RSpec2 has append_after support
9
- # ::RSpec.configuration.after :each do
10
- # if @@check_api
11
- # api = TestingBot::Api.new
12
- # single_test = api.get_single_test(@selenium_driver.session_id)
13
- # single_test["success"].should eql(@@success)
14
- # single_test["extra"].should eql("just a test")
15
- # end
16
- # end
17
-
18
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
19
-
20
- describe "Selenium RC test" do
21
-
22
- before(:all) do
23
- @selenium_driver = Selenium::Client::Driver.new \
24
- :browser => "firefox",
25
- :url => "http://testingbot.com",
26
- :timeout_in_second => 60,
27
- :platform => "WINDOWS",
28
- :version => "10"
29
- end
30
- before(:each) do
31
- @selenium_driver.start_new_browser_session({ :extra => "just a test" })
32
- end
33
-
34
- after(:each) do
35
- @selenium_driver.close_current_browser_session
36
- end
37
-
38
- context "Connect and run successfully to the TestingBot Grid with Selenium 1 (RC)" do
39
- it "should be able to run an RC test successfully" do
40
- @check_api = false
41
- @selenium_driver.open "/"
42
- @selenium_driver.text?("TestingBot").should be_true
43
- end
44
- end
45
-
46
- context "Check that we report the test status back successfully" do
47
- it "should send a success status to TestingBot upon success of the test" do
48
- @check_api = true
49
- @selenium_driver.open "/"
50
- @selenium_driver.text?("TestingBot").should be_true
51
- end
52
- end
53
- end
@@ -1,60 +0,0 @@
1
- require "uri"
2
- require "net/http"
3
- require 'rspec'
4
-
5
- @@success = true
6
- @@check_api = true
7
-
8
- # disabled until RSpec2 has append_after support
9
- # ::RSpec.configuration.after :each do
10
- # if @@check_api
11
- # api = TestingBot::Api.new
12
- # single_test = api.get_single_test(@selenium_driver.session_id)
13
- # single_test["success"].should eql(@@success)
14
- # end
15
- # end
16
-
17
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
18
-
19
-
20
- TestingBot::config do |config|
21
- config[:desired_capabilities] = { :browserName => "firefox", :version => 9, :platform => "WINDOWS" }
22
- end
23
-
24
- describe "Selenium WebDriver test" do
25
-
26
- before(:all) do
27
- @selenium_driver = TestingBot::SeleniumWebdriver.new
28
- end
29
-
30
- after(:each) do
31
- @selenium_driver.stop
32
- end
33
-
34
- context "Connect and run successfully to the TestingBot Grid with Selenium 2" do
35
- it "should be able to run an RC test successfully" do
36
- @check_api = false
37
- @selenium_driver.navigate.to "http://testingbot.com"
38
- @selenium_driver.title.should match /^Selenium Testing/
39
- end
40
- end
41
- end
42
-
43
- describe "Selenium WebDriver test API" do
44
-
45
- before(:all) do
46
- @selenium_driver = TestingBot::SeleniumWebdriver.new
47
- end
48
-
49
- after(:each) do
50
- @selenium_driver.stop
51
- end
52
-
53
- context "Check that we report the test status back successfully" do
54
- it "should send a success status to TestingBot upon success of the test" do
55
- @check_api = true
56
- @selenium_driver.navigate.to "http://testingbot.com"
57
- @selenium_driver.title.should match /^Selenium Testing/
58
- end
59
- end
60
- end
@@ -1,84 +0,0 @@
1
- require 'rspec'
2
- require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
3
-
4
- describe "Testingbot Tunnel" do
5
- after :each do
6
- @tunnel.stop if @tunnel.is_connected?
7
- TestingBot.reset_config!
8
- end
9
-
10
- context "the tunnel should start and block until it's ready" do
11
- it "should successfully start a tunnel connection" do
12
- @tunnel = TestingBot::Tunnel.new()
13
- @tunnel.start
14
- @tunnel.is_connected?.should == true
15
- end
16
-
17
- it "should raise an exception when trying to stop a tunnel that has not been started yet" do
18
- @tunnel = TestingBot::Tunnel.new()
19
- lambda { @tunnel.stop }.should raise_error(RuntimeError, /not been started/)
20
- end
21
- end
22
-
23
- context "the tunnel needs to handle proper credentials" do
24
- it "should fail to start a tunnel connection when invalid credentials are supplied" do
25
- @tunnel = TestingBot::Tunnel.new({ :client_key => "fake", :client_secret => "bogus" })
26
- @tunnel.start
27
- @tunnel.is_connected?.should == false
28
- @tunnel.errors.should_not be_empty
29
- @tunnel.kill
30
- end
31
-
32
- it "should try to fetch client_key and client_secret from the ~/.testingbot file when no credentials supplied" do
33
- if File.exists?(File.expand_path("~/.testingbot"))
34
- @tunnel = TestingBot::Tunnel.new()
35
- @tunnel.start
36
- @tunnel.is_connected?.should == true
37
- end
38
- end
39
- end
40
-
41
- context "the tunnel needs to accept extra options" do
42
- it "should accept extra options" do
43
- if File.exists?(File.expand_path("~/testingbot_ready.txt"))
44
- File.delete(File.expand_path("~/testingbot_ready.txt"))
45
- end
46
-
47
- File.exists?(File.expand_path("~/testingbot_ready.txt")).should == false
48
-
49
- @tunnel = TestingBot::Tunnel.new({ :options => ['-f ~/testingbot_ready.txt'] })
50
- @tunnel.start
51
- @tunnel.is_connected?.should == true
52
-
53
- File.exists?(File.expand_path("~/testingbot_ready.txt")).should == true
54
- end
55
- end
56
-
57
- context "there should only be one instance of a tunnel running" do
58
- it "should check before starting that another tunnel is not yet running" do
59
- @tunnel = TestingBot::Tunnel.new
60
- @tunnel.start
61
- @tunnel.is_connected?.should == true
62
-
63
- clone = TestingBot::Tunnel.new
64
- clone.start
65
- clone.is_connected?.should == false
66
- end
67
-
68
- it "should not be possible to stop a tunnel that is not running" do
69
- @tunnel = TestingBot::Tunnel.new
70
- lambda { @tunnel.stop }.should raise_error(RuntimeError, /^Can't stop tunnel/)
71
- end
72
- end
73
-
74
- context "When running a tunnel config values should be changed" do
75
- it "should change the host and port in the config so that we connect to our tunnel instead of to the grid directly" do
76
- @tunnel = TestingBot::Tunnel.new
77
- @tunnel.start
78
- @tunnel.is_connected?.should == true
79
- @tunnel.instance_variable_get("@config")[:require_tunnel].should == true
80
- @tunnel.instance_variable_get("@config")[:host].should eql("127.0.0.1")
81
- @tunnel.instance_variable_get("@config")[:port].should eql(4445)
82
- end
83
- end
84
- end
@@ -1,17 +0,0 @@
1
- require "rspec"
2
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/testingbot/config.rb')
3
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/testingbot/api.rb')
4
-
5
- describe TestingBot::Api do
6
- describe "load config" do
7
- it "should load the configuration in the constructor" do
8
- api = TestingBot::Api.new
9
- api.instance_variable_get("@config").should_not be_nil
10
- end
11
-
12
- it "should use the credentials passed in from the constructor, overwriting possible credentials from the config" do
13
- api = TestingBot::Api.new({ :client_key => "fake" })
14
- api.instance_variable_get("@config")[:client_key].should eql("fake")
15
- end
16
- end
17
- end
@@ -1,73 +0,0 @@
1
- require "rspec"
2
- require 'selenium/webdriver'
3
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/testingbot/config.rb')
4
-
5
- describe TestingBot::Config do
6
- describe '#[]' do
7
- it "should return nil for options that don't exist" do
8
- c = TestingBot::Config.new
9
- c[:doesnotexist].should be_nil
10
- end
11
-
12
- it "should return a config value when being set from the constructor" do
13
- c = TestingBot::Config.new({ :client_secret => "secret!!" })
14
- c[:client_secret].should == "secret!!"
15
- end
16
- end
17
-
18
- describe '#[]=' do
19
- it "should successfully set a config value" do
20
- c = TestingBot::Config.new
21
- value = rand * 1000
22
- c[:client_key] = value
23
- c[:client_key].should == value
24
- end
25
- end
26
-
27
- describe "read config file" do
28
- it "should read values from the .testingbot config file" do
29
- if File.exists?(File.expand_path("~/.testingbot"))
30
- c = TestingBot::Config.new
31
- client_key, client_secret = File.open(File.expand_path("~/.testingbot")) { |f| f.readline }.chomp.split(":")
32
- c[:client_key].should == client_key
33
- end
34
- end
35
-
36
- it "should use the options I pass in the constructor, even if I have a config file" do
37
- if File.exists?(File.expand_path("~/.testingbot"))
38
- c = TestingBot::Config.new({ :client_key => "pickme" })
39
- client_key, client_secret = File.open(File.expand_path("~/.testingbot")) { |f| f.readline }.chomp.split(":")
40
- c[:client_key].should == "pickme"
41
- end
42
- end
43
- end
44
-
45
- describe "config values" do
46
- it "should specify a default desired capability if the user did not specify any" do
47
- c = TestingBot::Config.new
48
- c.desired_capabilities.should_not be_empty
49
- end
50
-
51
- it "should be possible to use a Selenium::WebDriver::Remote::Capabilities object for the desired capabilities" do
52
- c = TestingBot::Config.new
53
- c[:desired_capabilities] = Selenium::WebDriver::Remote::Capabilities.firefox
54
- c.desired_capabilities[:browserName].should eql("firefox")
55
- end
56
- end
57
-
58
- describe "usage" do
59
- it "should use the TestingBot.get_config as a singleton" do
60
- c = TestingBot.get_config
61
- c.should eql(TestingBot.get_config)
62
- end
63
-
64
- it "should be possible to reset the configuration" do
65
- c = TestingBot.get_config
66
- c.add_options({ :randomKey => "lol" })
67
-
68
- TestingBot.reset_config!
69
- c = TestingBot.get_config
70
- c[:randomKey].should be_nil
71
- end
72
- end
73
- end
@@ -1,41 +0,0 @@
1
- require "rspec"
2
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/testingbot/config.rb')
3
- require File.expand_path(File.dirname(__FILE__) + '/../../lib/testingbot/tunnel.rb')
4
-
5
- describe TestingBot::Tunnel do
6
- describe "load config" do
7
- it "should load the configuration in the constructor" do
8
- tunnel = TestingBot::Tunnel.new
9
- tunnel.instance_variable_get("@config").should_not be_nil
10
- end
11
-
12
- it "should should not overwrite the config with arguments supplied in the constructor" do
13
- tunnel = TestingBot::Tunnel.new({ :client_key => "fake" })
14
- tunnel.instance_variable_get("@config")[:client_key].should_not eql("fake")
15
- end
16
-
17
- it "should allow for extra options to be specified, which will be passed to the jar's argument list" do
18
- tunnel = TestingBot::Tunnel.new({ :options => ["-f readyfile.txt", "-F *.com"] })
19
- tunnel.extra_options.should eql("-f readyfile.txt -F *.com")
20
- end
21
- end
22
-
23
- describe "before starting the tunnel" do
24
- it "should have 0 errors" do
25
- tunnel = TestingBot::Tunnel.new
26
- tunnel.errors.should be_empty
27
- end
28
-
29
- it "should not be connected" do
30
- tunnel = TestingBot::Tunnel.new
31
- tunnel.is_connected?.should == false
32
- end
33
- end
34
-
35
- describe "before stopping the tunnel" do
36
- it "should check if the tunnel has been started yet" do
37
- tunnel = TestingBot::Tunnel.new
38
- lambda { tunnel.stop }.should raise_error(RuntimeError, /^Can't stop tunnel/)
39
- end
40
- end
41
- end
data/testingbot.gemspec DELETED
@@ -1,25 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "testingbot/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "testingbot"
7
- s.version = Testingbot::VERSION
8
- s.authors = ["Jochen Delabie"]
9
- s.email = ["info@testingbot.com"]
10
- s.homepage = "http://www.testingbot.com"
11
- s.summary = "Ruby Gem to be used with testingbot.com"
12
- s.description = "This gem makes using our Selenium grid on testingbot.com easy"
13
-
14
- s.rubyforge_project = "testingbot"
15
-
16
- s.files = `git ls-files`.split("\n")
17
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
- s.require_paths = ["lib"]
20
- s.add_dependency "json"
21
- s.add_dependency "net-http-persistent"
22
- s.add_dependency "selenium-webdriver"
23
- s.add_development_dependency "rspec", [">= 2.9.0"]
24
- s.add_development_dependency "rake"
25
- end
Binary file