scudco-taza 0.8.1

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.
Files changed (63) hide show
  1. data/History.txt +44 -0
  2. data/Manifest.txt +61 -0
  3. data/README +79 -0
  4. data/README.textile +1 -0
  5. data/VERSION.yml +4 -0
  6. data/bin/taza +17 -0
  7. data/generators/flow/flow_generator.rb +57 -0
  8. data/generators/flow/templates/flow.rb.erb +9 -0
  9. data/generators/page/page_generator.rb +58 -0
  10. data/generators/page/templates/functional_page_spec.rb.erb +8 -0
  11. data/generators/page/templates/page.rb.erb +8 -0
  12. data/generators/partial/partial_generator.rb +57 -0
  13. data/generators/partial/templates/partial.rb.erb +7 -0
  14. data/generators/site/site_generator.rb +56 -0
  15. data/generators/site/templates/site.rb.erb +10 -0
  16. data/generators/site/templates/site.yml.erb +3 -0
  17. data/lib/app_generators/taza/taza_generator.rb +72 -0
  18. data/lib/app_generators/taza/templates/config.yml.erb +3 -0
  19. data/lib/app_generators/taza/templates/rakefile.rb.erb +3 -0
  20. data/lib/app_generators/taza/templates/spec_helper.rb.erb +11 -0
  21. data/lib/extensions/array.rb +10 -0
  22. data/lib/extensions/hash.rb +5 -0
  23. data/lib/extensions/object.rb +24 -0
  24. data/lib/extensions/string.rb +11 -0
  25. data/lib/taza/browser.rb +33 -0
  26. data/lib/taza/entity.rb +34 -0
  27. data/lib/taza/fixture.rb +66 -0
  28. data/lib/taza/flow.rb +40 -0
  29. data/lib/taza/page.rb +95 -0
  30. data/lib/taza/settings.rb +47 -0
  31. data/lib/taza/site.rb +145 -0
  32. data/lib/taza/tasks.rb +50 -0
  33. data/lib/taza.rb +35 -0
  34. data/spec/array_spec.rb +16 -0
  35. data/spec/browser_spec.rb +63 -0
  36. data/spec/entity_spec.rb +9 -0
  37. data/spec/fixture_spec.rb +34 -0
  38. data/spec/fixtures_spec.rb +21 -0
  39. data/spec/flow_generator_spec.rb +50 -0
  40. data/spec/hash_spec.rb +12 -0
  41. data/spec/object_spec.rb +29 -0
  42. data/spec/page_generator_spec.rb +56 -0
  43. data/spec/page_spec.rb +82 -0
  44. data/spec/partial_generator_spec.rb +38 -0
  45. data/spec/project_generator_spec.rb +41 -0
  46. data/spec/sandbox/config/config.yml +1 -0
  47. data/spec/sandbox/config/site_name.yml +5 -0
  48. data/spec/sandbox/config.yml +3 -0
  49. data/spec/sandbox/fixtures/examples.yml +8 -0
  50. data/spec/sandbox/fixtures/users.yml +2 -0
  51. data/spec/sandbox/flows/batman.rb +5 -0
  52. data/spec/sandbox/flows/robin.rb +4 -0
  53. data/spec/sandbox/pages/foo/bar.rb +9 -0
  54. data/spec/sandbox/pages/foo/partials/partial_the_reckoning.rb +2 -0
  55. data/spec/settings_spec.rb +88 -0
  56. data/spec/site_generator_spec.rb +57 -0
  57. data/spec/site_spec.rb +229 -0
  58. data/spec/spec_helper.rb +57 -0
  59. data/spec/string_spec.rb +7 -0
  60. data/spec/taza_bin_spec.rb +14 -0
  61. data/spec/taza_spec.rb +12 -0
  62. data/spec/taza_tasks_spec.rb +41 -0
  63. metadata +181 -0
