bret-watircraft 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/BUGS.txt CHANGED
@@ -1,9 +1,6 @@
1
1
  Known Bugs
2
2
 
3
3
  * Can't install on mac. (This used to work.)
4
- * The name of the element underlying each field is not consistent. In pages,
5
- it is called foo_field; in tables, foo_element. (Should probably be
6
- foo_element in both places.)
7
4
  * Page fields do not support Radio lists. Workaround: use elements.
8
- * Need to provide homepage for project.
5
+
9
6
 
data/History.txt CHANGED
@@ -1,3 +1,28 @@
1
+ === 0.4.3 / 2009-03-31
2
+
3
+ Bug Fixes
4
+
5
+ * WatirCraft can now be installed on a Mac (again).
6
+ * Page#url now returns the full url of the page.
7
+
8
+ Table Fixes
9
+
10
+ * Field elements/fields can now reference current row as "row", consistent
11
+ with page elements/fields being referencing browser as "browser".
12
+ (Previously you had to use @row, which still works.)
13
+ * Element names of table fields are now named x_field, consistent with page
14
+ fields. (Previously was x_element.)
15
+ * Fields that aren't found for some rows will no longer cause errors
16
+ when used as accessors.
17
+
18
+ Readme Updates
19
+
20
+ * Update install instructions.
21
+ * Add Google example.
22
+ * Update feature list.
23
+ * Add additional information (feedback, mailing list, WatirCraft LLC)
24
+ * Identify Github/readme as homepage for project.
25
+
1
26
  === 0.4.2 / 2009-03-24
2
27
 
3
28
  * Fixed "can't find site generator" bug that occured when creating a new project.
data/README.rdoc CHANGED
@@ -14,7 +14,10 @@ a place to put things.
14
14
  * Generates a directory structure for your test suite with one command.
15
15
  * Provides page adapters you can customize for your application.
16
16
  * Configure application URL and browser type (IE, Firefox) in one location.
17
- * Framework automatically initializes browser for testing.
17
+ * Uses templates to create tests and libraries.
18
+ * Automatically initializes browser for testing.
19
+ * Provides the glue to ensure your tests can find your libraries. Don't
20
+ write another "require" statement again.
18
21
 
19
22
  == APPROACH
20
23
 
@@ -30,19 +33,111 @@ get the benefit.
30
33
 
31
34
  == INSTALL
32
35
 
33
- gem update --system
34
- gem install watircraft
36
+ Run the following if you haven't already:
37
+
38
+ > gem update --system
39
+ > gem sources -a http://gems.github.com
40
+
41
+ Install the gem:
42
+
43
+ > gem install bret-watircraft
44
+
45
+ See the History.txt file for detailed notes on the contents of each release.
46
+
47
+ == GETTING STARTED
48
+
49
+ Use the +watircraft+ command to create your project. Your project will contain
50
+ your tests, your libraries, your configuration files, and all the glue code
51
+ necessary to allow it all to work together. Let's create a project for
52
+ testing Google.
53
+
54
+ > watircraft google
55
+
56
+ This will create a directory called "google" and populate it with a bunch of
57
+ directories and files.
58
+
59
+ You'll need to edit the <tt>config\environments.yml</tt> file to point to you base
60
+ url of your project.
61
+
62
+ test:
63
+ url: http://google.com
64
+
65
+ By default, your tests will run in the "test" environment, but you can specify
66
+ additional environments later. When you run your tests, you can specify which environment
67
+ to use on the command line.
68
+
69
+ Use the <tt>script\generate</tt> command to populate your project with project files.
70
+ This command must be run from the top of your project.
71
+
72
+ > cd google
73
+
74
+ Create a test. WatirCraft uses the RSpec test harness and therefore calls a
75
+ test a "spec".
76
+
77
+ > script\generate spec search
78
+
79
+ This creates a bare template for a test. Edit the file that was just created
80
+ (<tt>test/specs/search_spec.rb</tt>) and add the following
81
+ lines.
82
+
83
+ browser.text_field(:name, 'q').set 'WatirCraft'
84
+ browser.button(:name, 'btnG').click
85
+ browser.text.should include('Test automation for web applications')
86
+
87
+ The WatirCraft framework will automatically start the browser at the
88
+ configured url when you run it.
89
+
90
+ After you have added these lines to the template, the complete file will
91
+ look like this.
92
+
93
+ $LOAD_PATH.unshift File.dirname(__FILE__) unless
94
+ $LOAD_PATH.include? File.dirname(__FILE__)
95
+ require 'spec_helper'
96
+
97
+ describe "Search" do
98
+
99
+ it "should find WatirCraft" do
100
+ browser.text_field(:name, 'q').set 'WatirCraft'
101
+ browser.button(:name, 'btnG').click
102
+ browser.text.should include('Test automation for web applications')
103
+ end
104
+
105
+ end
106
+
107
+ Use the +rake+ command to run the tests for your project(only one so far).
108
+ This needs to be run from the base of your project.
109
+
110
+ > rake spec
111
+
112
+ By default, your test runs with Internet Explorer, but you can also run it
113
+ with Firefox.
114
+
115
+ > rake spec BROWSER=firefox
116
+
117
+ You can also just run individual files.
118
+
119
+ > ruby test/specs/search_spec.rb
120
+
121
+ Note that many editors will do this automatically for you. For example the
122
+ Scite editor will do this when you hit "F5".
35
123
 
