statt 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
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,137 +0,0 @@
1
- require File.dirname(__FILE__) + "/test_helper"
2
-
3
- unit_tests do
4
-
5
- test "run_instance launch a new AMI using ec2-run-instances script" do
6
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
7
- client.expects(:ec2_shell).with("ec2-run-instances TheAMI -k TheKeyPair")
8
- client.launch "TheAMI", :keypair => "TheKeyPair"
9
- end
10
-
11
- test "run_instance returns the instance id when launch is successful" do
12
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
13
- client.stubs(:ec2_shell).returns(<<-EOS)
14
- RESERVATION r-ee629587 069216575636 default
15
- INSTANCE i-6fef1006 ami-d306e3ba pending grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
16
- EOS
17
- assert_equal "i-6fef1006", client.launch(:an_ami)
18
- end
19
-
20
- test "authorize launch ec2-authorize script for default group" do
21
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
22
- client.expects(:ec2_shell).with("ec2-authorize default -p ThePort")
23
- client.authorize_port "ThePort"
24
- end
25
-
26
- test "describe launch ec2-describe script for a particular AMI" do
27
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
28
- client.expects(:ec2_shell).with("ec2-describe-instances TheAMI").returns("INSTANCE i-")
29
- client.describe "TheAMI"
30
- end
31
-
32
- test "describe returns the instance id when running" do
33
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
34
- client.stubs(:ec2_shell).returns(<<-EOS)
35
- RESERVATION r-ee629587 069216575636 default
36
- INSTANCE i-6fef1006 ami-d306e3ba ec2-67-202-19-143.compute-1.amazonaws.com domU-12-31-38-00-3D-E6.compute-1.internal running grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
37
- EOS
38
- assert_equal "i-6fef1006", client.describe(:an_ami)[:instance_id]
39
- end
40
-
41
- test "describe returns the ami when running" do
42
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
43
- client.stubs(:ec2_shell).returns(<<-EOS)
44
- RESERVATION r-ee629587 069216575636 default
45
- INSTANCE i-6fef1006 ami-d306e3ba ec2-67-202-19-143.compute-1.amazonaws.com domU-12-31-38-00-3D-E6.compute-1.internal running grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
46
- EOS
47
- assert_equal "ami-d306e3ba", client.describe(:an_ami)[:ami]
48
- end
49
-
50
- test "describe returns the public_dns when running" do
51
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
52
- client.stubs(:ec2_shell).returns(<<-EOS)
53
- RESERVATION r-ee629587 069216575636 default
54
- INSTANCE i-6fef1006 ami-d306e3ba ec2-67-202-19-143.compute-1.amazonaws.com domU-12-31-38-00-3D-E6.compute-1.internal running grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
55
- EOS
56
- assert_equal "ec2-67-202-19-143.compute-1.amazonaws.com",
57
- client.describe(:an_ami)[:public_dns]
58
- end
59
-
60
- test "describe returns the private_dns when running" do
61
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
62
- client.stubs(:ec2_shell).returns(<<-EOS)
63
- RESERVATION r-ee629587 069216575636 default
64
- INSTANCE i-6fef1006 ami-d306e3ba ec2-67-202-19-143.compute-1.amazonaws.com domU-12-31-38-00-3D-E6.compute-1.internal running grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
65
- EOS
66
- assert_equal "domU-12-31-38-00-3D-E6.compute-1.internal",
67
- client.describe(:an_ami)[:private_dns]
68
- end
69
-
70
- test "describe returns the status when running" do
71
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
72
- client.stubs(:ec2_shell).returns(<<-EOS)
73
- RESERVATION r-ee629587 069216575636 default
74
- INSTANCE i-6fef1006 ami-d306e3ba ec2-67-202-19-143.compute-1.amazonaws.com domU-12-31-38-00-3D-E6.compute-1.internal running grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
75
- EOS
76
- assert_equal "running", client.describe(:an_ami)[:status]
77
- end
78
-
79
- test "describe returns the instance id when terminated" do
80
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
81
- client.stubs(:ec2_shell).returns(<<-EOS)
82
- RESERVATION r-ee629587 069216575636 default
83
- INSTANCE i-6fef1006 ami-d306e3ba terminated grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
84
- EOS
85
- assert_equal "i-6fef1006", client.describe(:an_ami)[:instance_id]
86
- end
87
-
88
- test "describe returns the status when pending" do
89
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
90
- client.stubs(:ec2_shell).returns(<<-EOS)
91
- RESERVATION r-40609729 069216575636 default
92
- INSTANCE i-afee11c6 ami-6801e401 pending grid-keypair 0 m1.small 2008-02-17T22:33:38+0000
93
- EOS
94
- assert_equal "pending", client.describe(:an_ami)[:status]
95
- end
96
-
97
- test "describe returns a nil public dns the status when pending" do
98
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
99
- client.stubs(:ec2_shell).returns(<<-EOS)
100
- RESERVATION r-40609729 069216575636 default
101
- INSTANCE i-afee11c6 ami-6801e401 pending grid-keypair 0 m1.small 2008-02-17T22:33:38+0000
102
- EOS
103
- assert_nil client.describe(:an_ami)[:public_dns]
104
- end
105
-
106
- test "describe returns a nil private dns the status when pending" do
107
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
108
- client.stubs(:ec2_shell).returns(<<-EOS)
109
- RESERVATION r-40609729 069216575636 default
110
- INSTANCE i-afee11c6 ami-6801e401 pending grid-keypair 0 m1.small 2008-02-17T22:33:38+0000
111
- EOS
112
- assert_nil client.describe(:an_ami)[:private_dns]
113
- end
114
-
115
- test "describe returns the status when terminated" do
116
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
117
- client.stubs(:ec2_shell).returns(<<-EOS)
118
- RESERVATION r-ee629587 069216575636 default
119
- INSTANCE i-6fef1006 ami-d306e3ba terminated grid-keypair 0 m1.small 2008-02-17T20:49:08+0000
120
- EOS
121
- assert_equal "terminated", client.describe(:an_ami)[:status]
122
- end
123
-
124
- test "shutdown terminates an instance" do
125
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
126
- client.expects(:ec2_shell).with("ec2-terminate-instances The-Instance-ID")
127
- client.shutdown("The-Instance-ID")
128
- end
129
-
130
- test "version returns EC2 version using defined keypair" do
131
- client = Class.new.extend SeleniumGrid::AWS::Ec2Client
132
- client.expects(:ec2_shell).with("ec2-version").returns(:ec2_version)
133
- assert_equal :ec2_version, client.version
134
- end
135
-
136
- # ec2-version -K "${EC2_PRIVATE_KEY}"
137
- end
@@ -1,24 +0,0 @@
1
- require File.dirname(__FILE__) + "/test_helper"
2
-
3
- unit_tests do
4
-
5
- test "url return the public url where the hub can be contacted" do
6
- hub = SeleniumGrid::AWS::Hub.new nil
7
- hub.public_dns = "public.dns"
8
- assert_equal "http://public.dns:4444", hub.url
9
- end
10
-
11
- test "private_url return the private url where the hub can be contacted" do
12
- hub = SeleniumGrid::AWS::Hub.new nil
13
- hub.private_dns = "private.dns"
14
- assert_equal "http://private.dns:4444", hub.private_url
15
- end
16
-
17
- test "console_url return the public url of the hub console" do
18
- hub = SeleniumGrid::AWS::Hub.new nil
19
- hub.public_dns = "public.dns"
20
- assert_equal "http://public.dns:4444/console", hub.console_url
21
- end
22
-
23
-
24
- end
@@ -1,46 +0,0 @@
1
- require File.dirname(__FILE__) + "/test_helper"
2
-
3
- unit_tests do
4
-
5
- test "ssh_command builds ssh based command targetting the host" do
6
- command = SeleniumGrid::AWS::RemoteCommand.new "ls", :host => "the.host"
7
- assert_equal "ssh root@the.host", command.ssh_command
8
- end
9
-
10
- test "ssh_command use custom key when keypair options is provided" do
11
- command = SeleniumGrid::AWS::RemoteCommand.new "ls",
12
- :host => "the.host", :keypair => "/the/key.pair"
13
- assert_equal "ssh -i '/the/key.pair' root@the.host", command.ssh_command
14
- end
15
-
16
- test "remote_command" do
17
- command = SeleniumGrid::AWS::RemoteCommand.new "ls", :pwd => "/a/directory"
18
- assert_equal "cd '/a/directory'; ls", command.remote_command
19
- end
20
-
21
- test "remote_command set path when path is provided as an option" do
22
- command = SeleniumGrid::AWS::RemoteCommand.new "ls", :path => "/a/directory:and/another"
23
- assert_equal "PATH=/a/directory:and/another:${PATH}; export PATH; ls", command.remote_command
24
- end
25
-
26
- test "remote_command set display when display is provided as an option" do
27
- command = SeleniumGrid::AWS::RemoteCommand.new "ls", :display => ":0"
28
- assert_equal "DISPLAY=:0; export DISPLAY; ls", command.remote_command
29
- end
30
-
31
- test "full_command execute the remote command using ssh_command" do
32
- command = SeleniumGrid::AWS::RemoteCommand.new nil
33
- command.stubs(:ssh_command).returns("the_ssh_command")
34
- command.stubs(:remote_command).returns("the remote command")
35
- assert_equal "the_ssh_command 'the remote command'", command.full_command
36
- end
37
-
38
- test "full_command wraps remote_command with 'su user -c' when su option is set" do
39
- command = SeleniumGrid::AWS::RemoteCommand.new nil, :su => "a-user"
40
- command.stubs(:ssh_command).returns("the_ssh_command")
41
- command.stubs(:remote_command).returns("the remote command")
42
- assert_equal "the_ssh_command \"su -l a-user -c 'the remote command'\"",
43
- command.full_command
44
- end
45
-
46
- end
@@ -1,22 +0,0 @@
1
- require File.dirname(__FILE__) + "/test_helper"
2
-
3
- unit_tests do
4
-
5
- test "refresh_status updates public dns" do
6
- server = SeleniumGrid::AWS::Server.new :an_instance_id
7
- SeleniumGrid::AWS::Server.expects(:describe).with(:an_instance_id).
8
- returns(:public_dns => :new_public_dns)
9
- server.refresh_status
10
- assert_equal :new_public_dns, server.public_dns
11
- end
12
-
13
- test "refresh_status updates private dns" do
14
- server = SeleniumGrid::AWS::Server.new :an_instance_id
15
- SeleniumGrid::AWS::Server.expects(:describe).with(:an_instance_id).
16
- returns(:private_dns => :new_private_dns)
17
- server.refresh_status
18
- assert_equal :new_private_dns, server.private_dns
19
- end
20
-
21
-
22
- end
@@ -1,4 +0,0 @@
1
- require File.dirname(__FILE__) + "/../../lib/selenium_grid/aws/ec2"
2
- require "rubygems"
3
- require "dust"
4
- require "mocha"
@@ -1,16 +0,0 @@
1
- module FlickrExample
2
-
3
- def run_flickr_scenario(options)
4
- browser.open "/"
5
- page.location.should match(%r{http://images.google.com/})
6
- page.type "q", options[:search_string]
7
- page.click "btnG", :wait_for => :page
8
- page.click "link=Advanced Image Search", :wait_for => :page
9
- page.click "rimgtype4"
10
- page.click "sf"
11
- page.select "imgc", "full color"
12
- page.click "btnG", :wait_for => :page
13
- page.text?(options[:search_string].split(/ /).first).should be_true
14
- end
15
-
16
- end
@@ -1,13 +0,0 @@
1
- module ArrayExtension
2
-
3
- def /(number_of_buckets)
4
- buckets = (1..number_of_buckets).collect { [] }
5
- while self.any? do
6
- buckets.each do |bucket|
7
- bucket << self.shift if self.any?
8
- end
9
- end
10
- buckets
11
- end
12
-
13
- end
@@ -1,28 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/array_extension')
2
- Array.send :include, ArrayExtension
3
-
4
- class MultiProcessSpecRunner
5
-
6
- def initialize(max_concurrent_processes = 10)
7
- @max_concurrent_processes = max_concurrent_processes
8
- end
9
-
10
- def run(spec_files)
11
- concurrent_processes = [ @max_concurrent_processes, spec_files.size ].min
12
- spec_files_by_process = spec_files / concurrent_processes
13
- concurrent_processes.times do |i|
14
- cmd = "spec #{spec_files_by_process[i].join(' ')}"
15
- puts "Launching #{cmd}"
16
- exec(cmd) if fork == nil
17
- end
18
- success = true
19
- concurrent_processes.times do |i|
20
- pid, status = Process.wait2
21
- puts "Test process ##{i} with pid #{pid} completed with #{status}"
22
- success &&= status.exitstatus.zero?
23
- end
24
-
25
- raise "Build failed" unless success
26
- end
27
-
28
- end
@@ -1,34 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
-
3
- describe "Paris" do
4
- include FlickrExample
5
-
6
- it "Has museums" do
7
- run_flickr_scenario :search_string => "Louvre"
8
- end
9
-
10
- it "Has bridges" do
11
- run_flickr_scenario :search_string => "Pont Neuf"
12
- end
13
-
14
- it "Has magnific cathedrals" do
15
- run_flickr_scenario :search_string => "Notre Dame de Paris"
16
- end
17
-
18
- it "Has magnificent Castles" do
19
- run_flickr_scenario :search_string => "Versailles"
20
- end
21
-
22
- it "Has a gorgeous river" do
23
- run_flickr_scenario :search_string => "Seine by Night"
24
- end
25
-
26
- it "Has weird towers" do
27
- run_flickr_scenario :search_string => "Tour Eiffel"
28
- end
29
-
30
- it "Has avenues" do
31
- run_flickr_scenario :search_string => "Avenue des Champs Elysees"
32
- end
33
-
34
- end
@@ -1,22 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + "/spec_helper")
2
-
3
- describe "Perigord" do
4
- include FlickrExample
5
-
6
- it "Has magnific cro-magnon paintings" do
7
- run_flickr_scenario :search_string => "lascaux hall of the bull"
8
- end
9
-
10
- it "Has magnific cities" do
11
- run_flickr_scenario :search_string => "Sarlat"
12
- end
13
-
14
- it "Has magnific cathedrals" do
15
- run_flickr_scenario :search_string => "Cathedral in Périgueux"
16
- end
17
-
18
- it "Has great wines" do
19
- run_flickr_scenario :search_string => "Montbazillac"
20
- end
21
-
22
- end
@@ -1,59 +0,0 @@
1
- $:.unshift
2
-
3
- require "rubygems"
4
- gem "rspec", "=1.1.8"
5
- require 'spec/rake/spectask'
6
-
7
- require "rake"
8
-
9
- gem "selenium-client", "=1.2.7"
10
- require "selenium/rake/tasks"
11
- require "selenium/client"
12
- require "selenium/rspec/spec_helper"
13
-
14
- require File.expand_path(File.dirname(__FILE__) + "/flickr_example")
15
-
16
- Spec::Runner.configure do |config|
17
-
18
- config.before(:each) do
19
- create_selenium_driver
20
- start_new_browser_session
21
- end
22
-
23
- # The system capture need to happen BEFORE the closing the Selenium session
24
- config.append_after(:each) do
25
- @selenium_driver.close_current_browser_session
26
- end
27
-
28
- def start_new_browser_session
29
- @selenium_driver.start_new_browser_session
30
- @selenium_driver.set_context "Starting example '#{self.description}'"
31
- end
32
-
33
- def selenium_driver
34
- @selenium_driver
35
- end
36
-
37
- def browser
38
- @selenium_driver
39
- end
40
-
41
- def page
42
- @selenium_driver
43
- end
44
-
45
- def create_selenium_driver
46
- remote_control_server = ENV['SELENIUM_RC_HOST'] || "localhost"
47
- port = ENV['SELENIUM_RC_PORT'] || 4444
48
- browser = ENV['SELENIUM_RC_BROWSER'] || "*firefox"
49
- timeout = ENV['SELENIUM_RC_TIMEOUT'] || 200
50
- application_host = ENV['SELENIUM_APPLICATION_HOST'] || "images.google.com"
51
- application_port = ENV['SELENIUM_APPLICATION_PORT'] || "80"
52
-
53
- @selenium_driver = Selenium::Client::Driver.new(
54
- remote_control_server, port, browser,
55
- "http://#{application_host}:#{application_port}", timeout)
56
- end
57
-
58
- end
59
-
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #
3
- # Launch a collection of remote controls
4
- #
5
-
6
- def launch_on_unix(title, command)
7
- terminal = ENV['TERM'] || "xterm"
8
- system "#{terminal} -t '#{title}' -e '#{command}'"
9
- end
10
-
11
- def launch_in_terminal(title, command)
12
- launch_on_unix(title, command)
13
- end
14
-
15
- first_port = ARGV[0] || 5555
16
- last_port = ARGV[1] || 5555
17
- base_directory = File.expand_path(File.dirname(__FILE__))
18
- (first_port..last_port).each do |port|
19
- launch_in_terminal "Remote Control #{port}", "ant -Dport=#{port} launch-remote-control"
20
- end