mohawk 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/Changelog CHANGED
@@ -1,3 +1,7 @@
1
+ === Version 0.0.8 / 2013-08-10
2
+ * Enhancments
3
+ * added support for spinner controls
4
+
1
5
  === Version 0.0.7 / 2013-07-26
2
6
  * Enhancements
3
7
  * added support for tab controls
@@ -0,0 +1,12 @@
1
+ Feature: Spinner controls
2
+
3
+ Scenario: Getting and setting spinner values
4
+ Then I can set the spinner to "50.8"
5
+
6
+ Scenario: Incrementing the spinner
7
+ When the spinner is set to "10.0"
8
+ Then we can crank it up to "11.0"
9
+
10
+ Scenario: Decrementing the spinner
11
+ When the spinner is set to "40.3"
12
+ Then we can knock it down to "39.3"
@@ -0,0 +1,18 @@
1
+ Then(/^I can set the spinner to "([^"]*)"$/) do |value|
2
+ on(MainScreen) do |screen|
3
+ screen.spinner = value.to_f
4
+ screen.spinner.should eq(value.to_f)
5
+ end
6
+ end
7
+
8
+ When(/^the spinner is set to "([^"]*)"$/) do |value|
9
+ on(MainScreen).spinner = value.to_f
10
+ end
11
+
12
+ Then(/^we can crank it up to "([^"]*)"$/) do |expected_value|
13
+ on(MainScreen).increment_spinner.should eq(expected_value.to_f)
14
+ end
15
+
16
+ Then(/^we can knock it down to "([^"]*)"$/) do |expected_value|
17
+ on(MainScreen).decrement_spinner.should eq(expected_value.to_f)
18
+ end
Binary file
Binary file
@@ -16,4 +16,5 @@ class MainScreen
16
16
  menu_item(:file_roundabout_way_to_about, :path => ["File", "Roundabout Way", "To", "About"])
17
17
  tree_view(:tree_view, :id => "treeView")
18
18
  control(:value_control_field, :id => "automatableMonthCalendar1")
19
+ spinner(:spinner, :id => 'numericUpDown1')
19
20
  end
@@ -0,0 +1,27 @@
1
+ module Mohawk
2
+ module Accessors
3
+ class Spinner
4
+ attr_reader :view
5
+
6
+ def initialize(adapter, locator)
7
+ @view = adapter.window.spinner(locator)
8
+ end
9
+
10
+ def value
11
+ @view.value
12
+ end
13
+
14
+ def value=(value)
15
+ @view.set value
16
+ end
17
+
18
+ def increment
19
+ @view.increment
20
+ end
21
+
22
+ def decrement
23
+ @view.decrement
24
+ end
25
+ end
26
+ end
27
+ end
@@ -291,6 +291,34 @@ module Mohawk
291
291
  end
292
292
  end
293
293
 
294
+ # Generates methods for working with spinner controls
295
+ #
296
+ # @example
297
+ # spinner(:age, :id => "ageId")
298
+ # # will generate 'age', 'age=' methods to get the spinner value and
299
+ # # set the spinner value.
300
+ #
301
+ # @param [String] the name used for the generated methods
302
+ # @param [Hash] locator for how the spinner control is found
303
+ #
304
+ def spinner(name, locator)
305
+ define_method(name) do
306
+ adapter.spinner(locator).value
307
+ end
308
+ define_method("#{name}=") do |value|
309
+ adapter.spinner(locator).value = value
310
+ end
311
+ define_method("increment_#{name}") do
312
+ adapter.spinner(locator).increment
313
+ end
314
+ define_method("decrement_#{name}") do
315
+ adapter.spinner(locator).decrement
316
+ end
317
+ define_method("#{name}_view") do
318
+ adapter.spinner(locator).view
319
+ end
320
+ end
321
+
294
322
  # Generates methods for working with tab controls
295
323
  #
296
324
  # @example
@@ -73,6 +73,10 @@ module Mohawk
73
73
  @controls[locator] ||= Mohawk::Accessors::Control.new(self, merge(locator))
74
74
  end
75
75
 
76
+ def spinner(locator)
77
+ Mohawk::Accessors::Spinner.new(self, merge(locator))
78
+ end
79
+
76
80
  def tab_control(locator)
