firewatir 1.6.6.rc1 → 1.6.6.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -10,7 +10,7 @@
10
10
  * Added an optional numeric parameter max_depth for Table#to_a and TableRow#to_a for getting text values for nested tables. Closes http://jira.openqa.org/browse/WTR-445 (Jarmo Pertman)
11
11
  * #close will close the browser even if #wait raises an Exception. Closes http://jira.openqa.org/browse/WTR-443 (Jarmo Pertman)
12
12
  * Added #element and #elements methods for locating non-specific elements. Closes http://jira.openqa.org/browse/WTR-103 (Hugh McGowan)
13
- * #click_no_wait fixes and improvements. Closes http://jira.openqa.org/browse/WTR-449 (Jarmo Pertman)
13
+ * #click_no_wait fixes and improvements. Closes http://jira.openqa.org/browse/WTR-320 and http://jira.openqa.org/browse/WTR-449 (Jarmo Pertman)
14
14
  * #wait will raise a Timeout::Error if page hasn't been loaded within 5 minutes. Closes http://jira.openqa.org/browse/WTR-452 (Bret)
15
15
  * Fixed a problem when #wait blocked forever. Closes http://jira.openqa.org/browse/WTR-446 (Jarmo Pertman)
16
16
 
@@ -26,6 +26,12 @@
26
26
 
27
27
  * Some rdoc cleanup (marekj)
28
28
  * Removed Watir::Utils (Jarmo Pertman)
29
+ * It is now possible to execute unit-tests within gems with `rake test` (Jarmo Pertman)
30
+ * Don't output unnecessary information to stdout in FireWatir unit-tests (Željko Filipin)
31
+
32
+
33
+ Whole Changelog is available at http://github.com/bret/watir/compare/v1.6.5...v1.6.6
34
+
29
35
 
30
36
  == Version 1.6.5
31
37
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.6.rc1
1
+ 1.6.6.rc2
data/firewatir.gemspec ADDED
@@ -0,0 +1,56 @@
1
+ $__firewatir_source_patterns = [
2
+ 'lib/firewatir.rb',
3
+ 'lib/firewatir/*.rb',
4
+ 'lib/firewatir/elements/*.rb',
5
+ 'unittests/*.rb',
6
+ 'unittests/html/*.html',
7
+ 'unittests/html/images/*.*',
8
+ 'LICENSE',
9
+ 'CHANGES',
10
+ 'rakefile.rb',
11
+ 'VERSION',
12
+ 'firewatir.gemspec'
13
+ ]
14
+
15
+ spec = Gem::Specification.new do |s|
16
+ version = File.read("VERSION").strip rescue "0.0.0"
17
+ s.name = 'firewatir'
18
+ s.version = version
19
+ s.summary = 'Automated testing tool for web applications using Firefox browser.'
20
+ s.description = <<-EOF
21
+ FireWatir stands for "Web Application Testing in Ruby for Firefox". FireWatir (pronounced firewater) is a free,
22
+ open-source functional testing tool for automating browser-based tests of web applications.
23
+ It works with applications written in any language.
24
+ FireWatir drives the Firefox browser the same way an end user would.
25
+ It clicks links, fills in forms, presses buttons.
26
+ FireWatir also checks results, such as whether expected text appears on the page, or whether a control is enabled.
27
+ FireWatir is a Ruby library that works with Firefox on Windows. It also works on Linux, Mac but without support for
28
+ JavaScript popups (currently support will be there shortly).
29
+ EOF
30
+ s.author = 'Angrez Singh'
31
+ s.homepage = 'http://www.watir.com'
32
+ s.email = 'watir-general@googlegroups.com'
33
+ s.rubyforge_project = 'Watir'
34
+
35
+ s.requirements << 'Mozilla Firefox browser 1.5 or later.'
36
+ s.require_path = 'lib'
37
+
38
+ s.add_dependency 'commonwatir', '= ' + version
39
+ s.add_dependency 'activesupport', '=2.3.9'
40
+
41
+ s.has_rdoc = true
42
+ s.rdoc_options <<
43
+ '--title' << 'FireWatir API Reference' <<
44
+ '--accessor' << 'def_wrap=R,def_wrap_guard=R,def_creator=R,def_creator_with_default=R' <<
45
+ '--exclude' << 'unittests|camel_case.rb|testUnitAddons.rb'
46
+
47
+ # s.test_file = 'unittests/mozilla_all_tests.rb'
48
+
49
+ s.files = $__firewatir_source_patterns.inject([]) { |list, glob|
50
+ list << Dir[glob].delete_if { |path|
51
+ File.directory?(path) or
52
+ path.include?('CVS')
53
+ }
54
+ }.flatten
55
+
56
+ end
@@ -470,17 +470,19 @@ module FireWatir
470
470
  # Output:
