whirlwind 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. data/.autotest +23 -0
  2. data/.gemtest +0 -0
  3. data/History.txt +6 -0
  4. data/Manifest.txt +79 -0
  5. data/README.txt +76 -0
  6. data/Rakefile +15 -0
  7. data/bin/whirlwind +99 -0
  8. data/demo_test_site/demo_site.rb +37 -0
  9. data/demo_test_site/public/images/arrow_left_48.png +0 -0
  10. data/demo_test_site/public/images/arrow_right_48.png +0 -0
  11. data/demo_test_site/public/images/down.gif +0 -0
  12. data/demo_test_site/public/images/header.jpg +0 -0
  13. data/demo_test_site/public/images/menu.gif +0 -0
  14. data/demo_test_site/public/images/menuhover.gif +0 -0
  15. data/demo_test_site/public/javascripts/browser.menu.js +61 -0
  16. data/demo_test_site/public/javascripts/cyberconnect_helpers.js +369 -0
  17. data/demo_test_site/public/javascripts/jquery-1.5.1.min.js +16 -0
  18. data/demo_test_site/public/javascripts/jquery-1.6.2.min.js +18 -0
  19. data/demo_test_site/public/javascripts/jquery-ui-1.8.10.custom.min.js +1370 -0
  20. data/demo_test_site/public/javascripts/jquery.layout.min-1.2.0.js +80 -0
  21. data/demo_test_site/public/javascripts/jqueryslidemenu.css +93 -0
  22. data/demo_test_site/public/javascripts/jqueryslidemenu.js +48 -0
  23. data/demo_test_site/public/javascripts/ui.accordion.js +477 -0
  24. data/demo_test_site/public/jquery.ui.all.css +11 -0
  25. data/demo_test_site/public/jquery.ui.base.css +11 -0
  26. data/demo_test_site/public/jquery.ui.theme.css +252 -0
  27. data/demo_test_site/public/jquery_css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  28. data/demo_test_site/public/jquery_css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  29. data/demo_test_site/public/jquery_css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  30. data/demo_test_site/public/jquery_css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  31. data/demo_test_site/public/jquery_css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  32. data/demo_test_site/public/jquery_css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  33. data/demo_test_site/public/jquery_css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  34. data/demo_test_site/public/jquery_css/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  35. data/demo_test_site/public/jquery_css/images/ui-icons_222222_256x240.png +0 -0
  36. data/demo_test_site/public/jquery_css/images/ui-icons_2e83ff_256x240.png +0 -0
  37. data/demo_test_site/public/jquery_css/images/ui-icons_454545_256x240.png +0 -0
  38. data/demo_test_site/public/jquery_css/images/ui-icons_888888_256x240.png +0 -0
  39. data/demo_test_site/public/jquery_css/images/ui-icons_cd0a0a_256x240.png +0 -0
  40. data/demo_test_site/public/jquery_css/jquery-ui-1.8.10.custom.css +573 -0
  41. data/demo_test_site/public/jquery_layout.css +14 -0
  42. data/demo_test_site/public/jqueryslidemenu.css +93 -0
  43. data/demo_test_site/public/menu.css +12 -0
  44. data/demo_test_site/public/style.css +196 -0
  45. data/demo_test_site/views/index.erb +294 -0
  46. data/images/.placeholder +0 -0
  47. data/lib/browser.rb +22 -0
  48. data/lib/cucumber/formatter/cucumber.css +282 -0
  49. data/lib/cucumber/formatter/html_image.rb +750 -0
  50. data/lib/cucumber/formatter/jquery-min.js +154 -0
  51. data/lib/cucumber.rb +68 -0
  52. data/lib/duration.rb +13 -0
  53. data/lib/io.rb +31 -0
  54. data/lib/ordered_xml_markup.rb +24 -0
  55. data/lib/rspec.rb +75 -0
  56. data/lib/watir.rb +105 -0
  57. data/lib/whirlwind.rb +39 -0
  58. data/sites/demo/conf/base_urls.yml +6 -0
  59. data/sites/demo/conf/browser.yaml +1 -0
  60. data/sites/demo/conf/html_elements.yaml +22 -0
  61. data/sites/demo/conf/remote_machine.yaml +12 -0
  62. data/sites/demo/conf/users.yaml +21 -0
  63. data/sites/demo/elements/demo_common_elements.rb +42 -0
  64. data/sites/demo/elements/demo_elements.rb +18 -0
  65. data/sites/demo/elements/demo_registration_elements.rb +27 -0
  66. data/sites/demo/features/click_links.feature +21 -0
  67. data/sites/demo/features/register_user.feature +27 -0
  68. data/sites/demo/features/step_defn/demo.rb +62 -0
  69. data/sites/demo/flows/home_flows.rb +25 -0
  70. data/sites/demo/flows/registration_flows.rb +21 -0
  71. data/sites/demo/results/.placeholder +0 -0
  72. data/test/features/browser_types.feature +22 -0
  73. data/test/features/open_browser.feature +20 -0
  74. data/test/features/resource_size.feature +13 -0
  75. data/test/features/step_defn/browser.rb +61 -0
  76. data/test/test_whirlwind.rb +8 -0
  77. metadata +198 -0
data/.autotest ADDED
@@ -0,0 +1,23 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'autotest/restart'
4
+
5
+ # Autotest.add_hook :initialize do |at|
6
+ # at.extra_files << "../some/external/dependency.rb"
7
+ #
8
+ # at.libs << ":../some/external"
9
+ #
10
+ # at.add_exception 'vendor'
11
+ #
12
+ # at.add_mapping(/dependency.rb/) do |f, _|
13
+ # at.files_matching(/test_.*rb$/)
14
+ # end
15
+ #
16
+ # %w(TestA TestB).each do |klass|
17
+ # at.extra_class_map[klass] = "test/test_misc.rb"
18
+ # end
19
+ # end
20
+
21
+ # Autotest.add_hook :run_command do |at|
22
+ # system "rake build"
23
+ # end
data/.gemtest ADDED
File without changes
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 0.1.0 / 2011-10-22
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,79 @@
1
+ .autotest
2
+ History.txt
3
+ Manifest.txt
4
+ README.txt
5
+ Rakefile
6
+ bin/whirlwind
7
+ lib/whirlwind.rb
8
+ History.txt
9
+ demo_test_site/views/index.erb
10
+ demo_test_site/demo_site.rb
11
+ demo_test_site/public/jquery.ui.theme.css
12
+ demo_test_site/public/jquery.ui.base.css
13
+ demo_test_site/public/style.css
14
+ demo_test_site/public/jquery_layout.css
15
+ demo_test_site/public/jquery.ui.all.css
16
+ demo_test_site/public/javascripts/jqueryslidemenu.js
17
+ demo_test_site/public/javascripts/jquery-1.5.1.min.js
18
+ demo_test_site/public/javascripts/jquery-1.6.2.min.js
19
+ demo_test_site/public/javascripts/ui.accordion.js
20
+ demo_test_site/public/javascripts/browser.menu.js
21
+ demo_test_site/public/javascripts/jquery.layout.min-1.2.0.js
22
+ demo_test_site/public/javascripts/jquery-ui-1.8.10.custom.min.js
23
+ demo_test_site/public/javascripts/jqueryslidemenu.css
24
+ demo_test_site/public/javascripts/cyberconnect_helpers.js
25
+ demo_test_site/public/jqueryslidemenu.css
26
+ demo_test_site/public/menu.css
27
+ demo_test_site/public/jquery_css/jquery-ui-1.8.10.custom.css
28
+ demo_test_site/public/jquery_css/images/ui-bg_glass_65_ffffff_1x400.png
29
+ demo_test_site/public/jquery_css/images/ui-bg_glass_75_e6e6e6_1x400.png
30
+ demo_test_site/public/jquery_css/images/ui-bg_highlight-soft_75_cccccc_1x100.png
31
+ demo_test_site/public/jquery_css/images/ui-icons_454545_256x240.png
32
+ demo_test_site/public/jquery_css/images/ui-icons_888888_256x240.png
33
+ demo_test_site/public/jquery_css/images/ui-icons_222222_256x240.png
34
+ demo_test_site/public/jquery_css/images/ui-icons_2e83ff_256x240.png
35
+ demo_test_site/public/jquery_css/images/ui-bg_flat_75_ffffff_40x100.png
36
+ demo_test_site/public/jquery_css/images/ui-bg_glass_95_fef1ec_1x400.png
37
+ demo_test_site/public/jquery_css/images/ui-bg_flat_0_aaaaaa_40x100.png
38
+ demo_test_site/public/jquery_css/images/ui-bg_glass_75_dadada_1x400.png
39
+ demo_test_site/public/jquery_css/images/ui-bg_glass_55_fbf9ee_1x400.png
40
+ demo_test_site/public/jquery_css/images/ui-icons_cd0a0a_256x240.png
41
+ demo_test_site/public/images/down.gif
42
+ demo_test_site/public/images/arrow_left_48.png
43
+ demo_test_site/public/images/header.jpg
44
+ demo_test_site/public/images/menuhover.gif
45
+ demo_test_site/public/images/arrow_right_48.png
46
+ demo_test_site/public/images/menu.gif
47
+ test/features/browser_types.feature
48
+ test/features/open_browser.feature
49
+ test/features/resource_size.feature
50
+ test/features/step_defn/browser.rb
51
+ test/test_whirlwind.rb
52
+ Rakefile
53
+ bin/whirlwind
54
+ sites/demo/elements/demo_common_elements.rb
55
+ sites/demo/elements/demo_registration_elements.rb
56
+ sites/demo/elements/demo_elements.rb
57
+ sites/demo/results/.placeholder
58
+ sites/demo/features/register_user.feature
59
+ sites/demo/features/step_defn/demo.rb
60
+ sites/demo/features/click_links.feature
61
+ sites/demo/flows/registration_flows.rb
62
+ sites/demo/flows/home_flows.rb
63
+ sites/demo/conf/users.yaml
64
+ sites/demo/conf/remote_machine.yaml
65
+ sites/demo/conf/browser.yaml
66
+ sites/demo/conf/base_urls.yml
67
+ sites/demo/conf/html_elements.yaml
68
+ lib/cucumber.rb
69
+ lib/whirlwind.rb
70
+ lib/duration.rb
71
+ lib/rspec.rb
72
+ lib/browser.rb
73
+ lib/cucumber/formatter/jquery-min.js
74
+ lib/cucumber/formatter/cucumber.css
75
+ lib/cucumber/formatter/html_image.rb
76
+ lib/watir.rb
77
+ lib/ordered_xml_markup.rb
78
+ lib/io.rb
79
+ images/.placeholder
data/README.txt ADDED
@@ -0,0 +1,76 @@
1
+ = whirlwind
2
+
3
+ * http://github.com/ccyphers/whirlwind
4
+
5
+ == DESCRIPTION:
6
+ === Unobstructed QA Browser Automation
7
+ === Through sensible conventions along with cucumber and watir-webdriver
8
+
9
+ == FEATURES/PROBLEMS:
10
+
11
+ * Centralized location for defining page based elements,
12
+ such as links, images, tables, text, etc.
13
+
14
+ * One can use screen_shot('some image description') from within
15
+ rspec step definitions, flows and elements. All images taken
16
+ during cucumber's execution are embedded into an html report.
17
+
18
+ * Flow objects are automatically created for you and accessible from
19
+ within rspec step definitions, flows and elements. This includes
20
+ flows from all sites, not just the site running for the current cucumber
21
+ feature.
22
+
23
+ * A browser instance is automatically instantiated, you never
24
+ have to manually call a browser and is accessible through the instance
25
+ variable @browser
26
+
27
+ * Fixture data is automatically loaded into an instance var @test_data and
28
+ is accessible from rspec step definitions, flows and elements. @test_data
29
+ takes the form:
30
+
31
+ @test_data[site_name][fixture_file_without_suffix][keys to load from fixture file]
32
+
33
+ For example, say you want to access a manager in the test environment from a fixture file
34
+ located at sites/demo/conf/users.yaml you would:
35
+
36
+ @test_data['demo'][:users][:test][:manager]
37
+
38
+ Note, here 'demo' is used for the site name, but a global vairable $site_name is
39
+ also available and set to the site name for feature(s) that are executing.
40
+
41
+
42
+ == SYNOPSIS:
43
+
44
+ To create a local snapshot from the current installed version:
45
+ whirlwind --snapshot /some/path/
46
+
47
+ General options:
48
+ --environment # set to a name that is used to organize your fixture data.
49
+ For example, test, dev, prod
50
+ --browser # set to a valid selenium-webdriver supported browser
51
+ --site # optional, if the test site name is provided run all features
52
+ # for that site. If this is not provided pass a feature file
53
+ as the last argument
54
+
55
+ To execute the example demo site test. This assumes you have started
56
+ the demo site located under demo_test_site.
57
+
58
+ cd /local/snapshot/dir
59
+ ./bin/whirlwind --site sites/demo --browser ff --environment test
60
+
61
+ Test results are stored under sites/<site_name>/results.
62
+
63
+
64
+ == REQUIREMENTS:
65
+
66
+ * Imagemagic with development headers so that the rmagick gem can be compiled.
67
+
68
+ == INSTALL:
69
+
70
+ * gem install whirlwind
71
+
72
+ == LICENSE:
73
+
74
+ GPLv3: http://www.gnu.org/licenses/gpl.html
75
+
76
+ Copyright (c) 2011 Cliff Cyphers
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+
6
+ Hoe.spec 'whirlwind' do
7
+ developer('Cliff Cyphers', 'cliff.cyphers@gmail.com')
8
+ extra_deps << ['platform_helpers', '0.1.3']
9
+ extra_deps << ['cucumber', '1.1.0']
10
+ extra_deps << ['rspec', '2.7.0']
11
+ extra_deps << ['watir-webdriver', '0.3.5']
12
+ extra_deps << ['rmagick', '2.13.1']
13
+ end
14
+
15
+ # vim: syntax=ruby
data/bin/whirlwind ADDED
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'getoptlong'
4
+ require 'fileutils'
5
+
6
+ def usage
7
+ msg = <<-EOF
8
+ To create a local snapshot from the current installed version:
9
+ whirlwind --snapshot /some/path/
10
+
11
+ General options:
12
+ --environment # set to a name that is used to organize your fixture data.
13
+ For example, test, dev, prod
14
+ --browser # set to a valid selenium-webdriver supported browser
15
+ --site # optional, if the test site name is provided run all features
16
+ # for that site. If this is not provided pass a feature file
17
+ as the last argument
18
+
19
+ To execute the example demo site test. This assumes you have started
20
+ the demo site located under demo_test_site.
21
+
22
+ cd /local/snapshot/dir
23
+ ./bin/whirlwind --site sites/demo --browser ff --environment test
24
+
25
+ Test results are stored under sites/<site_name>/results.
26
+ EOF
27
+ puts msg
28
+ exit 1
29
+ end
30
+
31
+ raise StandardError unless RUBY_VERSION =~ /^1\.9\.\d$/
32
+ usage unless ARGV.length > 0
33
+ args = ARGV.dup
34
+ begin
35
+ opts = GetoptLong.new([ '--snapshot', '-s', GetoptLong::REQUIRED_ARGUMENT ],
36
+ [ '--environment', '-e', GetoptLong::REQUIRED_ARGUMENT ],
37
+ [ '--browser', '-b', GetoptLong::REQUIRED_ARGUMENT ],
38
+ [ '--site', '-i', GetoptLong::REQUIRED_ARGUMENT ]
39
+ )
40
+
41
+
42
+ site = ''
43
+ $browser_type = nil
44
+
45
+ opts.each { |opt, arg|
46
+ if opt == '--snapshot' || opt == '-s'
47
+ raise ArgumentError, "Please provide a valid directory." unless File.directory?(arg)
48
+ dir = File.expand_path(File.dirname(__FILE__) + '/..')
49
+ base = File.basename(dir)
50
+ FileUtils.cp_r dir, arg
51
+ FileUtils.chmod 0700, "#{arg}/#{base}/bin/whirlwind"
52
+ exit 0
53
+ end
54
+ if opt == '--environment' || opt == '-e'
55
+ $environment = arg.to_sym
56
+ end
57
+ if opt == '--browser' || opt == '-b'
58
+ $browser_type = arg
59
+ end
60
+ if opt == '--site' || opt == '-i'
61
+ site = File.expand_path(arg)
62
+ $site_name = File.basename site
63
+ puts "SITE: #{site}"
64
+ unless File.directory?(site)
65
+ puts "Can't find site: #{site}"
66
+ exit 1
67
+ end
68
+ FileUtils.chdir(site)
69
+ end
70
+ }
71
+ rescue => e
72
+ end
73
+
74
+ if site == ''
75
+ if File.exists?(args.last)
76
+ full_p = File.expand_path(args.last)
77
+ p = File.expand_path(File.dirname(args.last) + '/..')
78
+ $site_name = File.basename p
79
+ FileUtils.chdir(p)
80
+ args.delete(args.last)
81
+ args << full_p
82
+ else
83
+ puts "Either a site name using option --site or a feature file to execute"
84
+ exit 1
85
+ end
86
+ end
87
+
88
+ delete_items = %w(--snapshot -s --environment -e --site -i --browser -b)
89
+ delete_items.each { |i|
90
+ index = args.rindex(i)
91
+ if index
92
+ next_ = args[index+1]
93
+ args.delete_at(index)
94
+ args.delete(next_)
95
+ end
96
+ }
97
+ args += ['-f', 'Cucumber::Formatter::HtmlImage', '--out', 'tmp.html', '-f', 'pretty']
98
+ require 'cucumber'
99
+ Cucumber::Cli::Main.execute(args)
@@ -0,0 +1,37 @@
1
+ require 'erb'
2
+ require 'yaml'
3
+ require 'find'
4
+ require 'fileutils'
5
+ $base = File.expand_path(File.dirname(__FILE__))
6
+ require 'rubygems'
7
+ require 'sinatra'
8
+ require 'json'
9
+
10
+ class DemoTestSite < Sinatra::Base
11
+ configure do
12
+ set(:server, ["mongrel", "webrick"])
13
+ set(:chdir, $base)
14
+ set(:public_folder, ($base + "/public"))
15
+ set(:bind, "localhost")
16
+ #enable(:sessions)
17
+ end
18
+ get("/") do
19
+ cook = false
20
+ erb(:index)
21
+ end
22
+ post("/create_tmp_file") do
23
+ res = {:results => false}
24
+ file = "/tmp/#{params['file_name']}"
25
+ begin
26
+ FileUtils.rm_f file if File.exists? file
27
+ FileUtils.touch file
28
+ rescue => e
29
+ end
30
+ res[:results] = File.exists? file
31
+ res.to_json
32
+ end
33
+ end
34
+
35
+ Dir.chdir($base)
36
+ retry_ct = 0
37
+ DemoTestSite.run!(:host => "localhost", :port => 9090, :chdir => $base)
@@ -0,0 +1,61 @@
1
+ // JavaScript Document
2
+ //var menus = $.extend(defaults, menus);
3
+ (function($){
4
+
5
+ $.fn.bmenu = function(menus) {
6
+ return this.each(function() {
7
+ obj=$(this);
8
+ obj.empty();
9
+ $('<div id=shadow></div>').insertBefore(obj);
10
+ $.each(menus,function(i, menu) {
11
+ // for(i in menus) {
12
+ obj.append('<br><div><a id="'+menu.id+'" style="text-decoration:none; cursor:default;">&nbsp;&nbsp;'+menu.name+'</a></div>');
13
+ $('a#' + menu.id).click(function() {
14
+ $(obj).hide();
15
+ eval(menu.func);
16
+ });
17
+ /*
18
+ $('a#' + menus[i].id).click(function() {
19
+ $(obj).hide();
20
+ try {
21
+ eval(menus[i].func);
22
+ } catch(e) {
23
+ alert(e);
24
+ }
25
+ })
26
+ */
27
+ });
28
+ obj.append('<br>');
29
+ obj.children('div:not("#line")').hover(
30
+ function () {
31
+ $(this).css('background-color','#C9DBEE');
32
+ $(this).css('opacity','0.9');
33
+ $(this).css('cursor','default');
34
+ $(this).css('background-color','');
35
+ }
36
+ );
37
+ obj.prepend('<div id=line></div>');
38
+ $('#line').css({ 'opacity':'3', 'width':'27px',
39
+ 'background-color':obj.css('background-color'),
40
+ 'float':'left','height':obj.height()+'px', 'border-right':'solid 1px #E7E7E7'
41
+ });
42
+ });
43
+ };
44
+ /*
45
+ $.extend($.fn.bmenu, {
46
+ show: function() {
47
+ $('#shadow').hide(); obj.hide(); mheight=obj.height(); mwidth=obj.width();
48
+ if(e.pageY>=$(window).height()-(mheight+5)){ Y=e.pageY-(mheight+5); } else{ Y=e.pageY; }
49
+ if(e.pageX>=$(window).width()-(mwidth+5)){ X=e.pageX-(mwidth+5); } else{ X=e.pageX; }
50
+ obj.css('left',X); obj.css('top',Y);
51
+ $('#shadow').css({ 'display': 'none', 'position':'absolute', 'opacity':'0.4',
52
+ 'width':obj.width()+'px', 'background-color':'#000' });
53
+ $('#shadow').css('height',obj.height());
54
+ $('#shadow').css('left',X+5);
55
+ $('#shadow').css('top',Y+5);
56
+ obj.show(function(){ $('#shadow').show(); });
57
+ }
58
+ });
59
+ */
60
+ })
61
+ (jQuery);