36
124
  == EXAMPLE
37
125
 
38
126
  An example test suite for this framework can be found in the framework
39
- examples project on github. Look in the watircraft directory.
40
- * http://github.com/bret/framework-examples/
127
+ examples project on github. Look in the +watircraft+ directory.
128
+ * http://github.com/bret/framework-examples
129
+
130
+ == QUESTIONS AND FEEDBACK
131
+
132
+ Join our mailing list for WatirCraft users.
133
+ * http://tech.groups.yahoo.com/group/watir-framework
41
134
 
42
- == ORIGIN
135
+ The WatirCraft framework is developed by WatirCraft LLC, based on Taza[http://github.com/scudco/taza/wikis].
136
+ Please send bug reports, feature requests and other comments to us at feedback@watircraft.com[mailto:feedback@watircraft.com]
43
137
 
44
- WatirCraft is based on the Taza framework.
45
- * http://github.com/scudco/taza/wikis
138
+ WatirCraft LLC provides training and consulting for Watir, Ruby and the
139
+ WatirCraft framework.
140
+ * http://www.watircraft.com
46
141
 
47
142
  == LICENSE
48
143
 
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :minor: 4
3
- :patch: 2
2
+ :patch: 3
4
3
  :major: 0
4
+ :minor: 4
@@ -1,6 +1,7 @@
1
1
  # This file is autogenerated. Do not edit this file.
2
2
  # It may be replaced when you upgrade to new versions of watircraft.
3
3
 
4
+ require 'rubygems'
4
5
  require 'spec'
5
6
  require 'cucumber'
6
7
 
data/lib/taza/page.rb CHANGED
@@ -197,6 +197,7 @@ module Taza
197
197
  def full_url
198
198
  File.join(@site.origin, self.class.url)
199
199
  end
200
+ alias :url :full_url
200
201
 
201
202
  # Enter values into fields on the page using a hash, using the key of
202
203
  # each pair to name the field.
@@ -19,8 +19,9 @@ module WatirCraft
19
19
  wrapped = self.class.row_class.new row
20
20
  # note: we are only looking at the first key/value
21
21
  method = selector.keys[0]
22
- value = selector[method]
23
- return wrapped if wrapped.send(method) == value
22
+ target_value = selector[method]
23
+ row_value = wrapped.send(method) rescue next
24
+ return wrapped if row_value == target_value
24
25
  end
25
26
  nil
26
27
  end
@@ -34,7 +35,7 @@ module WatirCraft
34
35
  end
35
36
  end
36
37
  def field name, &block
37
- element_name = "#{name}_element"
38
+ element_name = "#{name}_field"
38
39
  element element_name, &block
39
40
  define_method(name) do
40
41
  send(element_name).display_value
@@ -44,6 +45,7 @@ module WatirCraft
44
45
  end
45
46
  end
46
47
  end
48
+ attr_reader :row
47
49
  def initialize watir_row
48
50
  @row = watir_row
49
51
  end
@@ -1,3 +1,3 @@
1
1
  # This file is autogenerated. Do not edit.
2
2
  # Use 'rake version.rb' to update.
3
- module WatirCraft; VERSION = '0.4.2'; end
3
+ module WatirCraft; VERSION = '0.4.3'; end
data/spec/page_spec.rb CHANGED
@@ -119,6 +119,7 @@ describe Taza::Page do
119
119
  page = CheckOutPage.new
120
120
  page.site = Class.new(Taza::Site).new(:browser => browser)
121
121
  page.full_url.should == 'http://www.llamas.com/check_out'
122
+ page.url.should == page.full_url
122
123
  end
123
124
 
124
125
  it "should create elements for fields" do
@@ -289,8 +290,9 @@ describe Taza::Page do
289
290
  @page_class.class_eval do
290
291
  element(:results_table) {fake_table}
291
292
  table(:results) do
292
- field(:name){@row.element(:letter)}
293
- field(:phone){@row.element(:number)}
293
+ field(:name){row.element(:letter)}
294
+ field(:phone){row.element(:number)}
295
+ field(:missing){raise 'not found'}
294
296
  end
295
297
  end
296
298
  @table_page = @page_class.new
@@ -305,7 +307,7 @@ describe Taza::Page do
305
307
 
306
308
  it "fields should have underlying elements" do
307
309
  uses_table_page
308
- @table_page.results.row(:name => 'x').phone_element.should exist
310
+ @table_page.results.row(:name => 'x').phone_field.should exist
309
311
  end
310
312
 
311
313
  it "should have elements" do
@@ -316,8 +318,8 @@ describe Taza::Page do
316
318
  ]