data/History.txt ADDED
@@ -0,0 +1,44 @@
1
+ === 0.8.1 / 2008-12-20
2
+
3
+ * Added Partials
4
+ * Added Preliminary Fixture Support
5
+
6
+ === 0.8.0 / 2008-11-23
7
+
8
+ Taza is a web application testing framework meant to be used with browsed-based testing libraries like WATIR or Selenium
9
+
10
+ Not all web applications can be written in Ruby, unfortunately. When you aren't testing an application that was written with testing in mind Taza can provide a structured and opionated way to do browser-based testing.
11
+
12
+ * Sites have Pages
13
+ * Sites have Flows that move through Pages
14
+ * Pages have elements and filters to define simple ways of interacting with them
15
+ * Pages have tests/specs that help chip away at the dreaded 0% Coverage Beastâ„¢
16
+
17
+ * Features
18
+ * Generate a Taza project easily
19
+ * Generate Sites, Pages, and Flows using a familiar format(./script/generate)
20
+ * Automatically generate specs when generating a site to push you
21
+ * Easily switch browser and/or driver
22
+ * Automatic opening and cleanup of browser
23
+ * Included rake spec commands generated for sites and pages
24
+ * Rake spec commands will create an RSpec HTML report by default
25
+ * Easily tie-in special functionality like getting a DOM dump of each browser before it closes
26
+
27
+ * Todo
28
+ 0.8.x
29
+ * Add a taza_example to easily generate a fully-functional example of how a taza project might look
30
+ * Provide more documentation
31
+ 0.9
32
+ * Add more thorough Selenium support
33
+ * Easily allow overwriting of spec options for included rake tasks
34
+ * Provide better conventions around cross-site testing
35
+ 1.0
36
+ * Using Selenium with WATIR syntax(Easily switch between Selenium and WATIR without having to change any Page code)
37
+ * Provide more advanced documentation
38
+
39
+ === 0.5.0 / 2008-10-03
40
+
41
+ * 1 major enhancement
42
+
43
+ * Birthday!
44
+
data/Manifest.txt ADDED
@@ -0,0 +1,61 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/taza
6
+ generators/flow/flow_generator.rb
7
+ generators/flow/templates/flow.rb.erb
8
+ generators/page/page_generator.rb
9
+ generators/page/templates/functional_page_spec.rb.erb
10
+ generators/page/templates/page.rb.erb
11
+ generators/partial/partial_generator.rb
12
+ generators/partial/templates/partial.rb.erb
13
+ generators/site/site_generator.rb
14
+ generators/site/templates/site.rb.erb
15
+ generators/site/templates/site.yml.erb
16
+ lib/app_generators/taza/taza_generator.rb
17
+ lib/app_generators/taza/templates/config.yml.erb
18
+ lib/app_generators/taza/templates/rakefile.rb.erb
19
+ lib/app_generators/taza/templates/spec_helper.rb.erb
20
+ lib/extensions/object.rb
21
+ lib/extensions/string.rb
22
+ lib/extensions/hash.rb
23
+ lib/extensions/array.rb
24
+ lib/taza.rb
25
+ lib/taza/fixture.rb
26
+ lib/taza/entity.rb
27
+ lib/taza/browser.rb
28
+ lib/taza/browsers/ie_watir.rb
29
+ lib/taza/browsers/safari_watir.rb
30
+ lib/taza/flow.rb
31
+ lib/taza/page.rb
32
+ lib/taza/settings.rb
33
+ lib/taza/site.rb
34
+ lib/taza/tasks.rb
35
+ spec/browser_spec.rb
36
+ spec/entity_spec.rb
37
+ spec/flow_generator_spec.rb
38
+ spec/fixture_spec.rb
39
+ spec/fixtures_spec.rb
40
+ spec/object_spec.rb
41
+ spec/page_generator_spec.rb
42
+ spec/page_spec.rb
43
+ spec/partial_generator_spec.rb
44
+ spec/platform/osx/browser_spec.rb
45
+ spec/platform/windows/browser_spec.rb
46
+ spec/project_generator_spec.rb
47
+ spec/sandbox/config.yml
48
+ spec/sandbox/config/config.yml
49
+ spec/sandbox/config/site_name.yml
50
+ spec/sandbox/flows/batman.rb
51
+ spec/sandbox/flows/robin.rb
52
+ spec/sandbox/pages/foo/bar.rb
53
+ spec/sandbox/pages/foo/partials/partial_the_reckoning.rb
54
+ spec/settings_spec.rb
55
+ spec/site_generator_spec.rb
56
+ spec/site_spec.rb
57
+ spec/spec_helper.rb
58
+ spec/taza_bin_spec.rb
59
+ spec/taza_spec.rb
60
+ spec/taza_tasks_spec.rb
61
+ spec/unit_helper_spec.rb
data/README ADDED
@@ -0,0 +1,79 @@
1
+ = taza
2
+
3
+ * http://github.com/scudco/taza/tree/master
4
+
5
+ == DESCRIPTION:
6
+
7
+ Taza is meant to make acceptance testing more sane for developers(or QA where applicable) and customers.
8
+
9
+ == FEATURES:
10
+
11
+ * Generate a project for browser-based testing
12
+ * Generate pages and sites for different applications
13
+ * Create flows that move through a site
14
+ * Use filters to control which elements are accessible on a page depending on its state
15
+ * Taza automatically creates and cleans up the browser for each site just like a File block
16
+ * Manage tests by tags
17
+ * Cross-site testing
18
+
19
+ == ISSUES:
20
+
21
+ * Taza has only been used in the wild with WATIR(Safari/Firefox/IE), but Selenium support is built-in
22
+ * Taza's generators currently generate RSpec specs, Test::Unit and other test framework support is planned
23
+
24
+ == SYNOPSIS:
25
+
26
+ Taza is meant to be a refreshing way to look at browser testing. Taza provides a few ways to abstract browser-based testing into three simple ideas.
27
+ * Sites
28
+ * Pages
29
+ * Flows
30
+
31
+ Sites have Pages.
32
+ Pages have elements and filters.
33
+ Flows are common actions on a site such as logging in or performing a search.
34
+
35
+ Here's an example for starting a project around the Google sites
36
+
37
+ $ taza google
38
+ $ cd google/
39
+ $ ./script/generate site google
40
+ $ ./script/generate page home_page google
41
+ $ ./script/generate flow search google
42
+ $ rake spec:functional:google
43
+
44
+ That will generate an RSpec HTML report at artifacts/functional/google/index.html
45
+
46
+
47
+ == REQUIREMENTS:
48
+
49
+ * taglob
50
+
51
+ == INSTALL:
52
+
53
+ * sudo gem install taza
54
+ * gem install taza
55
+
56
+ == LICENSE:
57
+
58
+ (The MIT License)
59
+
60
+ Copyright (c) 2008 Charley Baker
61
+
62
+ Permission is hereby granted, free of charge, to any person obtaining
63
+ a copy of this software and associated documentation files (the
64
+ 'Software'), to deal in the Software without restriction, including
65
+ without limitation the rights to use, copy, modify, merge, publish,
66
+ distribute, sublicense, and/or sell copies of the Software, and to
67
+ permit persons to whom the Software is furnished to do so, subject to
68
+ the following conditions:
69
+
70
+ The above copyright notice and this permission notice shall be
71
+ included in all copies or substantial portions of the Software.
72
+
73
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
74
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
75
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
76
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
77
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
78
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
79
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.textile ADDED
@@ -0,0 +1 @@
1
+ "Taza Wiki":http://github.com/scudco/taza/wikis
data/VERSION.yml ADDED
@@ -0,0 +1,4 @@
1
+ ---
2
+ major: 0
3
+ patch: 1
4
+ minor: 8
data/bin/taza ADDED
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ require 'rubigen'
5
+
6
+ if %w(-v --version).include? ARGV.first
7
+ require 'taza'
8
+ puts "#{File.basename($0)} #{Taza::VERSION}"
9
+ exit(0)
10
+ end
11
+
12
+ require 'rubigen/scripts/generate'
13
+ source = RubiGen::PathSource.new(:application,
14
+ File.join(File.dirname(__FILE__), "../lib/app_generators"))
15
+ RubiGen::Base.reset_sources
16
+ RubiGen::Base.append_sources source
17
+ RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'taza')
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'rubigen'
3
+ require 'activesupport'
4
+
5
+ class FlowGenerator < RubiGen::Base
6
+ default_options :author => nil
7
+ attr_reader :site_name,:name
8
+
9
+ def initialize(runtime_args, runtime_options = {})
10
+ super
11
+ usage if args.size != 2
12
+ @name = args.shift
13
+ @site_name=args.shift
14
+ check_if_site_exists
15
+ extract_options
16
+ end
17
+
18
+ def check_if_site_exists
19
+ unless File.directory?(File.join(destination_root,'lib','sites',site_name.underscore))
20
+ $stderr.puts "******No such site #{site_name} exists.******"
21
+ usage
22
+ end
23
+ end
24
+
25
+ def manifest
26
+ record do |m|
27
+ m.template "flow.rb.erb", File.join('lib','sites', site_name.underscore, "flows", "#{name.underscore}.rb")
28
+ end
29
+ end
30
+
31
+ protected
32
+ def banner
33
+ <<-EOS
34
+ Creates a taza flow for a given taza site, site you are making a flow for must exist first.
35
+
36
+ USAGE: #{$0} #{spec.name} flow_name site_name
37
+ EOS
38
+ end
39
+
40
+ def add_options!(opts)
41
+ # opts.separator ''
42
+ # opts.separator 'Options:'
43
+ # For each option below, place the default
44
+ # at the top of the file next to "default_options"
45
+ # opts.on("-a", "--author=\"Your Name\"", String,
46
+ # "Some comment about this option",
47
+ # "Default: none") { |options[:author]| }
48
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
49
+ end
50
+
51
+ def extract_options
52
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
53
+ # Templates can access these value via the attr_reader-generated methods, but not the
54
+ # raw instance variable value.
55
+ # @author = options[:author]
56
+ end
57
+ end
@@ -0,0 +1,9 @@
1
+ require 'rubygems'
2
+
3
+ module <%= site_name.camelize %>
4
+ class <%= site_name.camelize %> < ::Taza::Site
5
+ def <%= name.underscore %>_flow(params={})
6
+
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,58 @@
1
+ require 'rubygems'
2
+ require 'rubigen'
3
+ require 'activesupport'
4
+
5
+ class PageGenerator < RubiGen::Base
6
+ default_options :author => nil
7
+ attr_reader :site_name,:name
8
+
9
+ def initialize(runtime_args, runtime_options = {})
10
+ super
11
+ usage if args.size != 2
12
+ @name = args.shift
13
+ @site_name=args.shift
14
+ check_if_site_exists
15
+ extract_options
16
+ end
17
+
18
+ def check_if_site_exists
19
+ unless File.directory?(File.join(destination_root,'lib','sites',site_name.underscore))
20
+ $stderr.puts "******No such site #{site_name} exists.******"
21
+ usage
22
+ end
23
+ end
24
+
25
+ def manifest
26
+ record do |m|
27
+ m.template "page.rb.erb", File.join('lib','sites', site_name.underscore, "pages", "#{name.underscore}_page.rb")
28
+ m.template "functional_page_spec.rb.erb", File.join('spec','functional',site_name.underscore,"#{name.underscore}_page_spec.rb")
29
+ end
30
+ end
31
+
32
+ protected
33
+ def banner
34
+ <<-EOS
35
+ Creates a taza page for a given taza site, site you are making a page for must exist first.
36
+
37
+ USAGE: #{$0} #{spec.name} page_name site_name
38
+ EOS
39
+ end
40
+
41
+ def add_options!(opts)
42
+ # opts.separator ''
43
+ # opts.separator 'Options:'
44
+ # For each option below, place the default
45
+ # at the top of the file next to "default_options"
46
+ # opts.on("-a", "--author=\"Your Name\"", String,
47
+ # "Some comment about this option",
48
+ # "Default: none") { |options[:author]| }
49
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
50
+ end
51
+
52
+ def extract_options
53
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
54
+ # Templates can access these value via the attr_reader-generated methods, but not the
55
+ # raw instance variable value.
56
+ # @author = options[:author]
57
+ end
58
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec/spec_helper'
2
+ require '<%= site_name.underscore %>'
3
+
4
+ describe "<%= name.camelize %>" do
5
+ it "should fail because you haven't written any tests yet" do
6
+ false.should be_true
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ require 'rubygems'
2
+ require 'taza/page'
3
+
4
+ module <%= site_name.camelize %>
5
+ class <%= name.camelize %>Page < ::Taza::Page
6
+
7
+ end
8
+ end
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'rubigen'
3
+ require 'activesupport'
4
+
5
+ class PartialGenerator < RubiGen::Base
6
+ default_options :author => nil
7
+ attr_reader :site_name,:name
8
+
9
+ def initialize(runtime_args, runtime_options = {})
10
+ super
11
+ usage if args.size != 2
12
+ @name = args.shift
13
+ @site_name=args.shift
14
+ check_if_site_exists
15
+ extract_options
16
+ end
17
+
18
+ def check_if_site_exists
19
+ unless File.directory?(File.join(destination_root,'lib','sites',site_name.underscore))
20
+ $stderr.puts "******No such site #{site_name} exists.******"
21
+ usage
22
+ end
23
+ end
24
+
25
+ def manifest
26
+ record do |m|
27
+ m.template "partial.rb.erb", File.join('lib','sites', site_name.underscore, "pages", "partials", "#{name.underscore}.rb")
28
+ end
29
+ end
30
+
31
+ protected
32
+ def banner
33
+ <<-EOS
34
+ Creates a taza partial for a given taza site, site you are making a partial for must exist first.
35
+
36
+ USAGE: #{$0} #{spec.name} partial_name site_name
37
+ EOS
38
+ end
39
+
40
+ def add_options!(opts)
41
+ # opts.separator ''
42
+ # opts.separator 'Options:'
43
+ # For each option below, place the default
44
+ # at the top of the file next to "default_options"
45
+ # opts.on("-a", "--author=\"Your Name\"", String,
46
+ # "Some comment about this option",
47
+ # "Default: none") { |options[:author]| }
48
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
49
+ end
50
+
51
+ def extract_options
52
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
53
+ # Templates can access these value via the attr_reader-generated methods, but not the
54
+ # raw instance variable value.
55
+ # @author = options[:author]
56
+ end
57
+ end
@@ -0,0 +1,7 @@
1
+ require 'rubygems'
2
+
3
+ module <%= site_name.camelize %>
4
+ class <%= name.camelize %> < ::Taza::Page
5
+
6
+ end
7
+ end
@@ -0,0 +1,56 @@
1
+ require 'rubygems'
2
+ require 'rubigen'
3
+ require 'activesupport'
4
+
5
+ class SiteGenerator < RubiGen::Base
6
+ default_options :author => nil
7
+ attr_reader :name
8
+
9
+ def initialize(runtime_args, runtime_options = {})
10
+ super
11
+ usage if args.empty?
12
+ @name = args.shift
13
+ extract_options
14
+ end
15
+
16
+ def manifest
17
+ record do |m|
18
+ site_path = File.join('lib','sites')
19
+ m.template "site.rb.erb", File.join(site_path,"#{name.underscore}.rb")
20
+ m.directory File.join(site_path,"#{name.underscore}")
21
+ m.directory File.join(site_path,("#{name.underscore}"),"flows")
22
+ m.directory File.join(site_path,("#{name.underscore}"),"pages")
23
+ m.directory File.join(site_path,("#{name.underscore}"),"pages","partials")
24
+ m.directory File.join('spec','functional',name.underscore)
25
+ m.template "site.yml.erb", File.join('config',"#{name.underscore}.yml")
26
+ end
27
+ end
28
+
29
+ protected
30
+ def banner
31
+ <<-EOS
32
+ Creates a taza site.
33
+
34
+ USAGE: #{$0} #{spec.name} name
35
+ EOS
36
+ end
37
+
38
+ def add_options!(opts)
39
+ # opts.separator ''
40
+ # opts.separator 'Options:'
41
+ # For each option below, place the default
42
+ # at the top of the file next to "default_options"
43
+ # opts.on("-a", "--author=\"Your Name\"", String,
44
+ # "Some comment about this option",
45
+ # "Default: none") { |options[:author]| }
46
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
47
+ end
48
+
49
+ def extract_options
50
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
51
+ # Templates can access these value via the attr_reader-generated methods, but not the
52
+ # raw instance variable value.
53
+ # @author = options[:author]
54
+ end
55
+
56
+ end