watir-webdriver 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -40,16 +40,12 @@ namespace :spec do
40
40
  spec.rcov_opts = %w[--exclude spec,ruby-debug,/Library/Ruby,.gem --include lib/watir-webdriver]
41
41
  end
42
42
 
43
- desc 'Run specs for CI'
44
- RSpec::Core::RakeTask.new(:ci) do |spec|
43
+ RSpec::Core::RakeTask.new(:html) do |spec|
45
44
  spec.ruby_opts = "-I lib:spec"
46
45
  spec.pattern = 'spec/**/*_spec.rb'
47
- spec.rspec_opts = ["--format", "html:results/#{RUBY_PLATFORM}/#{ENV['WATIR_WEBDRIVER_BROWSER'] || 'firefox'}/spec-results.html",
48
- "--format", "progress",
49
- "--backtrace"]
50
- spec.rcov = true
51
- spec.rcov_opts = %w[--exclude spec,ruby-debug,/Library/Ruby,.gem --include lib/watir-webdriver]
46
+ spec.rspec_opts = "--format html --out #{ENV["SPEC_REPORT"] || "specs.html"}"
52
47
  end
48
+
53
49
  end
54
50
 
55
51
  task :spec => :check_dependencies
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 0.1.3
@@ -297,9 +297,9 @@ module Watir
297
297
  def equal_pair(key, value)
298
298
  # we assume :label means a corresponding label element, not the attribute
299
299
  if key == :label && should_use_label_element?
300
- "@id=//label[normalize-space()='#{value}']/@for"
300
+ "@id=//label[normalize-space()=#{xpath_string(value)}]/@for"
301
301
  else
302
- "#{lhs_for(key)}='#{value}'"
302
+ "#{lhs_for(key)}=#{xpath_string(value)}"
303
303
  end
304
304
  end
305
305
 
@@ -348,5 +348,16 @@ module Watir
348
348
  false
349
349
  end
350
350
 
351
+ def xpath_string(value)
352
+ if value.include? "'"
353
+ parts = value.split("'", -1).map { |part| "'#{part}'" }
354
+ string = parts.join(%{,"'",})
355
+
356
+ "concat(#{string})"
357
+ else
358
+ "'#{value}'"
359
+ end
360
+ end
361
+
351
362
  end # ElementLocator
352
363
  end # Watir
@@ -38,5 +38,4 @@ describe Watir::Browser do
38
38
  end
39
39
  end
40
40
 
41
-
42
41
  end
@@ -36,7 +36,5 @@ describe Watir::Container do
36
36
  }.should raise_error(ArgumentError)
37
37
  end
38
38
 
39
-
40
-
41
39
  end
42
40
  end
@@ -26,6 +26,11 @@ describe Watir::ElementLocator do
26
26
  locate_one :title => "foo"
27
27
  end
28
28
 
