statt 0.0.1 → 0.0.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.
Files changed (40) hide show
  1. data/lib/selenium-grid/Capfile +107 -0
  2. data/lib/selenium-grid/Rakefile +190 -0
  3. data/lib/selenium-grid/build.xml +185 -0
  4. data/lib/selenium-grid/grid_configuration.yml +44 -0
  5. data/lib/selenium-grid/lib/build/common-build.xml +290 -0
  6. data/lib/selenium-grid/lib/selenium-grid-hub-1.0.5-SNAPSHOT.jar +0 -0
  7. data/lib/selenium-grid/lib/selenium-grid-hub-standalone-1.0.5-SNAPSHOT.jar +0 -0
  8. data/lib/selenium-grid/lib/selenium-grid-remote-control-1.0.5-SNAPSHOT.jar +0 -0
  9. data/lib/selenium-grid/lib/selenium-grid-remote-control-standalone-1.0.5-SNAPSHOT.jar +0 -0
  10. data/lib/selenium-grid/lib/selenium-grid-tools-1.0.5-SNAPSHOT.jar +0 -0
  11. data/lib/selenium-grid/lib/selenium-grid-tools-standalone-1.0.5-SNAPSHOT.jar +0 -0
  12. data/lib/selenium-grid/log/hub.log +66 -0
  13. data/lib/selenium-grid/project.properties +4 -0
  14. data/lib/selenium-grid/vendor/commons-logging-1.0.4.jar +0 -0
  15. data/lib/selenium-grid/vendor/selenium-java-client-driver-1.0.1.jar +0 -0
  16. data/lib/selenium-grid/vendor/selenium-server-1.0.1.jar +0 -0
  17. data/lib/statt.rb +5 -5
  18. data/lib/statt/client.rb +26 -18
  19. data/lib/statt/motor.rb +24 -8
  20. metadata +49 -24
  21. data/lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/cloud.rb +0 -35
  22. data/lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/ec2.rb +0 -7
  23. data/lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/ec2_client.rb +0 -62
  24. data/lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/hub.rb +0 -22
  25. data/lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb +0 -47
  26. data/lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb +0 -56
  27. data/lib/selenium-grid/examples/ec2/test/unit/all_test.rb +0 -2
  28. data/lib/selenium-grid/examples/ec2/test/unit/cloud_test.rb +0 -27
  29. data/lib/selenium-grid/examples/ec2/test/unit/ec2_client_test.rb +0 -137
  30. data/lib/selenium-grid/examples/ec2/test/unit/hub_test.rb +0 -24
  31. data/lib/selenium-grid/examples/ec2/test/unit/remote_command_test.rb +0 -46
  32. data/lib/selenium-grid/examples/ec2/test/unit/server_test.rb +0 -22
  33. data/lib/selenium-grid/examples/ec2/test/unit/test_helper.rb +0 -4
  34. data/lib/selenium-grid/examples/ruby/flickr_example.rb +0 -16
  35. data/lib/selenium-grid/examples/ruby/lib/array_extension.rb +0 -13
  36. data/lib/selenium-grid/examples/ruby/lib/multi_process_behaviour_runner.rb +0 -28
  37. data/lib/selenium-grid/examples/ruby/paris_spec.rb +0 -34
  38. data/lib/selenium-grid/examples/ruby/perigord_spec.rb +0 -22
  39. data/lib/selenium-grid/examples/ruby/spec_helper.rb +0 -59
  40. data/lib/selenium-grid/sample-scripts/launch-remote-controls.rb +0 -20
@@ -1,27 +1,35 @@
1
- require "selenium"
2
- require "test/unit"
3
- require "selenium/server_manager"
4
- require "selenium/selenium_server"
5
- require "selenium/client/driver"
1
+ #!/usr/local/bin/ruby -w
2
+
3
+ # require "selenium"
4
+ # require "test/unit"
5
+ # require "selenium/server_manager"
6
+ # require "selenium/selenium_server"
7
+ # require "selenium/client/driver"
6
8
 
7
9
  module Statt
8
10
  class Client
9
- attr_reader :selenium_driver
10
- def initialize
11
- @selenium_driver = Selenium::Client::Driver.new \
12
- :host => "localhost",
13
- :port => 4444,
14
- :browser => "*firefox",
15
- :url => "http://www.google.com",
16
- :timeout_in_second => 60
11
+ attr_accessor :selenium, :host, :port, :timeout, :browser, :url
12
+ def initialize(options = {})
13
+ options = { :host => "localhost",
14
+ :port => 4444,
15
+ :timeout => 10,
16
+ :browser => "*firefox",
17
+ :url => "http://localhost:3000"}.merge(options)
18
+ @host = options[:host]
19
+ @port = options[:port]
20
+ @timeout = options[:timeout]
21
+ @browser = options[:browser]
22
+ @url = options[:url]
23
+
24
+ @selenium = Selenium::Client::Driver.new(options)
17
25
  end
18
26
 
19
27
  def test
20
- @selenium_driver.start_new_browser_session
21
- @selenium_driver.open "/"
22
- @selenium_driver.type "q", "Selenium seleniumhq"
23
- @selenium_driver.click "btnG", :wait_for => :page_to_load
24
- @selenium_driver.close_current_browser_session
28
+ @selenium.start_new_browser_session
29
+ @selenium.open "/"
30
+ @selenium.type "q", "Selenium seleniumhq"
31
+ @selenium.click "btnG", :wait_for => :page_to_load
32
+ @selenium.close_current_browser_session
25
33
  end
26
34
  end
27
35
  end
@@ -1,20 +1,36 @@
1
+ #!/usr/local/bin/ruby -w
1
2
 
3
+ # require "selenium"
4
+ require "test/unit"
5
+ # require "selenium/server_manager"
6
+ # require "selenium/selenium_server"
7
+ require "selenium/client/driver"
2
8
 
3
9
  module Statt
4
- class Motor < Selenium::ServerManager
10
+ class Motor
11
+ attr_accessor :rc, :hub
5
12
 
6
- def initialize
7
- @server = Selenium::SeleniumRCServer.new
13
+ def initialize(options={})
14
+ options = { :hub_host => "localhost",
15
+ :hub_port => 4444 }.merge(options)
16
+ :rc_options => [{:host => "localhost", :port => 5555 }]
17
+ hub_options = { :host => options[:hub_host],
18
+ :port => options[:hub_port] }
19
+ @hub = SGrid::Hub.new(hub_options)
20
+ rc_options = options[:rc_options]
21
+ if options[:rc_options].is_a?(Hash)
22
+ @rc = SGrid::RemoteControl.new(rc_option)
23
+ elsif options[:rc_options].is_a?(Array)
24
+ rc_options.each do |rc_option|
25
+ @rc = SGrid::RemoteControl.new(rc_option)
26
+ end
27
+ end
8
28
  end
9
29
 
10
30
  def manager
11
31
  self
12
32
  end
13
-
14
- def server
15
- @server
16
- end
17
-
18
33
 
34
+
19
35
  end
20
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: statt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - davidtrogers
@@ -9,10 +9,39 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-21 00:00:00 -04:00
12
+ date: 2009-10-23 00:00:00 -04:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.3.3
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: selenium-client
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.17
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rake
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.8.7
44
+ version:
16
45
  description: Testing web applications js and all
17
46
  email: david.t.rogers@gmail.com
18
47
  executables: []
@@ -23,32 +52,28 @@ extra_rdoc_files:
23
52
  - LICENSE
24
53
  - README.rdoc
25
54
  files:
26
- - lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/cloud.rb
27
- - lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/ec2.rb
28
- - lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/ec2_client.rb
29
- - lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/hub.rb
30
- - lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/remote_command.rb
31
- - lib/selenium-grid/examples/ec2/lib/selenium_grid/aws/server.rb
32
- - lib/selenium-grid/examples/ec2/test/unit/all_test.rb
33
- - lib/selenium-grid/examples/ec2/test/unit/cloud_test.rb
34
- - lib/selenium-grid/examples/ec2/test/unit/ec2_client_test.rb
35
- - lib/selenium-grid/examples/ec2/test/unit/hub_test.rb
36
- - lib/selenium-grid/examples/ec2/test/unit/remote_command_test.rb
37
- - lib/selenium-grid/examples/ec2/test/unit/server_test.rb
38
- - lib/selenium-grid/examples/ec2/test/unit/test_helper.rb
39
- - lib/selenium-grid/examples/ruby/flickr_example.rb
40
- - lib/selenium-grid/examples/ruby/lib/array_extension.rb
41
- - lib/selenium-grid/examples/ruby/lib/multi_process_behaviour_runner.rb
42
- - lib/selenium-grid/examples/ruby/paris_spec.rb
43
- - lib/selenium-grid/examples/ruby/perigord_spec.rb
44
- - lib/selenium-grid/examples/ruby/spec_helper.rb
55
+ - lib/selenium-grid/Capfile
56
+ - lib/selenium-grid/Rakefile
57
+ - lib/selenium-grid/build.xml
58
+ - lib/selenium-grid/grid_configuration.yml
59
+ - lib/selenium-grid/lib/build/common-build.xml
45
60
  - lib/selenium-grid/lib/ruby/file_extensions.rb
