testingbot 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2011 TestingBot
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.rdoc CHANGED
@@ -6,11 +6,82 @@ Testingbot.com is a website where you can use our cloud based Selenium grid. Tes
6
6
 
7
7
  You can install our testingbot ruby-gem by running "gem install testingbot" on your commandline.
8
8
 
9
+ $ gem install testingbot
10
+
9
11
  == Setup
10
12
 
11
13
  After you installed the gem you need to run a one part setup.
12
- Type testingbot in your commandline and fill in the API key and API secret you obtained on testingbot.com
14
+ Type testingbot in your commandline and fill in the API key and API secret you obtained on http://www.testingbot.com
15
+ $ testingbot
16
+
17
+ == Usage
18
+
19
+ === Example Test::Unit
20
+ You can find an example in our examples folder, try something like this:
21
+
22
+ require "rubygems"
23
+ require "testingbot"
24
+ class ExampleTest < TestingBot::TestCase
25
+ attr_reader :browser
26
+
27
+ def setup
28
+ @browser = Selenium::Client::Driver.new \
29
+ :host => "http://hub.testingbot.com",
30
+ :port => 4444,
31
+ :browser => "*safari",
32
+ :url => "http://www.google.com",
33
+ :timeout_in_second => 60
34
+
35
+ browser.start_new_browser_session
36
+ end
37
+
38
+ def teardown
39
+ browser.close_current_browser_session
40
+ end
41
+
42
+ def test_page_search
43
+ browser.open "/"
44
+ assert_equal "Google", browser.title
45
+ end
46
+ end
47
+
48
+ === Example RSpec
49
+
50
+ require "rubygems"
51
+ require "testingbot"
52
+
53
+ describe "People" do
54
+ attr_reader :selenium_driver
55
+ alias :page :selenium_driver
56
+
57
+ before(:all) do
58
+ @selenium_driver = Selenium::Client::Driver.new \
59
+ :host => "http://hub.testingbot.com",
60
+ :port => 4444,
61
+ :browser => "*safari",
62
+ :url => "http://www.google.com",
63
+ :timeout_in_second => 60
64
+ end
65
+
66
+ before(:each) do
67
+ selenium_driver.start_new_browser_session
68
+ end
69
+
70
+ append_after(:each) do
71
+ @selenium_driver.close_current_browser_session
72
+ end
73
+
74
+ it "can find the right title" do
75
+ page.open "/"
76
+ page.title.should eql("Google")
77
+ end
78
+ end
13
79
 
14
80
  == More information
15
81
 
16
- Get more information on http://www.testingbot.com
82
+ Get more information on http://www.testingbot.com
83
+
84
+ == Copyright
85
+
86
+ Copyright (c) 2011 TestingBot
87
+ Please see our LICENSE
@@ -12,9 +12,9 @@ describe "People" do
12
12
 
13
13
  before(:all) do
14
14
  @selenium_driver = Selenium::Client::Driver.new \
15
- :host => "localhost",
15
+ :host => "10.0.1.4",
16
16
  :port => 4444,
17
- :browser => "*safari",
17
+ :browser => "firefox",
18
18
  :url => "http://www.google.com",
19
19
  :timeout_in_second => 60
20
20
  end
@@ -27,8 +27,8 @@ describe "People" do
27
27
  @selenium_driver.close_current_browser_session
28
28
  end
29
29
 
30
- it "can find Selenium" do
30
+ it "can find the right title" do
31
31
  page.open "/"
32
32
  page.title.should eql("Google")
33
33
  end
34
- end
34
+ end
@@ -12,12 +12,19 @@ class ExampleTest < TestingBot::TestCase
12
12
 
13
13
  def setup
14
14
  @browser = Selenium::Client::Driver.new \
15
- :host => "localhost",
15
+ :host => "10.0.1.4",
16
16
  :port => 4444,
17
- :browser => "*safari",
17
+ :browser => "firefox",
18
+ :platform => "WINDOWS",
19
+ :version => "6",
18
20
  :url => "http://www.google.com",
19
21
  :timeout_in_second => 60
20
-
22
+
23
+ browser.options = {
24
+ :screenrecorder => false
25
+ }
26
+
27
+ browser.extra = "Testing out extra"
21
28
  browser.start_new_browser_session
22
29
  end
23
30
 
@@ -27,6 +34,8 @@ class ExampleTest < TestingBot::TestCase
27
34
 
28
35
  def test_page_search
29
36
  browser.open "/"
30
- assert_equal "Google", browser.title
37
+ browser.type "q", "maya"
38
+ browser.click "btnG"
39
+ #assert_equal "Google", browser.title
31
40
  end
32
41
  end
data/lib/testingbot.rb CHANGED
@@ -43,13 +43,53 @@ end
43
43
  module Selenium
44
44
  module Client
45
45
  module Base
46
+ DEFAULT_OPTIONS = {
47
+ :screenshot => true,
48
+ :screenrecorder => true
49
+ }
50
+
46
51
  alias :close_current_browser_session_old :close_current_browser_session
52
+ alias :start_new_browser_session_old :start_new_browser_session
53
+ alias :initialize_old :initialize
54
+
55
+ attr_accessor :options
47
56
  attr_accessor :session_id_backup