29
+ it "handles single quotes in the attribute string" do
30
+ expect_one :xpath, %{.//*[@title=concat('foo and ',"'",'bar',"'",'')]}
31
+ locate_one :title => "foo and 'bar'"
32
+ end
33
+
29
34
  it "handles selector with tag name and multiple attributes" do
30
35
  expect_one :xpath, ".//div[@class='foo' and @title='bar']"
31
36
 
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
+ <title>Special Chars</title>
6
+ </head>
7
+
8
+ <body>
9
+ <div id='single-quote'>single 'quotes'</div>
10
+ <div id='double-quote'>double "quotes"</div>
11
+ </body>
12
+ </html>
@@ -3,20 +3,21 @@
3
3
  <head>
4
4
  <title>wait test</title>
5
5
  <script type="text/javascript" charset="utf-8">
6
- function setTimeoutDisplay(id, display, timeout) {
7
- setTimeout(function() {
8
- document.getElementById(id).style.display = display;
9
- }, timeout);
10
- }
11
- function setTimeoutRemove(id, timeout) {
12
- setTimeout(function() {
13
- var e = document.getElementById(id);
14
- e.parentNode.removeChild(e);
15
- }, timeout);
16
- }
6
+ function setTimeoutDisplay(id, display, timeout) {
7
+ setTimeout(function() {
8
+ document.getElementById(id).style.display = display;
9
+ }, timeout);
10
+ }
11
+
12
+ function setTimeoutRemove(id, timeout) {
13
+ setTimeout(function() {
14
+ var e = document.getElementById(id);
15
+ e.parentNode.removeChild(e);
16
+ }, timeout);
17
+ }
17
18
  </script>
18
19
  </head>
19
-
20
+
20
21
  <body>
21
22
  <div id="foo" style="display:block;">foo</div>
22
23
  <div id="bar" style="display:none;">bar</div>
@@ -0,0 +1,13 @@
1
+ require File.expand_path('watirspec/spec_helper', File.dirname(__FILE__))
2
+
3
+ describe Watir::Browser do
4
+
5
+ before do
6
+ browser.goto("file://" + File.expand_path("../html/special_chars.html", __FILE__))
7
+ end
8
+
9
+ it "should find elements with single quotes" do
10
+ browser.div(:text => "single 'quotes'").should exist
11
+ end
12
+
13
+ end
@@ -144,12 +144,12 @@ describe "FileField" do
144
144
  browser.file_field.value = '/tmp/unlikely-to-exist'
145
145
  browser.file_field.value.should == '/tmp/unlikely-to-exist'
146
146
  end
147
- end
148
147
 
149
- it "does not alter its argument" do
150
- value = '/foo/bar'
151
- browser.file_field.value = value
152
- value.should == '/foo/bar'
148
+ it "does not alter its argument" do
149
+ value = '/foo/bar'
150
+ browser.file_field.value = value
151
+ value.should == '/foo/bar'
152
+ end
153
153
  end
154
154
  end
155
155
 
@@ -1,5 +1,7 @@
1
1
  # encoding: utf-8
2
2
 
3
+ require "socket"
4
+
3
5
  module WatirSpec
4
6
  class Server < Sinatra::Base
5
7
  class << self
@@ -68,11 +70,14 @@ module WatirSpec
68
70
  defined?(@running) && @running
69
71
  end
70
72
 
73
+ SOCKET_ERRORS = [Errno::EADDRINUSE]
74
+ SOCKET_ERRORS << SocketError if defined?(SocketError) # ruby versions...
75
+
71
76
  def free_port?(port)
72
77
  s = TCPServer.new(@host, port)
73
78
  s.close
74
79
  true
75
- rescue SocketError, Errno::EADDRINUSE
80
+ rescue *SOCKET_ERRORS
76
81
  false
77
82
  end
78
83
 
@@ -85,7 +90,12 @@ module WatirSpec
85
90
  raise "please run `gem install childprocess` for WatirSpec on Windows + MRI\n\t(caught: #{ex.message})"
86
91
  end
87
92
 
88
- process = ChildProcess.build(WatirSpec.ruby, File.expand_path("../../spec_helper", __FILE__))
93
+ path = File.expand_path("../../spec_helper.rb", __FILE__)
94
+
95
+ process = ChildProcess.build(WatirSpec.ruby, path)
96
+ process.io.inherit! if $DEBUG
97
+ process.start
98
+
89
99
  at_exit { process.stop }
90
100
  end
91
101
  end # class << Server
@@ -58,19 +58,17 @@ module WatirSpec
58
58
  end
59
59
 
60
60
  def ruby
61
- if @ruby.nil?
61
+ @ruby ||= (
62
62
  if defined?(Gem)
63
- @ruby = Gem.ruby
63
+ Gem.ruby
64
64
  else
65
65
  require "rbconfig"
66
66
  rb = File.join(RbConfig::CONFIG.values_at('BINDIR', 'RUBY_INSTALL_NAME').compact)
67
67
  ext = RbConfig::CONFIG['EXEEXT']
68
68
 
69
- @ruby = "#{rb}#{ext}"
69
+ "#{rb}#{ext}"
70
70
  end
71
- end
72
-
73
- @ruby
71
+ )
74
72
  end
75
73
 
76
74
  end # class << WatirSpec
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{watir-webdriver}
8
- s.version = "0.1.2"
8
+ s.version = "0.1.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Jari Bakken"]
12
- s.date = %q{2010-11-11}
12
+ s.date = %q{2010-11-18}
13
13
  s.description = %q{WebDriver-backed Watir}