46
61
  - lib/selenium-grid/lib/ruby/java/classpath.rb
47
62
  - lib/selenium-grid/lib/ruby/java/vm.rb
48
63
  - lib/selenium-grid/lib/ruby/s_grid/hub.rb
49
64
  - lib/selenium-grid/lib/ruby/s_grid/remote_control.rb
50
65
  - lib/selenium-grid/lib/ruby/tcp_socket_extensions.rb
51
- - lib/selenium-grid/sample-scripts/launch-remote-controls.rb
66
+ - lib/selenium-grid/lib/selenium-grid-hub-1.0.5-SNAPSHOT.jar
67
+ - lib/selenium-grid/lib/selenium-grid-hub-standalone-1.0.5-SNAPSHOT.jar
68
+ - lib/selenium-grid/lib/selenium-grid-remote-control-1.0.5-SNAPSHOT.jar
69
+ - lib/selenium-grid/lib/selenium-grid-remote-control-standalone-1.0.5-SNAPSHOT.jar
70
+ - lib/selenium-grid/lib/selenium-grid-tools-1.0.5-SNAPSHOT.jar
71
+ - lib/selenium-grid/lib/selenium-grid-tools-standalone-1.0.5-SNAPSHOT.jar
72
+ - lib/selenium-grid/log/hub.log
73
+ - lib/selenium-grid/project.properties
74
+ - lib/selenium-grid/vendor/commons-logging-1.0.4.jar
75
+ - lib/selenium-grid/vendor/selenium-java-client-driver-1.0.1.jar
76
+ - lib/selenium-grid/vendor/selenium-server-1.0.1.jar
52
77
  - lib/statt.rb
53
78
  - lib/statt/client.rb
54
79
  - lib/statt/motor.rb