57
+ attr_accessor :extra
58
+ attr_accessor :platform
59
+ attr_accessor :version
60
+
61
+ def initialize(*args)
62
+ if args[0].kind_of?(Hash)
63
+ options = args[0]
64
+ @platform = options[:platform] || "WINDOWS"
65
+ @version = options[:version] if options[:version]
66
+ end
67
+
68
+ @options = DEFAULT_OPTIONS
69
+ initialize_old(*args)
70
+ @host = "hub.testingbot.com" if @host.nil?
71
+ @port = 4444 if @port.nil?
72
+ end
48
73
 
49
74
  def close_current_browser_session
50
75
  @session_id_backup = @session_id
51
76
  close_current_browser_session_old
52
77
  end
78
+
79
+ def start_new_browser_session(options={})
80
+ options = @options.merge options
81
+ options[:platform] = @platform
82
+ options[:version] = @version unless @version.nil?
83
+ start_new_browser_session_old(options)
84
+ end
85
+
86
+ def extra=(str)
87
+ @extra = str
88
+ end
89
+
90
+ def options=(opts = {})
91
+ @options = @options.merge opts
92
+ end
53
93
  end
54
94
  end
55
95
  end
@@ -68,10 +108,11 @@ if defined?(Spec)
68
108
  "status_message" => @execution_error,
69
109
  "success" => !actual_failure?,
70
110
  "name" => description.to_s,
71
- "kind" => 2
111
+ "kind" => 2,
112
+ "extra" => @selenium_driver.extra
72
113
  }
73
114
 
74
- url = URI.parse('http://localhost:3000/hq')
115
+ url = URI.parse('http://api.testingbot.com/hq')
75
116
  http = Net::HTTP.new(url.host, url.port)
76
117
  response = http.post(url.path, params.map { |k, v| "#{k.to_s}=#{v}" }.join("&"))
77
118
  end
@@ -96,14 +137,15 @@ if defined?(Test::Unit::TestCase)
96
137
  "status_message" => @exception,
97
138
  "success" => passed?,
98
139
  "name" => self.to_s,
99
- "kind" => 2
140
+ "kind" => 2,
141
+ "extra" => browser.extra
100
142
  }
101
143
 
102
- url = URI.parse('http://localhost:3000/hq')
144
+ url = URI.parse('http://api.testingbot.com/hq')
103
145
  http = Net::HTTP.new(url.host, url.port)
104
146
  response = http.post(url.path, params.map { |k, v| "#{k.to_s}=#{v}" }.join("&"))
105
147
  run_teardown_old
106
- end #def run_teardown
148
+ end
107
149
 
108
150
  def handle_exception(e)
109
151
  @exception = e.to_s
@@ -1,3 +1,3 @@
1
1
  module Testingbot
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
data/testingbot.gemspec CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Testingbot::VERSION
8
8
  s.authors = ["Jochen"]
9
9
  s.email = ["info@testingbot.com"]
10
- s.homepage = ""
10
+ s.homepage = "http://www.testingbot.com"
11
11
  s.summary = "Ruby Gem to be used with testingbot.com"
12
12
  s.description = "This gem makes using our Selenium grid on testingbot.com easy"
13
13
 
@@ -17,5 +17,8 @@ Gem::Specification.new do |s|
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
- s.add_dependency "rspec"
20
+ s.add_dependency "rspec", "<= 1.3.4"
21
+ s.add_dependency "selenium-client"
22
+
23
+ s.requirements << "Selenium-Client and RSpec 1"
21
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testingbot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-08-13 00:00:00.000000000Z
12
+ date: 2011-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &2151951280 !ruby/object:Gem::Requirement
16
+ requirement: &70316491823880 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - <=
20
+ - !ruby/object:Gem::Version
21
+ version: 1.3.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70316491823880
25
+ - !ruby/object:Gem::Dependency
26
+ name: selenium-client
27
+ requirement: &70316491823380 !ruby/object:Gem::Requirement
17
28
  none: false
18
29
  requirements:
19
30
  - - ! '>='
@@ -21,7 +32,7 @@ dependencies:
21
32
  version: '0'
22
33
  type: :runtime
23
34
  prerelease: false
24
- version_requirements: *2151951280
35
+ version_requirements: *70316491823380
25
36
  description: This gem makes using our Selenium grid on testingbot.com easy
26
37
  email:
27
38
  - info@testingbot.com
@@ -32,6 +43,7 @@ extra_rdoc_files: []
32
43
  files:
33
44
  - .gitignore
34
45
  - Gemfile
46
+ - LICENSE
35
47
  - README.rdoc
36
48
  - Rakefile
37
49
  - bin/testingbot
@@ -40,7 +52,7 @@ files:
40
52
  - lib/testingbot.rb
41
53
  - lib/testingbot/version.rb
42
54
  - testingbot.gemspec
43
- homepage: ''
55
+ homepage: http://www.testingbot.com
44
56
  licenses: []
45
57
  post_install_message:
46
58
  rdoc_options: []
@@ -58,9 +70,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
70
  - - ! '>='
59
71
  - !ruby/object:Gem::Version
60
72
  version: '0'
61
- requirements: []
73
+ requirements:
74
+ - Selenium-Client and RSpec 1
62
75
  rubyforge_project: testingbot
63
- rubygems_version: 1.8.8
76
+ rubygems_version: 1.8.10
64
77
  signing_key:
65
78
  specification_version: 3
66
79
  summary: Ruby Gem to be used with testingbot.com