celerity 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -1
- data/README.rdoc +9 -9
- data/lib/celerity/collections.rb +1 -1
- data/lib/celerity/element_locator.rb +3 -3
- data/lib/celerity/elements/non_control_elements.rb +1 -1
- data/lib/celerity/elements/select_list.rb +1 -1
- data/lib/celerity/htmlunit/{commons-io-2.0.1.jar → commons-io-2.1.jar} +0 -0
- data/lib/celerity/htmlunit/{commons-lang3-3.0.1.jar → commons-lang3-3.1.jar} +0 -0
- data/lib/celerity/htmlunit/{cssparser-0.9.6-20110829.205617-3.jar → cssparser-0.9.7-20111123.050136-1.jar} +0 -0
- data/lib/celerity/htmlunit/htmlunit-2.10-SNAPSHOT.jar +0 -0
- data/lib/celerity/htmlunit/{htmlunit-core-js-2.9.jar → htmlunit-core-js-2.10-SNAPSHOT.jar} +0 -0
- data/lib/celerity/short_inspect.rb +11 -2
- data/lib/celerity/version.rb +1 -1
- data/spec/browser_authentication_spec.rb +1 -1
- data/spec/browser_spec.rb +22 -11
- data/spec/index_offset_spec.rb +4 -4
- data/spec/link_spec.rb +1 -1
- data/tasks/check.rake +4 -4
- data/tasks/fix.rake +2 -2
- data/tasks/jar.rake +3 -3
- data/tasks/website.rake +1 -1
- data/tasks/yard.rake +1 -1
- data/website/benchmarks.html +1 -1
- data/website/css/color.css +2 -2
- data/website/css/layout.css +1 -1
- data/website/css/textmate.css +1 -1
- metadata +7 -6
data/.travis.yml
CHANGED
data/README.rdoc
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
Celerity is a JRuby library for easy and fast functional test automation for web applications.
|
11
11
|
|
12
|
-
Celerity is a JRuby wrapper around HtmlUnit – a headless Java browser with
|
12
|
+
Celerity is a JRuby wrapper around HtmlUnit – a headless Java browser with
|
13
13
|
JavaScript support. It provides a simple API for programmatic navigation through
|
14
14
|
web applications. Celerity provides a superset of Watir's API.
|
15
15
|
|
@@ -20,7 +20,7 @@ web applications. Celerity provides a superset of Watir's API.
|
|
20
20
|
* *Easy to use*: Simple API
|
21
21
|
* *Portable*: Cross-platform thanks to the JVM
|
22
22
|
* *Unintrusive*: No browser window interrupting your workflow (runs in background)
|
23
|
-
|
23
|
+
|
24
24
|
== Requirements
|
25
25
|
|
26
26
|
* JRuby 1.2.0 or higher
|
@@ -29,18 +29,18 @@ web applications. Celerity provides a superset of Watir's API.
|
|
29
29
|
== Install
|
30
30
|
|
31
31
|
jruby -S gem install celerity
|
32
|
-
|
32
|
+
|
33
33
|
To always get the latest version, you should use Gemcutter as your primary gem source:
|
34
|
-
|
34
|
+
|
35
35
|
jruby -S gem install gemcutter
|
36
36
|
jruby -S gem tumble
|
37
37
|
jruby -S gem install celerity
|
38
|
-
|
39
|
-
|
38
|
+
|
39
|
+
|
40
40
|
== Example
|
41
41
|
|
42
42
|
require "rubygems"
|
43
|
-
require "celerity"
|
43
|
+
require "celerity"
|
44
44
|
|
45
45
|
browser = Celerity::Browser.new
|
46
46
|
browser.goto('http://www.google.com')
|
@@ -48,7 +48,7 @@ To always get the latest version, you should use Gemcutter as your primary gem s
|
|
48
48
|
browser.button(:name, 'btnG').click
|
49
49
|
|
50
50
|
puts "yay" if browser.text.include? 'celerity.rubyforge.org'
|
51
|
-
|
51
|
+
|
52
52
|
== Source
|
53
53
|
|
54
54
|
The source code is available on [GitHub](http://github.com/jarib/celerity/tree/master).
|
@@ -67,7 +67,7 @@ The source code is available on [GitHub](http://github.com/jarib/celerity/tree/m
|
|
67
67
|
== License
|
68
68
|
|
69
69
|
Celerity - JRuby wrapper for HtmlUnit
|
70
|
-
Copyright (c) 2008-
|
70
|
+
Copyright (c) 2008-2012 FINN.no AS
|
71
71
|
|
72
72
|
This program is free software; you can redistribute it and/or modify
|
73
73
|
it under the terms of the GNU General Public License as published by
|
data/lib/celerity/collections.rb
CHANGED
@@ -95,10 +95,10 @@ module Celerity
|
|
95
95
|
def find_by_xpath(what)
|
96
96
|
what = ".#{what}" if what[0].chr == "/"
|
97
97
|
object = @object.getByXPath(what).to_a.first || return
|
98
|
-
|
98
|
+
|
99
99
|
return unless @idents.any? { |id| id.match?(object) }
|
100
|
-
|
101
|
-
|
100
|
+
|
101
|
+
|
102
102
|
object
|
103
103
|
end
|
104
104
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -3,8 +3,14 @@ module Celerity
|
|
3
3
|
|
4
4
|
def short_inspect(opts)
|
5
5
|
if excluded_ivars = opts[:exclude]
|
6
|
+
if is_ruby19
|
7
|
+
excluded_ivars.map! { |ivar| ivar.to_sym }
|
8
|
+
end
|
6
9
|
ivars = (instance_variables - excluded_ivars)
|
7
10
|
elsif included_ivars = opts[:include]
|
11
|
+
if is_ruby19
|
12
|
+
included_ivars.map! { |ivar| ivar.to_sym }
|
13
|
+
end
|
8
14
|
ivars = included_ivars
|
9
15
|
else
|
10
16
|
raise ArgumentError, "unknown arg: #{opts.inspect}"
|
@@ -14,7 +20,10 @@ module Celerity
|
|
14
20
|
'#<%s:0x%s %s>' % [self.class.name, self.hash.to_s(16), ivars.join(" ")]
|
15
21
|
end
|
16
22
|
|
17
|
-
|
23
|
+
private
|
24
|
+
def is_ruby19
|
25
|
+
RUBY_VERSION >= "1.9"
|
26
|
+
end
|
18
27
|
|
19
28
|
end
|
20
|
-
end
|
29
|
+
end
|
data/lib/celerity/version.rb
CHANGED
@@ -5,8 +5,8 @@ describe "Browser" do
|
|
5
5
|
describe "#credentials=" do
|
6
6
|
it "sets the basic authentication credentials" do
|
7
7
|
browser.goto(WatirSpec.host + "/authentication")
|
8
|
-
browser.text.should_not include("ok")
|
9
8
|
|
9
|
+
browser.text.should_not include("ok")
|
10
10
|
browser.credentials = "foo:bar"
|
11
11
|
|
12
12
|
browser.goto(WatirSpec.host + "/authentication")
|
data/spec/browser_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require File.expand_path("../watirspec/spec_helper", __FILE__)
|
2
4
|
|
3
5
|
describe "Browser" do
|
@@ -269,15 +271,15 @@ describe "Browser" do
|
|
269
271
|
browser.wait.should be_true
|
270
272
|
alerts.should == 1
|
271
273
|
end
|
272
|
-
|
274
|
+
|
273
275
|
it "should pass the correct args to webclient" do
|
274
276
|
browser.webclient.should_receive(:waitForBackgroundJavaScript).with(10000)
|
275
277
|
browser.wait
|
276
|
-
|
278
|
+
|
277
279
|
browser.webclient.should_receive(:waitForBackgroundJavaScript).with(3000)
|
278
|
-
browser.wait(3)
|
280
|
+
browser.wait(3)
|
279
281
|
end
|
280
|
-
|
282
|
+
|
281
283
|
end
|
282
284
|
|
283
285
|
describe "#wait_while" do
|
@@ -285,7 +287,9 @@ describe "Browser" do
|
|
285
287
|
browser.goto(WatirSpec.files + "/timeout.html")
|
286
288
|
browser.div(:id, "change").click
|
287
289
|
browser.wait_while { browser.contains_text("Trigger change") }
|
288
|
-
browser.
|
290
|
+
browser.wait_until {
|
291
|
+
browser.div(:id, "change").text == "all done"
|
292
|
+
}
|
289
293
|
end
|
290
294
|
|
291
295
|
it "returns the value returned from the block" do
|
@@ -349,9 +353,14 @@ describe "Browser" do
|
|
349
353
|
describe "#status_code_exceptions" do
|
350
354
|
it "raises status code exceptions if set to true" do
|
351
355
|
browser.status_code_exceptions = true
|
352
|
-
|
353
|
-
|
354
|
-
|
356
|
+
|
357
|
+
begin
|
358
|
+
lambda {
|
359
|
+
browser.goto(WatirSpec.host + "/doesnt_exist")
|
360
|
+
}.should raise_error(NavigationException)
|
361
|
+
ensure
|
362
|
+
browser.status_code_exceptions = false
|
363
|
+
end
|
355
364
|
end
|
356
365
|
end
|
357
366
|
|
@@ -359,9 +368,11 @@ describe "Browser" do
|
|
359
368
|
it "raises javascript exceptions if set to true" do
|
360
369
|
browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
|
361
370
|
browser.javascript_exceptions = true
|
362
|
-
|
363
|
-
browser.execute_script("no_such_function()")
|
364
|
-
|
371
|
+
begin
|
372
|
+
lambda { browser.execute_script("no_such_function()") }.should raise_error
|
373
|
+
ensure
|
374
|
+
browser.javascript_exceptions = false
|
375
|
+
end
|
365
376
|
end
|
366
377
|
end
|
367
378
|
|
data/spec/index_offset_spec.rb
CHANGED
@@ -4,18 +4,18 @@ describe "Celerity.index_offset" do
|
|
4
4
|
|
5
5
|
# before :all do
|
6
6
|
# browser.goto(WatirSpec.files + "/non_control_elements.html")
|
7
|
-
#
|
7
|
+
#
|
8
8
|
# Celerity.index_offset = 0
|
9
9
|
# end
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# it "returns the correct divs" do
|
12
12
|
# divs = browser.divs.to_a
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# divs.each_with_index do |div, idx|
|
15
15
|
# browser.div(:index, idx).id.should == div.id
|
16
16
|
# end
|
17
17
|
# end
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# after :all do
|
20
20
|
# Celerity.index_offset = 1
|
21
21
|
# end
|
data/spec/link_spec.rb
CHANGED
data/tasks/check.rake
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
namespace :check do
|
2
|
-
|
2
|
+
|
3
3
|
desc 'Check syntax of all .rb files'
|
4
4
|
task :syntax do
|
5
5
|
failed = []
|
6
|
-
|
6
|
+
|
7
7
|
Dir['**/*.rb'].each do |f|
|
8
8
|
begin
|
9
9
|
eval("lambda do\n return true\n #{File.read f} \nend").call
|
@@ -13,12 +13,12 @@ namespace :check do
|
|
13
13
|
failed << [f, e.message]
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
if failed.empty?
|
18
18
|
puts "ok."
|
19
19
|
else
|
20
20
|
puts "\n\t#{failed.join("\n\t")}"
|
21
21
|
end
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
end
|
data/tasks/fix.rake
CHANGED
@@ -9,7 +9,7 @@ namespace :fix do
|
|
9
9
|
s.gsub!(/\r?\n/, "\n")
|
10
10
|
File.open(f, "w") { |io| io.write(s) }
|
11
11
|
end
|
12
|
-
end
|
12
|
+
end
|
13
13
|
|
14
14
|
desc 'Remove trailing whitespace from all ruby files'
|
15
15
|
task :trailing_whitespace do
|
@@ -21,5 +21,5 @@ namespace :fix do
|
|
21
21
|
File.open(f, "w") { |io| io.write(s) }
|
22
22
|
end
|
23
23
|
end
|
24
|
-
|
24
|
+
|
25
25
|
end
|
data/tasks/jar.rake
CHANGED
@@ -8,11 +8,11 @@ namespace :jar do
|
|
8
8
|
ruby_files = Dir['lib/**/*.rb']
|
9
9
|
jar_files = Dir['lib/**/*.jar']
|
10
10
|
resources = Dir['lib/celerity/resources/*']
|
11
|
-
|
11
|
+
|
12
12
|
rm_rf target_dir if File.exist? target_dir
|
13
13
|
mkdir target_dir
|
14
14
|
mkdir_p resource_dir = "#{target_dir}/celerity/resources"
|
15
|
-
|
15
|
+
|
16
16
|
sh "jrubyc", "-d", "lib", "-t", target_dir, *ruby_files
|
17
17
|
resources.each { |extra| cp extra, resource_dir }
|
18
18
|
|
@@ -42,7 +42,7 @@ namespace :jar do
|
|
42
42
|
rm_rf target_dir if File.exist? target_dir
|
43
43
|
mkdir target_dir
|
44
44
|
mkdir_p resource_dir = "#{target_dir}/celerity/resources"
|
45
|
-
|
45
|
+
|
46
46
|
sh "jrubyc", "-d", "lib", "-t", target_dir, *ruby_files
|
47
47
|
resources.each { |extra| cp extra, resource_dir }
|
48
48
|
|
data/tasks/website.rake
CHANGED
data/tasks/yard.rake
CHANGED
data/website/benchmarks.html
CHANGED
@@ -41,7 +41,7 @@
|
|
41
41
|
<li><a href="http://celerity.rubyforge.org/svn/trunk/benchmark/bm_digg.rb">Scenario 3: Counting the number of "diggs" on digg.com's front page</a></li>
|
42
42
|
<li><a href="http://celerity.rubyforge.org/svn/trunk/benchmark/bm_input_locator.rb">Scenario 4: Locating different HTML input elements (local file)</a></li>
|
43
43
|
</ul>
|
44
|
-
|
44
|
+
|
45
45
|
<h2>Results: Overview</h2>
|
46
46
|
<p>This table provides a quick overview. For more accurate numbers, see below.</p>
|
47
47
|
<table>
|
data/website/css/color.css
CHANGED
data/website/css/layout.css
CHANGED
data/website/css/textmate.css
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: celerity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.9.
|
5
|
+
version: 0.9.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jari Bakken
|
@@ -12,7 +12,7 @@ autorequire:
|
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
14
|
|
15
|
-
date:
|
15
|
+
date: 2012-01-12 00:00:00 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rake
|
@@ -124,12 +124,12 @@ files:
|
|
124
124
|
- lib/celerity/htmlunit.rb
|
125
125
|
- lib/celerity/htmlunit/commons-codec-1.4.jar
|
126
126
|
- lib/celerity/htmlunit/commons-collections-3.2.1.jar
|
127
|
-
- lib/celerity/htmlunit/commons-io-2.
|
128
|
-
- lib/celerity/htmlunit/commons-lang3-3.
|
127
|
+
- lib/celerity/htmlunit/commons-io-2.1.jar
|
128
|
+
- lib/celerity/htmlunit/commons-lang3-3.1.jar
|
129
129
|
- lib/celerity/htmlunit/commons-logging-1.1.1.jar
|
130
|
-
- lib/celerity/htmlunit/cssparser-0.9.
|
130
|
+
- lib/celerity/htmlunit/cssparser-0.9.7-20111123.050136-1.jar
|
131
131
|
- lib/celerity/htmlunit/htmlunit-2.10-SNAPSHOT.jar
|
132
|
-
- lib/celerity/htmlunit/htmlunit-core-js-2.
|
132
|
+
- lib/celerity/htmlunit/htmlunit-core-js-2.10-SNAPSHOT.jar
|
133
133
|
- lib/celerity/htmlunit/httpclient-4.1.2.jar
|
134
134
|
- lib/celerity/htmlunit/httpcore-4.1.2.jar
|
135
135
|
- lib/celerity/htmlunit/httpmime-4.1.2.jar
|
@@ -220,3 +220,4 @@ specification_version: 3
|
|
220
220
|
summary: Celerity is a JRuby library for easy and fast functional test automation for web applications.
|
221
221
|
test_files: []
|
222
222
|
|
223
|
+
has_rdoc:
|