471
471
  # Prints all the available elements on the page.
472
472
  #
473
- def show_all_objects
474
- puts "-----------Objects in the current context-------------"
473
+ def show_all_objects(output = true)
475
474
  locate if respond_to?(:locate)
476
475
  elements = Document.new(self).all
477
- puts elements.length
478
- elements.each do |n|
479
- puts n.tagName
480
- puts n.to_s
481
- puts "------------------------------------------"
476
+ if output
477
+ puts "-----------Objects in the current context-------------"
478
+ puts elements.length
479
+ elements.each do |n|
480
+ puts n.tagName
481
+ puts n.to_s
482
+ puts "------------------------------------------"
483
+ end
484
+ puts "Total number of objects in the current context : #{elements.length}"
482
485
  end
483
- puts "Total number of objects in the current context : #{elements.length}"
484
486
  return elements
485
487
  # Test the index access.
486
488
  # puts doc[35].to_s
data/rakefile.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
  require 'rake/clean'
4
+ require 'rake/testtask'
4
5
  require 'rake/gempackagetask'
5
6
 
6
7
  task :default => :package
@@ -13,3 +14,8 @@ Rake::GemPackageTask.new(gemspec) do |p|
13
14
  p.need_tar = false
14
15
  p.need_zip = false
15
16
  end
17
+
18
+ Rake::TestTask.new do |t|
19
+ t.test_files = FileList['unittests/mozilla_all_tests.rb']
20
+ t.verbose = true
21
+ end
@@ -149,7 +149,7 @@ class TC_Bugs< Test::Unit::TestCase
149
149
  def test_file_field_bug_20
150
150
  goto_page("fileupload.html")
151
151
  # Enter dummy path.
152
- if(RUBY_PLATFORM =~ /.*mswin.*/)
152
+ if(RUBY_PLATFORM =~ /mswin|msys|mingw32/)
153
153
  browser.file_field(:name, "file3").set("c:\\results.txt")
154
154
  else
155
155
  browser.file_field(:name, "file3").set("/user/lib/results.txt")
@@ -24,8 +24,8 @@ class TC_Divs < Test::Unit::TestCase
24
24
 
25
25
  tag_method :test_show_all_objects, :fails_on_ie
26
26
  def test_show_all_objects
27
- assert_equal(36, browser.show_all_objects.length)
28
- assert_equal(3,browser.div(:id,"text_fields1").show_all_objects.length)
27
+ assert_equal(36, browser.show_all_objects(false).length)
28
+ assert_equal(3,browser.div(:id,"text_fields1").show_all_objects(false).length)
29
29
 
30
30
  assert_equal(8,browser.text_fields.length)
31
31
  assert_equal(3,browser.div(:id,"text_fields1").text_fields.length)
@@ -122,8 +122,8 @@ class TC_Images < Test::Unit::TestCase
122
122
  assert_equal('square_image', browser.image(:id, 'square').title)
123
123
 
124
124
  # to string tests -- output should be verified!
125
- puts browser.image(:name , "circle").to_s
126
- puts browser.image(:index , 2).to_s
125
+ assert_equal("name: circle\ntype: \nid: \nvalue: \ndisabled: \nsrc: images/circle.jpg\nheight: 106\nalt: \nwidth: 106", browser.image(:name, "circle").to_s)
126
+ assert_equal("name: \ntype: \nid: square\nvalue: \ndisabled: \nsrc: images/square.jpg\nheight: 88\nalt: \nwidth: 88", browser.image(:index , 2).to_s)
127
127
  end
128
128
 
129
129
  def test_image_iterator
@@ -111,7 +111,7 @@ class TC_Images_XPath < Test::Unit::TestCase
111
111
  #assert_raises(UnknownObjectException ) { browser.image(:xpath , "//img[@src='no_image_with_this']").hasLoaded? }
112
112
 
113
113
  # to string tests -- output should be verified!
114
- puts browser.image(:xpath , "//img[@name='circle']").to_s
114
+ assert_equal("name: circle\ntype: \nid: \nvalue: \ndisabled: \nsrc: images/circle.jpg\nheight: 106\nalt: \nwidth: 106", browser.image(:xpath , "//img[@name='circle']").to_s)
115
115
  end
116
116
 
117
117
  end
@@ -137,7 +137,7 @@ class TC_Links < Test::Unit::TestCase
137
137
  assert_nothing_raised {browser.link(:text, 'Create').exists? }
138
138
  end
139
139
  def test_link_to_s
