mohawk 0.4 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog +5 -0
- data/lib/mohawk/adapters/uia/menu_item.rb +16 -3
- data/lib/mohawk/version.rb +1 -1
- data/mohawk.gemspec +1 -1
- data/spec/lib/mohawk/menu_spec.rb +10 -0
- data/spec/screens/main_form.rb +1 -0
- metadata +8 -8
data/Changelog
CHANGED
@@ -2,19 +2,21 @@ module Mohawk
|
|
2
2
|
module Adapters
|
3
3
|
module UIA
|
4
4
|
class MenuItem < Control
|
5
|
-
class MenuItemNotFound < StandardError;
|
5
|
+
class MenuItemNotFound < StandardError;
|
6
|
+
end
|
6
7
|
|
7
8
|
def select
|
8
|
-
element.select_menu_item(*path)
|
9
|
+
until_successful { element.select_menu_item(*path) }
|
9
10
|
end
|
10
11
|
|
11
12
|
def click
|
12
|
-
element.menu_item(*path).click_center
|
13
|
+
until_successful { element.menu_item(*path).click_center }
|
13
14
|
end
|
14
15
|
|
15
16
|
def exist?
|
16
17
|
!!element.menu_item(*path)
|
17
18
|
end
|
19
|
+
|
18
20
|
alias_method :exists?, :exist?
|
19
21
|
|
20
22
|
private
|
@@ -25,6 +27,17 @@ module Mohawk
|
|
25
27
|
def path
|
26
28
|
[@locator[:path] || @locator[:text]].flatten
|
27
29
|
end
|
30
|
+
|
31
|
+
def until_successful(&block)
|
32
|
+
wait_until do
|
33
|
+
begin
|
34
|
+
block.call
|
35
|
+
true
|
36
|
+
rescue
|
37
|
+
false
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
28
41
|
end
|
29
42
|
end
|
30
43
|
end
|
data/lib/mohawk/version.rb
CHANGED
data/mohawk.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
|
|
24
24
|
gem.add_dependency 'childprocess', '~> 0.5'
|
25
25
|
|
26
26
|
gem.add_development_dependency 'cucumber'
|
27
|
-
gem.add_development_dependency 'rspec', '
|
27
|
+
gem.add_development_dependency 'rspec', '2.14.1'
|
28
28
|
gem.add_development_dependency 'rspec-given'
|
29
29
|
gem.add_development_dependency 'rake'
|
30
30
|
gem.add_development_dependency 'childprocess'
|
@@ -17,4 +17,14 @@ describe 'menus' do
|
|
17
17
|
When { main_form.click_menu_item_by_path }
|
18
18
|
Then { on(About).active? }
|
19
19
|
end
|
20
|
+
|
21
|
+
context 'waiting for' do
|
22
|
+
Given { Mohawk.timeout = 2 }
|
23
|
+
|
24
|
+
When(:non_existent_menu) { main_form.non_existent_menu }
|
25
|
+
When(:click_non_existent_menu) { main_form.click_non_existent_menu }
|
26
|
+
|
27
|
+
Then { expect(non_existent_menu).to have_failed(Mohawk::Waiter::WaitTimeout) }
|
28
|
+
Then { expect(click_non_existent_menu).to have_failed(Mohawk::Waiter::WaitTimeout) }
|
29
|
+
end
|
20
30
|
end
|
data/spec/screens/main_form.rb
CHANGED
@@ -26,6 +26,7 @@ class MainForm
|
|
26
26
|
|
27
27
|
menu_item(:menu_item_by_path, path: ['File', 'Roundabout Way', 'To', 'About'])
|
28
28
|
menu_item(:menu_item_by_text, text: 'About')
|
29
|
+
menu_item(:non_existent_menu, path: ['File', 'Does Not Exist'])
|
29
30
|
|
30
31
|
control(:month_calendar, id: 'automatableMonthCalendar1')
|
31
32
|
control(:about_control, id: 'aboutButton')
|
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:
|
4
|
+
version: 0.4.1
|
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: 2014-
|
12
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uia
|
@@ -96,17 +96,17 @@ dependencies:
|
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
97
97
|
none: false
|
98
98
|
requirements:
|
99
|
-
- -
|
99
|
+
- - '='
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 2.
|
101
|
+
version: 2.14.1
|
102
102
|
type: :development
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
|
-
- -
|
107
|
+
- - '='
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.
|
109
|
+
version: 2.14.1
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: rspec-given
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -354,7 +354,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
354
354
|
version: '0'
|
355
355
|
segments:
|
356
356
|
- 0
|
357
|
-
hash:
|
357
|
+
hash: 909285235
|
358
358
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
359
359
|
none: false
|
360
360
|
requirements:
|
@@ -363,7 +363,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
363
363
|
version: '0'
|
364
364
|
segments:
|
365
365
|
- 0
|
366
|
-
hash:
|
366
|
+
hash: 909285235
|
367
367
|
requirements: []
|
368
368
|
rubyforge_project:
|
369
369
|
rubygems_version: 1.8.28
|