revisor_client 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 [name of plugin creator]
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -7,18 +7,32 @@ can send commands with any HTTP client, this library might save you
7
7
  some time collecting command arguments and handling server responses
8
8
  for you. It also includes some examples and test suite.
9
9
 
10
+ Installation
11
+ ----------
12
+
13
+ Revisor Client Library is available via RubyGems:
14
+
15
+ $ gem install revisor_client
16
+
17
+ Usage
18
+ ----------
19
+
10
20
  Location of Revisor executable
11
21
  ----------
12
22
 
13
23
  Client library expects your Revisor executable will be in PATH, or
14
24
  it's location is set in REVISOR_PATH environment variable.
15
25
 
16
- Running examples (GMail test)
17
- ----------
18
-
19
- $ rake examples REVISOR_PATH=/path/to/your/revisor/executable
20
-
21
26
  Running tests
22
27
  ----------
23
28
 
29
+ Execute following command inside cloned Git repository or installed
30
+ gem folder:
31
+
24
32
  $ rake test REVISOR_PATH=/path/to/your/revisor/executable
33
+
34
+ Copyrights
35
+ ----------
36
+
37
+ Copyright (c) 2009 Mikhail Lapshin (sotakone at sotakone dot com),
38
+ released under the MIT license.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,21 +5,21 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{revisor_client}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mikhail Lapshin"]
12
- s.date = %q{2011-04-11}
12
+ s.date = %q{2011-04-16}
13
13
  s.description = %q{}
14
14
  s.email = %q{sotakone@sotakone.com}
15
15
  s.extra_rdoc_files = [
16
16
  "README.md"
17
17
  ]
18
18
  s.files = [
19
+ "MIT-LICENSE",
19
20
  "README.md",
20
21
  "Rakefile",
21
22
  "VERSION",
22
- "lib/revisor.rb",
23
23
  "lib/revisor/client.rb",
24
24
  "lib/revisor/client/session.rb",
25
25
  "lib/revisor/client/tab.rb",
@@ -1,3 +1,4 @@
1
+ # -*- coding: utf-8 -*-
1
2
  require File.join(File.dirname(__FILE__), "test_helper")
2
3
 
3
4
  class SessionTabTest < Test::Unit::TestCase
@@ -28,19 +29,19 @@ class SessionTabTest < Test::Unit::TestCase
28
29
  end
29
30
 
30
31
  def test_visit_url_and_wait_for_load
31
- @tab.visit("http://example.com/")
32
+ @tab.visit("http://sotakone.com/")
32
33
  @tab.wait_for_load
33
- assert_equal "http://example.com/", @tab.evaluate_javascript("window.location.href")
34
+ assert_equal "http://sotakone.com/", @tab.evaluate_javascript("window.location.href")
34
35
  end
35
36
 
36
37
  def test_evaluate_javascript
37
- @tab.visit("http://example.com/")
38
+ @tab.visit("http://sotakone.com/")
38
39
  @tab.wait_for_load
39
40
  assert_equal 4, @tab.evaluate_javascript("2 + 2")
40
41
  end
41
42
 
42
43
  def test_prompt_answer
43
- @tab.visit("http://example.com/")
44
+ @tab.visit("http://sotakone.com/")
44
45
  @tab.wait_for_load
45
46
  @tab.set_prompt_answer("my answer", false)
46
47
  assert_equal "my answer", @tab.evaluate_javascript("prompt('prompt')")
@@ -50,7 +51,7 @@ class SessionTabTest < Test::Unit::TestCase
50
51
  end
51
52
 
52
53
  def test_confirm_answer
53
- @tab.visit("http://example.com/")
54
+ @tab.visit("http://sotakone.com/")
54
55
  @tab.wait_for_load
55
56
  @tab.set_confirm_answer(true)
56
57
  assert_equal true, @tab.evaluate_javascript("confirm('prompt')")
@@ -60,15 +61,15 @@ class SessionTabTest < Test::Unit::TestCase
60
61
  end
61
62
 
62
63
  def test_save_screenshot
63
- @tab.visit("http://example.com/")
64
+ @tab.visit("http://sotakone.com/")
64
65
  @tab.wait_for_load
65
66
 
66
- assert_equal "OK", @tab.save_screenshot("/tmp/twitter_screenshot.png", [1024, 1024])[:result]
67
- assert File.exist?("/tmp/twitter_screenshot.png")
67
+ assert_equal "OK", @tab.save_screenshot("/tmp/revisor_screenshot.png", [1024, 1024])[:result]
68
+ assert File.exist?("/tmp/revisor_screenshot.png")
68
69
  end
69
70
 
70
71
  def test_wait_for_condition
71
- @tab.visit("http://example.com/")
72
+ @tab.visit("http://sotakone.com/")
72
73
  @tab.wait_for_load
73
74
 
74
75
  # foo will be 42 after 1000 msec
data/test/test_helper.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.join(File.dirname(__FILE__), "/../lib/revisor")
1
+ require File.join(File.dirname(__FILE__), "/../lib/revisor_client")
2
2
  require 'test/unit'
3
3
 
4
4
  module SetupAndTeardownOnce
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revisor_client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mikhail Lapshin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-11 00:00:00 +04:00
18
+ date: 2011-04-16 00:00:00 +04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -28,10 +28,10 @@ extensions: []
28
28
  extra_rdoc_files:
29
29
  - README.md
30
30
  files:
31
+ - MIT-LICENSE
31
32
  - README.md
32
33
  - Rakefile
33
34
  - VERSION
34
- - lib/revisor.rb
35
35
  - lib/revisor/client.rb
36
36
  - lib/revisor/client/session.rb
37
37
  - lib/revisor/client/tab.rb
data/lib/revisor.rb DELETED
@@ -1,50 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "revisor", "client")
2
-
3
- module Revisor
4
-
5
- @@server_executable = "revisor"
6
- @@server_pid = nil
7
-
8
- class << self
9
- def server_executable
10
- @@server_executable
11
- end
12
-
13
- def server_executable=(e)
14
- @@server_executable = e
15
- end
16
-
17
- def server_pid
18
- @@server_pid
19
- end
20
-
21
- def start_server(interface = "127.0.0.1", port = 8080, delay = 3)
22
- if @@server_pid
23
- raise "Revisor server already started"
24
- else
25
- @@server_pid = fork do
26
- exec("#{@@server_executable} -l #{interface} -p #{port}")
27
- end
28
-
29
- at_exit do
30
- if Revisor.server_pid && $$ != Revisor.server_pid
31
- Revisor.stop_server
32
- end
33
- end
34
-
35
- # TODO: more clever detection of server startup
36
- sleep delay
37
- @@server_pid
38
- end
39
- end
40
-
41
- def stop_server
42
- if @@server_pid
43
- Process.kill("INT", @@server_pid)
44
- @@server_pid = nil
45
- else
46
- raise "Revisor server is not started, so I couldn't stop it"
47
- end
48
- end
49
- end
50
- end