whirlwind 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.3 / 2011-11-15
2
+ * Bug fixes for windows
3
+ * Removed rmagick dependancy for windows
4
+ * Add Gemfile
5
+ * Add google test site
1
6
  === 0.1.2 / 2011-10-22
2
7
  * Add wait_for dep
3
8
  === 0.1.1 / 2011-10-22
data/Manifest.txt CHANGED
@@ -77,3 +77,11 @@ lib/watir.rb
77
77
  lib/ordered_xml_markup.rb
78
78
  lib/io.rb
79
79
  images/.placeholder
80
+ sites/google/results/.placeholder
81
+ sites/google/conf/urls.yaml
82
+ sites/google/features/search.feature
83
+ sites/google/features/step_defn/google.rb
84
+ sites/google/elements/google_elements.rb
85
+ sites/google/elements/google_common_elements.rb
86
+ sites/google/flows/search_flows.rb
87
+ sites/google/flows/search_results_flows.rb
data/README.txt CHANGED
@@ -61,14 +61,19 @@
61
61
  Test results are stored under sites/<site_name>/results.
62
62
 
63
63
 
64
- == REQUIREMENTS:
65
-
66
- * Imagemagic with development headers so that the rmagick gem can be compiled.
67
-
68
64
  == INSTALL:
69
-
70
- * gem install whirlwind
71
-
65
+ * Ubuntu
66
+ * sudo apt-get install imagemagick libgraphicsmagick1-dev libmagic1 libmagickcore-dev libmagickwand-dev
67
+ * sudo apt-get install rmagick
68
+ * sudo gem install whirlwind
69
+
70
+ * Windows
71
+ * gem install win32screenshot
72
+ * gem install whirlwind
73
+
74
+ * OSX
75
+ * Install ImageMagick and development headers
76
+ * sudo gem install whirlwind
72
77
  == LICENSE:
73
78
 
74
79
  GPLv3: http://www.gnu.org/licenses/gpl.html
data/Rakefile CHANGED
@@ -5,11 +5,12 @@ require 'hoe'
5
5
 
6
6
  Hoe.spec 'whirlwind' do
7
7
  developer('Cliff Cyphers', 'cliff.cyphers@gmail.com')
8
+ extra_deps << ['ffi', '1.0.9']
9
+ extra_deps << ['sinatra']
8
10
  extra_deps << ['platform_helpers', '0.1.3']
9
11
  extra_deps << ['cucumber', '1.1.0']
10
12
  extra_deps << ['rspec', '2.7.0']
11
13
  extra_deps << ['watir-webdriver', '0.3.5']
12
- extra_deps << ['rmagick', '2.13.1']
13
14
  extra_deps << ['wait_for', '0.1.1']
14
15
  end
15
16
 
data/bin/whirlwind CHANGED
File without changes
File without changes
@@ -24,7 +24,8 @@ module Cucumber
24
24
  else
25
25
  =end
26
26
  FileUtils.mkdir Dir.pwd + '/results' unless File.directory? Dir.pwd + '/results'
27
- html = Dir.pwd + "/results/test_run_#{Time.now}.html"
27
+ t = "#{Time.now}".gsub(':', '_')
28
+ html = Dir.pwd + "/results/test_run_#{t}.html"
28
29
  # end
29
30
  @io = ensure_io(html, 'html')
30
31
  @step_mother = step_mother
data/lib/rspec.rb CHANGED
@@ -7,7 +7,12 @@ module RSpec
7
7
  file = "#{BASE}/images/#{Token.provide}.jpg"
8
8
  FileUtils.mkdir File.dirname(file) unless File.directory?(File.dirname(file))
9
9
  @__cucumber_step_mother.add_image(:src => file, :label => i)
10
- Watir::Screen.shot.resize(800, 600).write(file)
10
+
11
+ if RUBY_PLATFORM =~ /win/i or RUBY_PLATFORM =~ /mingw/i
12
+ Watir::Screen.shot.write(file)
13
+ else
14
+ Watir::Screen.shot.resize(800, 600).write(file)
15
+ end
11
16
  }