317
319
  end
318
320
  table(:results) do
319
- field(:name){@row.element(:letter)}
320
- element(:phone){@row.element(:number)}
321
+ field(:name){row.element(:letter)}
322
+ element(:phone){row.element(:number)}
321
323
  end
322
324
  end
323
325
  @table_page = @page_class.new
@@ -335,7 +337,10 @@ describe Taza::Page do
335
337
  @table_page.results.row(:name => 'x').should exist
336
338
  end
337
339
 
338
-
340
+ it "should not raise an exception if a field isn't found" do
341
+ uses_table_page
342
+ @table_page.results.row(:missing => 'nada').should be_nil
343
+ end
339
344
 
340
345
  end
341
346
 
data/spec/watir_spec.rb CHANGED
@@ -1,36 +1,39 @@
1
- require 'spec/spec_helper'
2
- require 'watir'
3
- require 'watir/ie'
4
- require 'firewatir'
5
- require 'extensions/watir'
6
-
7
- describe 'Watir Extensions' do
8
- share_examples_for 'extended watir' do
9
- def should_provide_display_value_method_for_class klass
10
- container = stub()
11
- container.stubs(:page_container)
12
- element = klass.new container, :index, 1
13
- element.method(:display_value) # should be defined
14
- end
15
-
16
- specify { should_provide_display_value_method_for_class @module::TextField }
17
- specify { should_provide_display_value_method_for_class @module::NonControlElement}
18
- specify { should_provide_display_value_method_for_class @module::H3 }
19
- end
20
-
21
- describe "IE Watir" do
22
- it_should_behave_like 'extended watir'
23
- Watir.add_display_value_methods_to Watir
24
- before do
25
- @module = Watir
26
- end
27
- end
28
-
29
- describe "Fire Watir" do
30
- it_should_behave_like 'extended watir'
31
- Watir.add_display_value_methods_to FireWatir
32
- before do
33
- @module = FireWatir
34
- end
35
- end
36
- end
1
+
2
+ require 'spec/spec_helper'
3
+ require 'watir'
4
+ require 'firewatir'
5
+ require 'extensions/watir'
6
+
7
+ describe 'Watir Extensions' do
8
+ share_examples_for 'extended watir' do
9
+ def should_provide_display_value_method_for_class klass
10
+ container = stub()
11
+ container.stubs(:page_container)
12
+ element = klass.new container, :index, 1
13
+ element.method(:display_value) # should be defined
14
+ end
15
+
16
+ specify { should_provide_display_value_method_for_class @module::TextField }
17
+ specify { should_provide_display_value_method_for_class @module::NonControlElement}
18
+ specify { should_provide_display_value_method_for_class @module::H3 }
19
+ end
20
+
21
+ if PLATFORM =~ /mswin/
22
+ describe "IE Watir" do
23
+ require 'watir/ie'
24
+ it_should_behave_like 'extended watir'
25
+ Watir.add_display_value_methods_to Watir
26
+ before do
27
+ @module = Watir
28
+ end
29
+ end
30
+ end
31
+
32
+ describe "Fire Watir" do
33
+ it_should_behave_like 'extended watir'
34
+ Watir.add_display_value_methods_to FireWatir
35
+ before do
36
+ @module = FireWatir
37
+ end
38
+ end
39
+ end
data/watircraft.gemspec CHANGED
@@ -2,30 +2,30 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{watircraft}
5
- s.version = "0.4.2"
5
+ s.version = "0.4.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Bret Pettichord", "Jim Matthews", "Charley Baker", "Adam Anderson"]
9
- s.date = %q{2009-03-24}
9
+ s.date = %q{2009-03-31}
10
10
  s.default_executable = %q{watircraft}