140
- puts browser.link(:id,"linktos").to_s
140
+ assert_equal("name: \ntype: \nid: linktos\nvalue: \ndisabled: \nhref: link_pass.html\ninner text: to string test", browser.link(:id,"linktos").to_s)
141
141
  end
142
142
  end
143
143
 
@@ -45,7 +45,6 @@ class TC_Radios_XPath < Test::Unit::TestCase
45
45
  def test_Radio_isSet
46
46
  assert_raises(UnknownObjectException) { browser.radio(:xpath, "//input[@name='noName']").isSet? }
47
47
 
48
- puts "radio 1 is set : #{ browser.radio(:xpath, "//input[@name='box1']").isSet? } "
49
48
  assert_false(browser.radio(:xpath, "//input[@name='box1']").isSet?)
50
49
 
51
50
  assert(browser.radio(:xpath, "//input[@name='box3']").isSet?)
@@ -119,8 +119,16 @@ class TC_SelectList < Test::Unit::TestCase
119
119
  index+=1
120
120
  end
121
121
  assert_equal( index-1, browser.select_lists.length)
122
- # Bug Fix 25
123
- browser.select_lists.each { |list| puts list.getAllContents() }
122
+ # Bug Fix 25
123
+ values = [
124
+ ["Option 1", "Option 2", "Option 3", "Option 4"],
125
+ ["Option 1", "Option 2", "Option 3", "Option 4", "Option 5", "Option 6"],
126
+ ["Option 1", "Option 2", "Option 3", "Option 4"],
127
+ ["Option 1", "Option 2"],
128
+ ["Option 1", "Option 2"]]
129
+ browser.select_lists.each_with_index do |list, index|
130
+ assert_equal(values[index], list.getAllContents())
131
+ end
124
132
  end
125
133
  end
126
134
 
data/unittests/setup.rb CHANGED
@@ -5,12 +5,13 @@ $myDir = File.expand_path(File.dirname(__FILE__))
5
5
  topdir = File.join(File.dirname(__FILE__), '..')
6
6
  $firewatir_dev_lib = File.join(topdir, 'lib')
7
7
  $watir_dev_lib = File.join(topdir, '..', 'watir', 'lib')
8
+ commonwatir_dir = "commonwatir-#{File.read("VERSION").strip}" rescue "commonwatir"
8
9
  libs = []
9
- libs << File.join(topdir, '..', 'commonwatir', 'lib')
10
- libs << File.join(topdir, '..', 'commonwatir') # for the unit tests
10
+ libs << File.join(topdir, '..', commonwatir_dir, 'lib')
11
+ libs << File.join(topdir, '..', commonwatir_dir) # for the unit tests
11
12
  libs.each { |lib| $LOAD_PATH.unshift File.expand_path(lib) }
12
13
 
13
- require 'watir'
14
+ require 'watir/browser'
14
15
  Watir::Browser.default = 'firefox'
15
16
  require 'unittests/setup/lib'
16
17
  module Watir::UnitTest
@@ -19,7 +20,7 @@ end
19
20
 
20
21
  require 'unittests/setup/testUnitAddons'
21
22
 
22
- commondir = File.join(topdir, '..', 'commonwatir')
23
+ commondir = File.join(topdir, '..', commonwatir_dir)
23
24
  $all_tests = []
24
25
  Dir.chdir topdir do