77
81
  Mohawk::Accessors::Tabs.new(self, merge(locator))
78
82
  end
@@ -1,3 +1,3 @@
1
1
  module Mohawk
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/mohawk.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |gem|
8
8
  gem.version = Mohawk::VERSION
9
9
  gem.authors = ["Levi Wilson"]
10
10
  gem.email = ["levi@leviwilson.com"]
11
- gem.description = %q{High level wrapper around windows applications}
12
- gem.summary = %q{High level wrapper around windows applications}
11
+ gem.description = %q{Mohawk is a page-object style driver that makes it easy to automate windows applications. It allows you to create a very flexible, clean and natural DSL around whatever windows application that you are trying to automate using the RAutomation gem as the underlying driver.}
12
+ gem.summary = %q{Provides a page-object style driver for automating Windows applications}
13
13
  gem.homepage = "http://github.com/leviwilson/mohawk"
14
14
  gem.license = 'MIT'
15
15
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_dependency 'rautomation', '~> 0.10.0'
21
+ gem.add_dependency 'rautomation', '~> 0.11.0'
22
22
  gem.add_dependency 'require_all'
23
23
  gem.add_dependency 'page_navigation', '>= 0.7'
24
24
  gem.add_dependency 'childprocess', '~> 0.3.9'
data/spec/ffi_stub.rb CHANGED
@@ -9,6 +9,7 @@ module FFI
9
9
  end
10
10
 
11
11
  def attach_function(name, func, args, returns = nil, options = nil)
12
+ define_singleton_method(name) {|*the_args|}
12
13
  end
13
14
  end
14
15
  end
@@ -0,0 +1,43 @@
1
+ require 'spec_helper'
2
+
3
+ class SpinnerScreen
4
+ include Mohawk
5
+ window(:id => 123)
6
+
7
+ spinner(:price_is_right, :id => 'barker')
8
+ end
9
+
10
+ describe Mohawk::Accessors::Spinner do
11
+ let(:window) { double('RAutomation Window') }
12
+ let(:spinner) { double('RAutomation Spinner') }
13
+ subject { SpinnerScreen.new }
14
+
15
+ before(:each) do
16
+ RAutomation::Window.stub(:new).and_return(window)
17
+ window.should_receive(:spinner).with(:id => 'barker').and_return(spinner)
18
+ end
19
+
20
+ it 'knows the value' do
21
+ spinner.should_receive(:value).and_return(11.0)
22
+ subject.price_is_right.should eq(11.0)
23
+ end
24
+
25
+ it 'can set the value' do
26
+ spinner.should_receive(:set).with(11.0)
27
+ subject.price_is_right = 11.0
28
+ end
29
+
30
+ it 'can be incremented' do
31
+ spinner.should_receive(:increment).and_return(11.0)
32
+ subject.increment_price_is_right.should eq(11.0)
33
+ end
34
+
35
+ it 'can be decremented' do
36
+ spinner.should_receive(:decrement).and_return(11.0)
37
+ subject.decrement_price_is_right.should eq(11.0)
38
+ end
39
+
40
+ it 'can get the view' do
41
+ subject.price_is_right_view.should be(spinner)
42
+ end
43
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mohawk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-26 00:00:00.000000000 Z
12
+ date: 2013-08-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rautomation
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 0.10.0
21
+ version: 0.11.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.10.0
29
+ version: 0.11.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: require_all
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -219,7 +219,10 @@ dependencies:
219
219
  - - ~>
220
220
  - !ruby/object:Gem::Version
221
221
  version: 1.7.7
222
- description: High level wrapper around windows applications
222
+ description: Mohawk is a page-object style driver that makes it easy to automate windows
223
+ applications. It allows you to create a very flexible, clean and natural DSL around
224
+ whatever windows application that you are trying to automate using the RAutomation
225
+ gem as the underlying driver.
223
226
  email:
224
227
  - levi@leviwilson.com
225
228
  executables: []
@@ -246,6 +249,7 @@ files:
246
249
  - features/mohawk.feature
247
250
  - features/navigation.feature
248
251
  - features/radio.feature
252
+ - features/spinner.feature
249
253
  - features/step_definitions/button_steps.rb