11
- s.description = %q{WatirCraft is a framework for web testing.}
11
+ s.description = %q{WatirCraft is a framework for testing web apps.}
12
12
  s.email = %q{bret@pettichord.com}
13
13
  s.executables = ["watircraft"]
14
14
  s.extra_rdoc_files = ["History.txt", "README.rdoc"]
15
15
  s.files = ["BUGS.txt", "History.txt", "Manifest.txt", "README.rdoc", "VERSION.yml", "watircraft.gemspec", "bin/watircraft", "lib/extensions", "lib/extensions/array.rb", "lib/extensions/hash.rb", "lib/extensions/object.rb", "lib/extensions/string.rb", "lib/extensions/watir.rb", "lib/taza", "lib/taza/browser.rb", "lib/taza/entity.rb", "lib/taza/fixture.rb", "lib/taza/flow.rb", "lib/taza/page.rb", "lib/taza/settings.rb", "lib/taza/site.rb", "lib/taza/tasks.rb", "lib/taza.rb", "lib/watircraft", "lib/watircraft/generator_helper.rb", "lib/watircraft/table.rb", "lib/watircraft/version.rb", "lib/watircraft.rb", "spec/array_spec.rb", "spec/browser_spec.rb", "spec/entity_spec.rb", "spec/fake_table.rb", "spec/fixtures_spec.rb", "spec/fixture_spec.rb", "spec/hash_spec.rb", "spec/object_spec.rb", "spec/page_generator_spec.rb", "spec/page_spec.rb", "spec/project_generator_spec.rb", "spec/sandbox", "spec/sandbox/config", "spec/sandbox/config/config.yml", "spec/sandbox/config/environments.yml", "spec/sandbox/config/simpler.yml", "spec/sandbox/config/simpler_site.yml", "spec/sandbox/config.yml", "spec/sandbox/fixtures", "spec/sandbox/fixtures/examples.yml", "spec/sandbox/fixtures/users.yml", "spec/sandbox/flows", "spec/sandbox/flows/batman.rb", "spec/sandbox/flows/robin.rb", "spec/sandbox/pages", "spec/sandbox/pages/foo", "spec/sandbox/pages/foo/bar_page.rb", "spec/sandbox/pages/foo/partials", "spec/sandbox/pages/foo/partials/partial_the_reckoning.rb", "spec/settings_spec.rb", "spec/site_spec.rb", "spec/spec_generator_helper.rb", "spec/spec_generator_spec.rb", "spec/spec_helper.rb", "spec/steps_generator_spec.rb", "spec/string_spec.rb", "spec/table_spec.rb", "spec/taza_spec.rb", "spec/watircraft_bin_spec.rb", "spec/watir_spec.rb", "app_generators/watircraft", "app_generators/watircraft/templates", "app_generators/watircraft/templates/config.yml.erb", "app_generators/watircraft/templates/environments.yml.erb", "app_generators/watircraft/templates/feature_helper.rb", "app_generators/watircraft/templates/initialize.rb.erb", "app_generators/watircraft/templates/rakefile.rb", "app_generators/watircraft/templates/script", "app_generators/watircraft/templates/script/console", "app_generators/watircraft/templates/script/console.cmd", "app_generators/watircraft/templates/site.rb.erb", "app_generators/watircraft/templates/site_start.rb.erb", "app_generators/watircraft/templates/spec_helper.rb", "app_generators/watircraft/templates/spec_initialize.rb", "app_generators/watircraft/templates/world.rb", "app_generators/watircraft/USAGE", "app_generators/watircraft/watircraft_generator.rb", "watircraft_generators/page", "watircraft_generators/page/page_generator.rb", "watircraft_generators/page/templates", "watircraft_generators/page/templates/page.rb.erb", "watircraft_generators/page/USAGE", "watircraft_generators/spec", "watircraft_generators/spec/spec_generator.rb", "watircraft_generators/spec/templates", "watircraft_generators/spec/templates/spec.rb.erb", "watircraft_generators/spec/USAGE", "watircraft_generators/steps", "watircraft_generators/steps/steps_generator.rb", "watircraft_generators/steps/templates", "watircraft_generators/steps/templates/steps.rb.erb", "watircraft_generators/steps/USAGE"]