25
26
  $all_tests += Dir["unittests/*_test.rb"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firewatir
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940598
4
+ hash: 977940599
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 6
9
9
  - 6
10
- - rc1
11
- version: 1.6.6.rc1
10
+ - rc2
11
+ version: 1.6.6.rc2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Angrez Singh
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-09-24 00:00:00 -06:00
19
+ date: 2010-09-30 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
@@ -27,13 +27,13 @@ dependencies:
27
27
  requirements:
28
28
  - - "="
29
29
  - !ruby/object:Gem::Version
30
- hash: 977940598
30
+ hash: 977940599
31
31
  segments:
32
32
  - 1
33
33
  - 6
34
34
  - 6
35
- - rc1
36
- version: 1.6.6.rc1
35
+ - rc2
36
+ version: 1.6.6.rc2
37
37
  type: :runtime
38
38
  version_requirements: *id001
39
39
  - !ruby/object:Gem::Dependency
@@ -178,9 +178,9 @@ files:
178
178
  - unittests/html/images/triangle.jpg
179
179
  - LICENSE
180
180
  - CHANGES
181
- - README.rdoc
182
181
  - rakefile.rb
183
182
  - VERSION
183
+ - firewatir.gemspec
184
184
  has_rdoc: true
185
185
  homepage: http://www.watir.com
186
186
  licenses: []
data/README.rdoc DELETED
@@ -1,112 +0,0 @@
1
- = FireWatir
2
- This is FireWatir, Web Application Testing In Ruby using Firefox browser
3
-
4
- Project Home:: http://www.watir.com
5
- Gem:: http://gemcutter.org/gems/firewatir
6
- Source Code:: http://github.com/bret/watir
7
- General Usage Discussions:: http://groups.google.com/group/watir-general
8
- Development Discussions:: http://rubyforge.org/mailman/listinfo/wtr-development
9
- Bugs, Issues, Roadmap:: http://jira.openqa.org/browse/WTR
10
-
11
- == DESCRIPTION
12
-
13
- Firewatir is part of Watir project, a family of open-source drivers for automating web browsers.
14
- For other browsers please see www.watir.com
15
-
16
- == EXAMPLES
17
- * http://watir.com/examples
18
-
19
- Start new Firefox browser driver
20
-
21
- # using Watir::Browser interface
22
- require 'watir'
23
- Watir::Browser.default = 'firefox'
24
- browser = Watir::Browser.new
25
-
26
- # or using Firewatir library directly
27
- require 'firewatir'
28
- browser = FireWatir::Firefox.new
29
-
30
- Typical usage
31
-
32
- require "firewatir"
33
- # go to the page you want to test
34
- ff = FireWatir::Firefox.start("http://myserver/mypage")
35
-
36
- # enter "Angrez" into an input field named "username"
37
- ff.text_field(:name, "username").set("Angrez")
38
-
39
- # enter "Ruby Co" into input field with id "company_ID"
40
- ff.text_field(:id, "company_ID").set("Ruby Co")
41
-
42
- # click on a link that has "green" somewhere in the text that is displayed
43
- # to the user, using a regular expression
44
- ff.link(:text, /green/)
45
-
46
- # click button that has a caption of "Cancel"
47
- ff.button(:value, "Cancel").click
48
-
49
- == FEATURES
50
-
51
- FireWatir allows your script to read and interact with HTML objects--HTML tags and their attributes and contents.
52
- Types of objects that FireWatir can identify include:
53
-
54
- Type Description
55
- =========== ===============================================================
56
- button <tt><input></tt> tags, with the type="button" attribute
57
- check_box <tt><input></tt> tags, with the type="checkbox" attribute
58
- div <tt><div></tt> tags
59
- form
60
- frame
61
- hidden hidden <tt><input></tt> tags
62
- image <tt><img></tt> tags
63
- label
64
- link <tt><a></tt> (anchor) tags
65
- p <tt><p></tt> (paragraph) tags
66
- radio radio buttons; <tt><input></tt> tags, with the type="radio" attribute
67
- select_list <tt><select></tt> tags, known informally as drop-down boxes
68
- span <tt><span></tt> tags
69
- table <tt><table></tt> tags
70
- text_field <tt><input></tt> tags with the type="text" attribute (a single-line
71
- text field), the type="text_area" attribute (a multi-line
72
- text field), and the type="password" attribute (a
73
- single-line field in which the input is replaced with asterisks)
74
-
75
- In general, there are several ways to identify a specific object. FireWatir's
76
- syntax is in the form (how, what), where "how" is a means of identifying
77
- the object, and "what" is the specific string or regular expression
78
- that FireWatir will seek, as shown in the examples above. Available "how"
79
- options depend upon the type of object, but here are a few examples:
80
-
81
- How Description
82
- ============ ===============================================================
83
- :id Used to find an object that has an "id=" attribute. Since each
84
- id should be unique, according to the XHTML specification,
85
- this is recommended as the most reliable method to find an
86
- object.
87
- :name Used to find an object that has a "name=" attribute. This is
88
- useful for older versions of HTML, but "name" is deprecated
89
- in XHTML.
90
- :value Used to find a text field with a given default value, or a
91
- button with a given caption
92
- :index Used to find the nth object of the specified type on a page.
93
- For example, button(:index, 2) finds the second button.
94
- Current versions of FireWatir use 1-based indexing, but future
95
- versions will use 0-based indexing.
96
- :xpath The xpath expression for identifying the element.
97
-
98
- Note that the XHTML specification requires that tags and their attributes be
99
- in lower case. FireWatir doesn't enforce this; FireWatir will find tags and
100
- attributes whether they're in upper, lower, or mixed case. This is either
101
- a bug or a feature.
102
-
103
-
104
- == INSTALL
105
- * http://wiki.openqa.org/display/WTR/FireWatir+Installation
106
-
107
- Firewatir gen is normally installed during watir gem installation
108
- however you need to install Jssh to communicate with Firefox.
109
-
110
- [sudo] gem install firewatir
111
-
112
-