12
17
  define_method('site_requires') {
13
18
  Find.find(BASE + '/sites').each { |i|
data/lib/watir.rb CHANGED
@@ -86,9 +86,10 @@ end
86
86
  module Watir
87
87
  module Screen
88
88
  def self.shot
89
- if RUBY_PLATFORM =~ /win/i
90
- width, height, bitmap = Win32::Screenshot.desktop
91
- Magick::ImageList.new.from_blob(bitmap)
89
+ if RUBY_PLATFORM =~ /win/i or RUBY_PLATFORM =~ /mingw/i
90
+ Win32::Screenshot::Take.of(:foreground)
91
+ #width, height, bitmap = Win32::Screenshot.desktop
92
+ #Magick::ImageList.new.from_blob(bitmap)
92
93
  else
93
94
  Magick::Image.capture(silent=true, frame=false, descent=false,
94
95
  screen=true, borders=false) { self.filename = 'root' }
data/lib/whirlwind.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  base = File.expand_path(File.dirname(__FILE__) + '/..')
2
2
 
3
- require 'RMagick'
4
3
  require 'platform_helpers'
5
4
  require base + '/lib/cucumber'
6
5
  require 'watir-webdriver'
@@ -10,7 +9,12 @@ require 'wait_for'
10
9
  require base + '/lib/cucumber/formatter/html_image'
11
10
  require 'rspec'
12
11
  require 'find'
13
- require 'win32screenshot' if RUBY_PLATFORM =~ /win/i
12
+
13
+ if RUBY_PLATFORM =~ /win/i or RUBY_PLATFORM =~ /mingw/i
14
+ require 'win32/screenshot'
15
+ else
16
+ require 'RMagick'
17
+ end
14
18
 
15
19
  Before do |i|
16
20
  load_fixtures
@@ -35,5 +39,5 @@ end
35
39
 
36
40
  class Whirlwind
37
41
  include RSpec::Core::DSL
38
- VERSION = '0.1.2'
42
+ VERSION = '0.1.3'
39
43
  end
@@ -0,0 +1,2 @@
1
+ :test:
2
+ :home: http://www.google.com
@@ -0,0 +1,11 @@
1
+ module Google
2
+ module Elements
3
+ class MenuBar
4
+ include RSpec::Core::DSL
5
+ def initialize
6
+ define_me(:base) {@browser.link(:href, '#tab_base')}
7
+ end
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,24 @@
1
+ module Google
2
+ module Elements
3
+ class Search
4
+ include RSpec::Core::DSL
5
+ attr_accessor :menu
6
+ def initialize
7
+ @menu = Google::Elements::MenuBar.new
8
+ define_me(:search_field) {@browser.text_field(:title, 'Search')}
9
+ define_me(:submit) {@browser.button(:name, 'btnK')}
10
+ end
11
+ end
12
+ class SearchResults
13
+ include RSpec::Core::DSL
14
+ attr_accessor :menu
15
+ def initialize
16
+ @menu = Google::Elements::MenuBar.new
17
+ define_me(:submit) {@browser.button(:name, 'btnG')}
18
+ define_me(:search_results) { @browser.div(:id => 'search') }
19
+ define_me(:current_page_search_results_array) { @browser.divs(:class => 'vsc') }
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,8 @@
1
+ Feature: When a user enters a search term in google
2
+ results should be returned related to the term in question
3
+
4
+ Scenario: Basic Search
5
+ Given a user navigates to the home page
6
+ Then the user searches for bye bye blackbird
7
+ Then there shall be search results containing bye bye blackbird
8
+
@@ -0,0 +1,29 @@
1
+ base = File.expand_path(File.dirname(__FILE__) + '/../../../..')
2
+ require base + '/lib/whirlwind'
3
+
4
+ Given /a user navigates to the (.+) page/ do |page|
5
+ @google_searchpage.send(page)
6
+ end
7
+
8
+ Then /the user searches for (.+)/ do |term|
9
+ @google_searchpage.search(term)
10
+ end
11
+
12
+ Then /^there shall be search results containing (.+)$/ do |term|
13
+ # could simply search body's text
14
+ (@browser.text =~ /#{term}/i).should_not == nil
15
+
16
+ #or if you want to ensure it's found within a search result:
17
+ found=nil
18
+ @google_searchresultspage.elements.current_page_search_results_array.each { |result|
19
+ found = result.text =~ /#{term}/i
20
+ break if found
21
+ }
22
+ found.should_not == nil
23
+ end
24
+
25
+
26
+ =begin
27
+ Then /there shall be search results containing bye bye black bird/
28
+ end
29
+ =end
@@ -0,0 +1,29 @@
1
+ module Google
2
+ class SearchPage
3
+ include RSpec::Core::DSL
4
+ attr_reader :elements
5
+ def initialize
6
+ @elements = Google::Elements::Search.new
7
+ end
8
+
9
+ def home
10
+ @browser.goto(@test_data['google'][:urls][$environment][:home])
11
+ @elements.search_field.wait_until_present
12
+ screen_shot('Landed on Google Search Home Page')
13
+ end
14
+
15
+ def search(term)
16
+ home
17
+ @elements.search_field.set(term)
18
+ begin
19
+ @elements.submit.click
20
+ rescue Selenium::WebDriver::Error::ElementNotDisplayedError => e
21
+ @google_searchresultspage.elements.submit.click
22
+ end
23
+ wait_for(2) { @google_searchresultspage.elements.search_results.text != '' }
24
+ screen_shot("Search Results for #{term}")
25
+ end
26
+
27
+ end
28
+ end
29
+
@@ -0,0 +1,11 @@
1
+ module Google
2
+ class SearchResultsPage
3
+ include RSpec::Core::DSL
4
+ attr_reader :elements
5
+ def initialize
6
+ @elements = Google::Elements::SearchResults.new
7
+ end
8
+
9
+ end
10
+ end
11
+
File without changes
metadata CHANGED
@@ -1,106 +1,115 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: whirlwind
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
4
5
  prerelease:
5
- version: 0.1.2
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Cliff Cyphers
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-10-25 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: platform_helpers
12
+ date: 2011-11-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ffi
16
+ requirement: &80755730 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - =
20
+ - !ruby/object:Gem::Version
21
+ version: 1.0.9
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *80755730
25
+ - !ruby/object:Gem::Dependency
26
+ name: sinatra
27
+ requirement: &80755520 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
17
34
  prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
35
+ version_requirements: *80755520
36
+ - !ruby/object:Gem::Dependency
37
+ name: platform_helpers
38
+ requirement: &80755240 !ruby/object:Gem::Requirement
19
39
  none: false
20
- requirements:
21
- - - "="
22
- - !ruby/object:Gem::Version
40
+ requirements:
41
+ - - =
42
+ - !ruby/object:Gem::Version
23
43
  version: 0.1.3
24
44
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: cucumber
28
45
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
46
+ version_requirements: *80755240
47
+ - !ruby/object:Gem::Dependency
48
+ name: cucumber
49
+ requirement: &80755000 !ruby/object:Gem::Requirement
30
50
  none: false
31
- requirements:
32
- - - "="
33
- - !ruby/object:Gem::Version
51
+ requirements:
52
+ - - =
53
+ - !ruby/object:Gem::Version
34
54
  version: 1.1.0
35
55
  type: :runtime
36
- version_requirements: *id002
37
- - !ruby/object:Gem::Dependency
38
- name: rspec
39
56
  prerelease: false
40
- requirement: &id003 !ruby/object:Gem::Requirement
57
+ version_requirements: *80755000
58
+ - !ruby/object:Gem::Dependency
59
+ name: rspec
60
+ requirement: &80754730 !ruby/object:Gem::Requirement
41
61
  none: false
42
- requirements:
43
- - - "="
44
- - !ruby/object:Gem::Version
62
+ requirements:
63
+ - - =
64
+ - !ruby/object:Gem::Version
45
65
  version: 2.7.0
46
66
  type: :runtime
47
- version_requirements: *id003
48
- - !ruby/object:Gem::Dependency
49
- name: watir-webdriver
50
67
  prerelease: false
51
- requirement: &id004 !ruby/object:Gem::Requirement
68
+ version_requirements: *80754730
69
+ - !ruby/object:Gem::Dependency
70
+ name: watir-webdriver
71
+ requirement: &80754480 !ruby/object:Gem::Requirement
52
72
  none: false
53
- requirements:
54
- - - "="
55
- - !ruby/object:Gem::Version
73
+ requirements:
74
+ - - =
75
+ - !ruby/object:Gem::Version
56
76
  version: 0.3.5
57
77
  type: :runtime
58
- version_requirements: *id004
59
- - !ruby/object:Gem::Dependency
60
- name: rmagick
61
78
  prerelease: false
62
- requirement: &id005 !ruby/object:Gem::Requirement
63
- none: false
64
- requirements:
65
- - - "="
66
- - !ruby/object:Gem::Version
67
- version: 2.13.1
68
- type: :runtime
69
- version_requirements: *id005
70
- - !ruby/object:Gem::Dependency
79
+ version_requirements: *80754480
80
+ - !ruby/object:Gem::Dependency
71
81
  name: wait_for
72
- prerelease: false
73
- requirement: &id006 !ruby/object:Gem::Requirement
82
+ requirement: &80754240 !ruby/object:Gem::Requirement
74
83
  none: false
75
- requirements:
76
- - - "="
77
- - !ruby/object:Gem::Version
84
+ requirements:
85
+ - - =
86
+ - !ruby/object:Gem::Version
78
87
  version: 0.1.1
79
88
  type: :runtime
80
- version_requirements: *id006
81
- - !ruby/object:Gem::Dependency
82
- name: hoe
83
89
  prerelease: false
84
- requirement: &id007 !ruby/object:Gem::Requirement
90
+ version_requirements: *80754240
91
+ - !ruby/object:Gem::Dependency
92
+ name: hoe
93
+ requirement: &80753970 !ruby/object:Gem::Requirement
85
94
  none: false
86
- requirements:
95
+ requirements:
87
96
  - - ~>
88
- - !ruby/object:Gem::Version
89
- version: "2.12"
97
+ - !ruby/object:Gem::Version
98
+ version: '2.12'
90
99
  type: :development
91
- version_requirements: *id007
92
- description: ""
93
- email:
100
+ prerelease: false
101
+ version_requirements: *80753970
102
+ description: ''
103
+ email:
94
104
  - cliff.cyphers@gmail.com
95
- executables:
105
+ executables:
96
106
  - whirlwind
97
107
  extensions: []
98
-
99
- extra_rdoc_files:
108
+ extra_rdoc_files:
100
109
  - History.txt
101
110
  - Manifest.txt
102
111
  - README.txt
103
- files:
112
+ files:
104
113
  - .autotest
105
114
  - History.txt
106
115
  - Manifest.txt
@@ -176,34 +185,40 @@ files:
176
185
  - lib/ordered_xml_markup.rb
177
186
  - lib/io.rb
178
187
  - images/.placeholder
188
+ - sites/google/results/.placeholder
189
+ - sites/google/conf/urls.yaml
190
+ - sites/google/features/search.feature
191
+ - sites/google/features/step_defn/google.rb
192
+ - sites/google/elements/google_elements.rb
193
+ - sites/google/elements/google_common_elements.rb
194
+ - sites/google/flows/search_flows.rb
195
+ - sites/google/flows/search_results_flows.rb
179
196
  - .gemtest
180
197
  homepage: http://github.com/ccyphers/whirlwind
181
198
  licenses: []
182
-
183
199
  post_install_message:
184
- rdoc_options:
200
+ rdoc_options:
185
201
  - --main
186
202
  - README.txt
187
- require_paths:
203
+ require_paths:
188
204
  - lib
189
- required_ruby_version: !ruby/object:Gem::Requirement
205
+ required_ruby_version: !ruby/object:Gem::Requirement
190
206
  none: false
191
- requirements:
192
- - - ">="
193
- - !ruby/object:Gem::Version
194
- version: "0"
195
- required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ! '>='
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ required_rubygems_version: !ruby/object:Gem::Requirement
196
212
  none: false
197
- requirements:
198
- - - ">="
199
- - !ruby/object:Gem::Version
200
- version: "0"
213
+ requirements:
214
+ - - ! '>='
215
+ - !ruby/object:Gem::Version
216
+ version: '0'
201
217
  requirements: []
202
-
203
218
  rubyforge_project: whirlwind
204
219
  rubygems_version: 1.8.11
205
220
  signing_key:
206
221
  specification_version: 3
207
- summary: ""
208
- test_files:
222
+ summary: ''
223
+ test_files:
209
224
  - test/test_whirlwind.rb