14
14
  s.email = %q{jari.bakken@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -80,11 +80,13 @@ Gem::Specification.new do |s|
80
80
  "spec/element_spec.rb",
81
81
  "spec/html/alerts.html",
82
82
  "spec/html/keylogger.html",
83
+ "spec/html/special_chars.html",
83
84
  "spec/html/wait.html",
84
85
  "spec/implementation.rb",
85
86
  "spec/input_spec.rb",
86
87
  "spec/locator_spec_helper.rb",
87
88
  "spec/spec_helper.rb",
89
+ "spec/special_chars_spec.rb",
88
90
  "spec/wait_spec.rb",
89
91
  "support/html5.html",
90
92
  "watir-webdriver.gemspec"
@@ -104,6 +106,7 @@ Gem::Specification.new do |s|
104
106
  "spec/input_spec.rb",
105
107
  "spec/locator_spec_helper.rb",
106
108
  "spec/spec_helper.rb",
109
+ "spec/special_chars_spec.rb",
107
110
  "spec/wait_spec.rb",
108
111
  "spec/watirspec/area_spec.rb",
109
112
  "spec/watirspec/areas_spec.rb",
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir-webdriver
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 29
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 1
8
- - 2
9
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
10
11
  platform: ruby
11
12
  authors:
12
13
  - Jari Bakken
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-11-11 00:00:00 +01:00
18
+ date: 2010-11-18 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - "="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 27
28
30
  segments:
29
31
  - 0
30
32
  - 1
@@ -40,6 +42,7 @@ dependencies:
40
42
  requirements:
41
43
  - - ~>
42
44
  - !ruby/object:Gem::Version
45
+ hash: 11
43
46
  segments:
44
47
  - 2
45
48
  - 1
@@ -55,6 +58,7 @@ dependencies:
55
58
  requirements:
56
59
  - - ~>
57
60
  - !ruby/object:Gem::Version
61
+ hash: 7
58
62
  segments:
59
63
  - 0
60
64
  - 6
@@ -69,6 +73,7 @@ dependencies:
69
73
  requirements:
70
74
  - - ">="
71
75
  - !ruby/object:Gem::Version
76
+ hash: 19
72
77
  segments:
73
78
  - 0
74
79
  - 0
@@ -84,6 +89,7 @@ dependencies:
84
89
  requirements:
85
90
  - - ~>
86
91
  - !ruby/object:Gem::Version
92
+ hash: 15
87
93
  segments:
88
94
  - 1
89
95
  - 0
@@ -98,6 +104,7 @@ dependencies:
98
104
  requirements:
99
105
  - - ">="
100
106
  - !ruby/object:Gem::Version
107
+ hash: 3
101
108
  segments:
102
109
  - 0
103
110
  version: "0"
@@ -111,6 +118,7 @@ dependencies:
111
118
  requirements:
112
119
  - - ~>
113
120
  - !ruby/object:Gem::Version
121
+ hash: 9
114
122
  segments:
115
123
  - 2
116
124
  - 3
@@ -191,11 +199,13 @@ files:
191
199
  - spec/element_spec.rb
192
200
  - spec/html/alerts.html
193
201
  - spec/html/keylogger.html
202
+ - spec/html/special_chars.html
194
203
  - spec/html/wait.html
195
204
  - spec/implementation.rb
196
205
  - spec/input_spec.rb
197
206
  - spec/locator_spec_helper.rb
198
207
  - spec/spec_helper.rb
208
+ - spec/special_chars_spec.rb
199
209
  - spec/wait_spec.rb
200
210
  - support/html5.html
201
211
  - watir-webdriver.gemspec
@@ -298,6 +308,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
298
308
  requirements:
299
309
  - - ">="
300
310
  - !ruby/object:Gem::Version
311
+ hash: 3
301
312
  segments:
302
313
  - 0
303
314
  version: "0"
@@ -306,6 +317,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
306
317
  requirements:
307
318
  - - ">="
308
319
  - !ruby/object:Gem::Version
320
+ hash: 3
309
321
  segments:
310
322
  - 0
311
323
  version: "0"
@@ -326,6 +338,7 @@ test_files:
326
338
  - spec/input_spec.rb
327
339
  - spec/locator_spec_helper.rb
328
340
  - spec/spec_helper.rb
341
+ - spec/special_chars_spec.rb
329
342
  - spec/wait_spec.rb
330
343
  - spec/watirspec/area_spec.rb
331
344
  - spec/watirspec/areas_spec.rb