250
254
  - features/step_definitions/checkbox_steps.rb
251
255
  - features/step_definitions/combo_box_steps.rb
@@ -256,11 +260,13 @@ files:
256
260
  - features/step_definitions/mohawk_steps.rb
257
261
  - features/step_definitions/navigation_steps.rb
258
262
  - features/step_definitions/radio_steps.rb
263
+ - features/step_definitions/spinner_steps.rb
259
264
  - features/step_definitions/table_steps.rb
260
265
  - features/step_definitions/tabs_steps.rb
261
266
  - features/step_definitions/text_steps.rb
262
267
  - features/step_definitions/tree_view_steps.rb
263
268
  - features/support/FizzWare.NBuilder.dll
269
+ - features/support/UIA.Extensions.dll
264
270
  - features/support/WindowsForms.exe
265
271
  - features/support/app/WindowsForms/WindowsForms.sln
266
272
  - features/support/app/WindowsForms/WindowsForms/AboutBox.Designer.cs
@@ -308,6 +314,7 @@ files:
308
314
  - lib/mohawk/accessors/link.rb
309
315
  - lib/mohawk/accessors/menu_item.rb
310
316
  - lib/mohawk/accessors/radio.rb
317
+ - lib/mohawk/accessors/spinner.rb
311
318
  - lib/mohawk/accessors/table.rb
312
319
  - lib/mohawk/accessors/table_row.rb
313
320
  - lib/mohawk/accessors/tabs.rb
@@ -327,6 +334,7 @@ files:
327
334
  - spec/lib/mohawk/accessors/link_spec.rb
328
335
  - spec/lib/mohawk/accessors/menu_spec.rb
329
336
  - spec/lib/mohawk/accessors/radio_spec.rb
337
+ - spec/lib/mohawk/accessors/spinner_spec.rb
330
338
  - spec/lib/mohawk/accessors/table_spec.rb
331
339
  - spec/lib/mohawk/accessors/tabs_spec.rb
332
340
  - spec/lib/mohawk/accessors/text_spec.rb
@@ -360,7 +368,7 @@ rubyforge_project:
360
368
  rubygems_version: 1.8.24
361
369
  signing_key:
362
370
  specification_version: 3
363
- summary: High level wrapper around windows applications
371
+ summary: Provides a page-object style driver for automating Windows applications
364
372
  test_files:
365
373
  - features/button.feature
366
374
  - features/checkbox.feature
@@ -372,6 +380,7 @@ test_files:
372
380
  - features/mohawk.feature
373
381
  - features/navigation.feature
374
382
  - features/radio.feature
383
+ - features/spinner.feature
375
384
  - features/step_definitions/button_steps.rb
376
385
  - features/step_definitions/checkbox_steps.rb
377
386
  - features/step_definitions/combo_box_steps.rb
@@ -382,11 +391,13 @@ test_files:
382
391
  - features/step_definitions/mohawk_steps.rb
383
392
  - features/step_definitions/navigation_steps.rb
384
393
  - features/step_definitions/radio_steps.rb
394
+ - features/step_definitions/spinner_steps.rb
385
395
  - features/step_definitions/table_steps.rb
386
396
  - features/step_definitions/tabs_steps.rb
387
397
  - features/step_definitions/text_steps.rb
388
398
  - features/step_definitions/tree_view_steps.rb
389
399
  - features/support/FizzWare.NBuilder.dll
400
+ - features/support/UIA.Extensions.dll
390
401
  - features/support/WindowsForms.exe
391
402
  - features/support/app/WindowsForms/WindowsForms.sln
392
403
  - features/support/app/WindowsForms/WindowsForms/AboutBox.Designer.cs
@@ -433,6 +444,7 @@ test_files:
433
444
  - spec/lib/mohawk/accessors/link_spec.rb
434
445
  - spec/lib/mohawk/accessors/menu_spec.rb
435
446
  - spec/lib/mohawk/accessors/radio_spec.rb
447
+ - spec/lib/mohawk/accessors/spinner_spec.rb
436
448
  - spec/lib/mohawk/accessors/table_spec.rb
437
449
  - spec/lib/mohawk/accessors/tabs_spec.rb
438
450
  - spec/lib/mohawk/accessors/text_spec.rb