16
16
  s.has_rdoc = true
17
+ s.homepage = %q{http://github.com/bret/watircraft/tree/master}
17
18
  s.rdoc_options = ["--main", "README.rdoc"]
18
19
  s.require_paths = ["lib"]
19
20
  s.rubyforge_project = %q{watir}
20
21
  s.rubygems_version = %q{1.3.1}
21
- s.summary = %q{WatirCraft is a framework for web testing.}
22
+ s.summary = %q{WatirCraft is a framework for testing web apps.}
22
23
 
23
24
  if s.respond_to? :specification_version then
24
25
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
26
  s.specification_version = 2
26
27
 
27
28
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
- s.add_runtime_dependency(%q<watir>, [">= 1.6.2"])
29
29
  s.add_runtime_dependency(%q<taglob>, [">= 1.1.1"])
30
30
  s.add_runtime_dependency(%q<rake>, [">= 0.8.3"])
31
31
  s.add_runtime_dependency(%q<mocha>, [">= 0.9.3"])
@@ -33,7 +33,6 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency(%q<rspec>, ["= 1.1.12"])
34
34
  s.add_runtime_dependency(%q<cucumber>, ["= 0.1.16"])
35
35
  else
36
- s.add_dependency(%q<watir>, [">= 1.6.2"])
37
36
  s.add_dependency(%q<taglob>, [">= 1.1.1"])
38
37
  s.add_dependency(%q<rake>, [">= 0.8.3"])
39
38
  s.add_dependency(%q<mocha>, [">= 0.9.3"])
@@ -42,7 +41,6 @@ Gem::Specification.new do |s|
42
41
  s.add_dependency(%q<cucumber>, ["= 0.1.16"])
43
42
  end
44
43
  else
45
- s.add_dependency(%q<watir>, [">= 1.6.2"])
46
44
  s.add_dependency(%q<taglob>, [">= 1.1.1"])
47
45
  s.add_dependency(%q<rake>, [">= 0.8.3"])
48
46
  s.add_dependency(%q<mocha>, [">= 0.9.3"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bret-watircraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bret Pettichord
@@ -12,19 +12,9 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2009-03-24 00:00:00 -07:00
15
+ date: 2009-03-31 00:00:00 -07:00
16
16
  default_executable: watircraft
17
17
  dependencies:
18
- - !ruby/object:Gem::Dependency
19
- name: watir
20
- type: :runtime
21
- version_requirement:
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: 1.6.2
27
- version:
28
18
  - !ruby/object:Gem::Dependency
29
19
  name: taglob
30
20
  type: :runtime
@@ -85,7 +75,7 @@ dependencies:
85
75
  - !ruby/object:Gem::Version
86
76
  version: 0.1.16
87
77
  version:
88
- description: WatirCraft is a framework for web testing.
78
+ description: WatirCraft is a framework for testing web apps.
89
79
  email: bret@pettichord.com
90
80
  executables:
91
81
  - watircraft
@@ -196,7 +186,7 @@ files:
196
186
  - watircraft_generators/steps/templates/steps.rb.erb
197
187
  - watircraft_generators/steps/USAGE
198
188
  has_rdoc: true
199
- homepage:
189
+ homepage: http://github.com/bret/watircraft/tree/master
200
190
  post_install_message:
201
191
  rdoc_options:
202
192
  - --main
@@ -221,6 +211,6 @@ rubyforge_project: watir
221
211
  rubygems_version: 1.2.0
222
212
  signing_key:
223
213
  specification_version: 2
224
- summary: WatirCraft is a framework for web testing.
214
+ summary: WatirCraft is a framework for testing web apps.
225
215
  test_files: []
226
216