@@ -1,35 +0,0 @@
1
- module SeleniumGrid
2
- module AWS
3
-
4
- class Cloud
5
- FILE = "cloud.yml"
6
- attr_accessor :hub, :farms
7
-
8
- def self.load
9
- begin
10
- YAML.load(File.read(FILE))
11
- rescue Errno::ENOENT
12
- new
13
- end
14
- end
15
-
16
- def self.update
17
- cloud = self.load
18
- yield cloud
19
- ensure
20
- cloud.write unless cloud.nil?
21
- end
22
-
23
- def write
24
- File.open(FILE, "w") {|file| file.write(self.to_yaml)}
25
- end
26
-
27
- def farms
28
- @farms ||= []
29
- end
30
-
31
- end
32
-
33
- end
34
- end
35
-
@@ -1,7 +0,0 @@
1
- require 'rubygems'
2
- require "yaml"
3
- require File.dirname(__FILE__) + '/cloud'
4
- require File.dirname(__FILE__) + '/ec2_client'
5
- require File.dirname(__FILE__) + '/server'
6
- require File.dirname(__FILE__) + '/hub'
7
- require File.dirname(__FILE__) + '/remote_command'
@@ -1,62 +0,0 @@
1
- module SeleniumGrid
2
- module AWS
3
- module Ec2Client
4
-
5
- def describe(instance_id)
6
- output = ec2_shell "ec2-describe-instances #{instance_id}"
7
- output =~ /INSTANCE\s+(i-.*)$/
8
- fields = $1.split(/\s+/)
9
- if output =~ /running/
10
- {:instance_id => fields[0],
11
- :ami => fields[1],
12
- :public_dns => fields[2],
13
- :private_dns => fields[3],
14
- :status => fields[4] }
15
- else
16
- {:instance_id => fields[0],
17
- :ami => fields[1],
18
- :status => fields[2] }
19
- end
20
- end
21
-
22
- def launch(ami, options ={})
23
- output = ec2_shell "ec2-run-instances #{ami} -k #{options[:keypair]}"
24
- output =~ /INSTANCE\s+(i-\S+)\s+ami-/
25
- if $1 != nil
26
- $1
27
- else
28
- raise InstanceLaunchError, output
29
- end
30
- end
31
-
32
- def shutdown(instance_id)
33
- ec2_shell "ec2-terminate-instances #{instance_id}"
34
- end
35
-
36
- def version
37
- ec2_shell "ec2-version"
38
- end
39
-
40
- def authorize_port(port)
41
- puts "Opening port #{port}..."
42
- ec2_shell "ec2-authorize default -p #{port}"
43
- end
44
-
45
- def ec2_shell(command)
46
- puts "[EC2] '#{command}'" if tracing?
47
- output = `${EC2_HOME}/bin/#{command}`
48
- puts "[EC2] #{output}" if tracing?
49
- output
50
- end
51
-
52
- def tracing?
53
- ENV['TRACE_EC2_COMMANDS']
54
- end
55
-
56
- end
57
- end
58
-
59
- class InstanceLaunchError < StandardError
60
- end
61
-
62
- end
@@ -1,22 +0,0 @@
1
- module SeleniumGrid
2
- module AWS
3
-
4
- class Hub < Server
5
-
6
- def url
7
- "http://#{public_dns}:4444"
8
- end
9
-
10
- def private_url
11
- "http://#{private_dns}:4444"
12
- end
13
-
14
- def console_url
15
- "#{url}/console"
16
- end
17
-
18
- end
19
-
20
- end
21
- end
22
-
@@ -1,47 +0,0 @@
1
- module SeleniumGrid
2
- module AWS
3
-
4
- class RemoteCommand
5
- attr_accessor :options
6
-
7
- def initialize(command, options={})
8
- @command, @options = command, options
9
- end
10
-
11
- def execute
12
- puts full_command
13
- system full_command
14
- raise "Error with #{full_command}" if 0 != $?
15
- end
16
-
17
- def full_command
18
- cmd = "#{ssh_command} "
19
- cmd << "\"su -l #{options[:su]} -c " if options[:su]
20
- cmd << "'#{remote_command}'"
21
- cmd << '"' if options[:su]
22
- cmd
23
- end
24
-
25
- def ssh_command
26
- shell_command = [ "ssh" ]
27
- shell_command << "-i '#{options[:keypair]}'" if options[:keypair]
28
- shell_command << "root@#{options[:host]}"
29
-
30
- shell_command.join " "
31
- end
32
-
33
- def remote_command
34
- shell_command = []
35
- shell_command << "PATH=#{options[:path]}:${PATH}; export PATH;" if options[:path]
36
- shell_command << "DISPLAY=#{options[:display]}; export DISPLAY;" if options[:display]
37
- shell_command << "cd '#{options[:pwd]}';" if options[:pwd]
38
- shell_command << @command
39
-
40
- shell_command.join " "
41
- end
42
-
43
- end
44
-
45
- end
46
- end
47
-
@@ -1,56 +0,0 @@
1
- module SeleniumGrid
2
- module AWS
3
-
4
- class Server
5
- extend Ec2Client
6
-
7
- attr_accessor :instance_id, :public_dns, :private_dns
8
-
9
- def initialize(instance_id)
10
- self.instance_id = instance_id
11
- end
12
-
13
- def self.boot(ami, options = {})
14
- new launch(ami, options)
15
- end
16
-
17
- def self.boot_and_acquire_dns(ami, options)
18
- server = boot(ami, options)
19
- server.wait_for_dns
20
- end
21
-
22
- def wait_for_dns
23
- puts "Fetching DNS Info..."
24
- until dns_allocated?
25
- sleep 2
26
- putc "."
27
- refresh_status
28
- end
29
- puts
30
- self
31
- end
32
-
33
- def dns_allocated?
34
- public_dns != nil && public_dns != "" &&
35
- private_dns != nil && private_dns != ""
36
- end
37
-
38
- def refresh_status
39
- info = self.class.describe instance_id
40
- @public_dns = info[:public_dns]
41
- @private_dns = info[:private_dns]
42
- end
43
-
44
- def shutdown
45
- self.class.shutdown instance_id
46
- end
47
-
48
- def run(command, options)
49
- command = RemoteCommand.new command, options.merge(:host => public_dns)
50
- command.execute
51
- end
52
- end
53
-
54
- end
55
- end
56
-
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env ruby
2
- Dir['**/*_test.rb'].each {|test_file| require test_file }
@@ -1,27 +0,0 @@
1
- require File.dirname(__FILE__) + "/test_helper"
2
-
3
- unit_tests do
4
-
5
- test "hub is nil on a fresh cloud" do
6
- assert_nil SeleniumGrid::AWS::Cloud.new.hub
7
- end
8
-
9
- test "hub return the latest assigned hub instance" do
10
- cloud = SeleniumGrid::AWS::Cloud.new
11
- cloud.hub = :old_hub
12
- cloud.hub = :new_hub
13
- assert_equal :new_hub, cloud.hub
14
- end
15
-
16
- test "remote_control_farms is empty on a fresh cloud" do
17
- assert_equal [], SeleniumGrid::AWS::Cloud.new.farms
18
- end
19
-
20
- test "remote_control_farms returns all added farms" do
21
- cloud = SeleniumGrid::AWS::Cloud.new
22
- cloud.farms << :a_farm
23
- cloud.farms << :another_farm
24
- assert_equal [:a_farm, :another_farm], cloud.farms
25
- end
26
-
27
- end