celerity 0.9.1 → 0.9.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.
@@ -1,4 +1,4 @@
1
1
  rvm:
2
2
  - jruby
3
- before_script:
3
+ before_script:
4
4
  - git submodule update --init
@@ -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-2011 FINN.no AS
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
@@ -152,7 +152,7 @@ module Celerity
152
152
  class H6s < ElementCollection
153
153
  def element_class; H6; end
154
154
  end
155
-
155
+
156
156
  class Inses < ElementCollection
157
157
  def element_class; Ins; end
158
158
  end
@@ -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
 
@@ -80,7 +80,7 @@ module Celerity
80
80
  class H6 < NonControlElement
81
81
  TAGS = [ Identifier.new('h6') ]
82
82
  end
83
-
83
+
84
84
  class Ins < NonControlElement
85
85
  TAGS = [ Identifier.new('ins') ]
86
86
  end
@@ -47,7 +47,7 @@ module Celerity
47
47
  next unless matches_option?(option, value)
48
48
 
49
49
  selected ||= option.asText
50
- option.click
50
+ option.click unless option.isSelected
51
51
  end
52
52
 
53
53
  unless selected
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Celerity
2
- VERSION = "0.9.1"
2
+ VERSION = "0.9.2"
3
3
  end
@@ -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")
@@ -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.div(:id, "change").text.should == "all done"
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
- lambda do
353
- browser.goto(WatirSpec.host + "/doesnt_exist")
354
- end.should raise_error(NavigationException)
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
- lambda do
363
- browser.execute_script("no_such_function()")
364
- end.should raise_error
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
 
@@ -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
@@ -12,5 +12,5 @@ describe "Link" do
12
12
  browser.link(:index, Celerity.index_offset + 1).absolute_url.should include("#{WatirSpec.files}/non_control_elements.html".gsub("file://", ''))
13
13
  end
14
14
  end
15
-
15
+
16
16
  end
@@ -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
@@ -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
@@ -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
 
@@ -4,7 +4,7 @@ namespace :website do
4
4
  host = "jarib@rubyforge.org"
5
5
  remote_dir = "/var/www/gforge-projects/celerity"
6
6
  local_dir = 'website'
7
-
7
+
8
8
  sh %{rsync -rlgoDCv #{local_dir}/ #{host}:#{remote_dir}}
9
9
  end
10
10
  end
@@ -8,7 +8,7 @@ begin
8
8
  t.options += ["-o", "website/yard"]
9
9
  end
10
10
  end
11
-
11
+
12
12
  rescue LoadError
13
13
  task :yardoc do
14
14
  abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
@@ -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>
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  a {
6
-
6
+
7
7
  }
8
8
 
9
9
  a:hover {
@@ -129,7 +129,7 @@ table th {
129
129
  }
130
130
 
131
131
  .project {
132
-
132
+
133
133
  }
134
134
 
135
135
  .project img {
@@ -77,7 +77,7 @@ table th, table td {
77
77
  #nav ul {
78
78
  height: 90px;
79
79
  overflow: auto;
80
- text-align: center;
80
+ text-align: center;
81
81
  }
82
82
 
83
83
  #nav ul li {
@@ -1,7 +1,7 @@
1
1
  /* Stylesheet generated from TextMate theme
2
2
  *
3
3
  * Mac Classic
4
- *
4
+ *
5
5
  *
6
6
  */
7
7
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: celerity
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.1
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: 2011-10-22 00:00:00 Z
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.0.1.jar
128
- - lib/celerity/htmlunit/commons-lang3-3.0.1.jar
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.6-20110829.205617-3.jar
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.9.jar
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: