mohawk 0.2.1 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. data/Changelog +5 -0
  2. data/lib/mohawk/accessors.rb +16 -0
  3. data/lib/mohawk/adapters/uia/text_box.rb +5 -1
  4. data/lib/mohawk/adapters/uia/window.rb +12 -7
  5. data/lib/mohawk/version.rb +1 -1
  6. data/mohawk.gemspec +2 -2
  7. data/spec/lib/mohawk/button_spec.rb +14 -0
  8. data/spec/lib/mohawk/checkbox_spec.rb +23 -0
  9. data/spec/lib/mohawk/combo_box_spec.rb +52 -0
  10. data/spec/lib/mohawk/control_spec.rb +17 -0
  11. data/spec/lib/mohawk/label_spec.rb +8 -0
  12. data/spec/lib/mohawk/link_spec.rb +16 -0
  13. data/spec/lib/mohawk/menu_spec.rb +20 -0
  14. data/spec/lib/mohawk/navigation_spec.rb +25 -0
  15. data/spec/lib/mohawk/radio_spec.rb +22 -0
  16. data/spec/lib/mohawk/spinner_spec.rb +31 -0
  17. data/spec/lib/mohawk/text_spec.rb +40 -0
  18. data/spec/lib/mohawk/tree_view_spec.rb +54 -0
  19. data/spec/lib/mohawk/window_spec.rb +84 -0
  20. data/spec/lib/mohawk_spec.rb +25 -0
  21. data/spec/screens/about.rb +7 -0
  22. data/spec/screens/data_entry_form.rb +4 -0
  23. data/spec/screens/main_form.rb +32 -0
  24. data/spec/spec_helper.rb +19 -1
  25. data/spec/tabs_spec.rb +26 -0
  26. metadata +44 -68
  27. data/features/button.feature +0 -10
  28. data/features/checkbox.feature +0 -12
  29. data/features/combo_box.feature +0 -44
  30. data/features/control.feature +0 -9
  31. data/features/label.feature +0 -4
  32. data/features/link.feature +0 -9
  33. data/features/menu.feature +0 -13
  34. data/features/mohawk.feature +0 -25
  35. data/features/navigation.feature +0 -9
  36. data/features/radio.feature +0 -5
  37. data/features/spinner.feature +0 -12
  38. data/features/step_definitions/button_steps.rb +0 -15
  39. data/features/step_definitions/checkbox_steps.rb +0 -19
  40. data/features/step_definitions/combo_box_steps.rb +0 -48
  41. data/features/step_definitions/control_steps.rb +0 -11
  42. data/features/step_definitions/label_steps.rb +0 -3
  43. data/features/step_definitions/link_steps.rb +0 -3
  44. data/features/step_definitions/menu_steps.rb +0 -10
  45. data/features/step_definitions/mohawk_steps.rb +0 -35
  46. data/features/step_definitions/navigation_steps.rb +0 -15
  47. data/features/step_definitions/radio_steps.rb +0 -7
  48. data/features/step_definitions/spinner_steps.rb +0 -18
  49. data/features/step_definitions/tabs_steps.rb +0 -23
  50. data/features/step_definitions/text_steps.rb +0 -15
  51. data/features/step_definitions/tree_view_steps.rb +0 -35
  52. data/features/tabs.feature +0 -22
  53. data/features/text.feature +0 -18
  54. data/features/tree_view.feature +0 -52
  55. data/spec/ffi_stub.rb +0 -16
data/Changelog CHANGED
@@ -1,3 +1,8 @@
1
+ === Version 0.3 / 2014-05-23
2
+ * Enhancements
3
+ * bumping uia dependency to speed up element access when they do not have
4
+ a window handle (i.e. SelectList items, Table rows, etc.)
5
+
1
6
  === Version 0.2.1 / 2014-05-14
2
7
  * Enhancements
3
8
  * bumped uia dependency to make menu item selection faster
@@ -16,6 +16,19 @@ module Mohawk
16
16
  end
17
17
  end
18
18
 
19
+ def required_controls(*controls)
20
+ define_method(:wait_until_present) do
21
+ controls.each do |control|
22
+ super()
23
+ begin
24
+ wait_until { send("#{control}_view").exist? }
25
+ rescue Mohawk::Waiter::WaitTimeout
26
+ raise "Control #{control} was not found on the #{self.class} screen"
27
+ end
28
+ end
29
+ end
30
+ end
31
+
19
32
  #
20
33
  # Defines a locator indicating a child container that is a descendant of
21
34
  # the top-level window
@@ -358,6 +371,9 @@ module Mohawk
358
371
  define_method("#{name}_items") do
359
372
  adapter.tab_control(locator).items
360
373
  end
374
+ define_method("#{name}_view") do
375
+ adapter.tab_control(locator)
376
+ end
361
377
  end
362
378
 
363
379
  def control(name, locator)
@@ -22,7 +22,11 @@ module Mohawk
22
22
  end
23
23
 
24
24
  def clear
25
- set ''
25
+ if is_value?
26
+ set ''
27
+ else
28
+ send_keys [:control, :home], [:control, :shift, :end], :backspace
29
+ end
26
30
  end
27
31
 
28
32
  private
@@ -14,11 +14,7 @@ module Mohawk
14
14
  end
15
15
 
16
16
  def element
17
- @element ||= Uia.find_element(@locator)
18
- if @element && @container
19
- @element = @element.find(@container) || @element
20
- end
21
- @element
17
+ @element ||= locate_element
22
18
  end
23
19
 
24
20
  def send_keys(*keys)
@@ -40,7 +36,7 @@ module Mohawk
40
36
  end
41
37
 
42
38
  def handle
43
- element.handle
39
+ (locate_element && element.handle) || 0
44
40
  end
45
41
 
46
42
  def title
@@ -52,12 +48,21 @@ module Mohawk
52
48
  end
53
49
 
54
50
  def present?
55
- element != nil
51
+ locate_element != nil
56
52
  end
57
53
 
58
54
  def wait_until_present
59
55
  wait_until { element }
60
56
  end
57
+
58
+ private
59
+ def locate_element
60
+ element = Uia.find_element(@locator)
61
+ if element && @container
62
+ element = element.find(@container) || element
63
+ end
64
+ element
65
+ end
61
66
  end
62
67
  end
63
68
  end
@@ -1,3 +1,3 @@
1
1
  module Mohawk
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3"
3
3
  end
data/mohawk.gemspec CHANGED
@@ -18,10 +18,10 @@ 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 'uia', '~> 0.4'
21
+ gem.add_dependency 'uia', '>= 0.4.4'
22
22
  gem.add_dependency 'require_all'
23
23
  gem.add_dependency 'page_navigation', '>= 0.7'
24
- gem.add_dependency 'childprocess', '~> 0.3.9'
24
+ gem.add_dependency 'childprocess', '~> 0.5'
25
25
 
26
26
  gem.add_development_dependency 'cucumber'
27
27
  gem.add_development_dependency 'rspec', '>= 2.12.0'
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'buttons' do
4
+ Given(:main_form) { start_app }
5
+
6
+ context 'pressing' do
7
+ When { main_form.data_entry_form }
8
+ Then { expect(on(DataEntryForm)).to be_present }
9
+ end
10
+
11
+ context '#value' do
12
+ Then { main_form.data_entry_form_value == 'Data Entry Form' }
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'checkboxes' do
4
+ Given(:main_screen) { start_app }
5
+
6
+ Then { main_screen.checkbox_value == 'checkBox' }
7
+ Then { main_screen.checkbox_view.class == Mohawk::Adapters::UIA::CheckBox }
8
+
9
+ context 'setting' do
10
+ Given(:uncheck) { main_screen.checkbox = false }
11
+ Given(:check) { main_screen.checkbox = true }
12
+
13
+ context 'checking' do
14
+ When { check }
15
+ Then { main_screen.checkbox == true }
16
+ end
17
+
18
+ context 'un-checking' do
19
+ When { check; uncheck }
20
+ Then { main_screen.checkbox == false }
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'combo boxes' do
4
+ Given(:main_form) { start_app }
5
+
6
+ context '#combo_box= / #combo_box' do
7
+ context 'by index' do
8
+ When { main_form.fruits = 2 }
9
+ Then { main_form.fruits == 'Coconut' }
10
+ end
11
+
12
+ context 'by value' do
13
+ When { main_form.fruits = 'Coconut' }
14
+ Then { main_form.fruits == 'Coconut' }
15
+ end
16
+
17
+ context 'by Regex' do
18
+ When { main_form.fruits = /[Or]an/ }
19
+ Then { main_form.fruits == 'Orange' }
20
+ end
21
+
22
+ context 'multi-select' do
23
+ Given { main_form.toggle_multi }
24
+ When { (0..2).each {|n| main_form.select_fruits_list n } }
25
+
26
+ Then { main_form.fruits_list_selections == ['Apple', 'Orange', 'Mango'] }
27
+
28
+ context '#clear_' do
29
+ context 'by index' do
30
+ When { main_form.clear_fruits_list 2 }
31
+ Then { main_form.fruits_list_selections == ['Apple', 'Orange'] }
32
+ end
33
+
34
+ context 'by value' do
35
+ When { main_form.clear_fruits_list 'Orange' }
36
+ Then { main_form.fruits_list_selections == ['Apple', 'Mango'] }
37
+ end
38
+
39
+ context 'by Regex' do
40
+ When { main_form.clear_fruits_list /p{2}/ }
41
+ Then { main_form.fruits_list_selections == ['Orange', 'Mango'] }
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ context 'list boxes' do
48
+ # ListBox controls are special with regard to raising events
49
+ When { main_form.fruits_list = 'Orange' }
50
+ Then { main_form.fruits_label == 'Orange' }
51
+ end
52
+ end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'controls' do
4
+ Given(:main_screen) { start_app }
5
+
6
+ Then { main_screen.month_calendar_view.class == Mohawk::Adapters::UIA::ValueControl }
7
+
8
+ context '#control=' do
9
+ When { main_screen.month_calendar = '9/28/1979' }
10
+ Then { main_screen.month_calendar_value == '9/28/1979 12:00:00 AM' }
11
+ end
12
+
13
+ context '#click_' do
14
+ When { main_screen.click_about_control }
15
+ Then { on(About) != nil }
16
+ end
17
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'labels' do
4
+ Given(:main_screen) { start_app }
5
+
6
+ Then { main_screen.sample_label == 'This is a sample text' }
7
+ Then { main_screen.sample_label_view.class == Mohawk::Adapters::UIA::Control }
8
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'links' do
4
+ Given(:main_form) { start_app }
5
+
6
+ Then { main_form.link_label_view.class == Mohawk::Adapters::UIA::Control }
7
+
8
+ context '#link_text' do
9
+ Then { main_form.link_label_text == 'linkLabel1' }
10
+ end
11
+
12
+ context '#click_link' do
13
+ When { main_form.click_link_label }
14
+ Then { main_form.link_label_text == 'linkLabel1 (clicked 1 times)' }
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'menus' do
4
+ Given(:main_form) { start_app }
5
+
6
+ context 'by text' do
7
+ When { main_form.menu_item_by_text }
8
+ Then { on(About).active? }
9
+ end
10
+
11
+ context 'by path' do
12
+ When { main_form.menu_item_by_path }
13
+ Then { on(About).active? }
14
+ end
15
+
16
+ context '#click_menu_item' do
17
+ When { main_form.click_menu_item_by_path }
18
+ Then { on(About).active? }
19
+ end
20
+ end
@@ -0,0 +1,25 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mohawk::Navigation do
4
+ context '#on with extra info' do
5
+ When { start_app }
6
+ Then { on(MainForm, pid: Mohawk.app.pid).present? }
7
+ end
8
+
9
+ context '#navigate_to' do
10
+ Given do
11
+ Mohawk::Navigation.routes = {
12
+ :default => [
13
+ [MainForm, :about],
14
+ [About, :close],
15
+ [MainForm, :data_entry_form],
16
+ [DataEntryForm]
17
+ ]
18
+ }
19
+ start_app
20
+ end
21
+
22
+ When(:data_entry_form) { navigate_to(DataEntryForm) }
23
+ Then { expect(data_entry_form).to be_present }
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'radio buttons' do
4
+ Given(:screen) do
5
+ start_app
6
+ on(Class.new do
7
+ include Mohawk
8
+ window title: /MainForm/
9
+
10
+ radio(:radio_one, id: 'radioButton1')
11
+ label(:status, id: 'radioButtonLabel')
12
+ end)
13
+ end
14
+
15
+ Then { screen.radio_one_view.class == Mohawk::Adapters::UIA::Radio }
16
+
17
+ context '#radio' do
18
+ When { screen.radio_one }
19
+ Then { screen.status == 'Option 1 selected' }
20
+ And { screen.radio_one? == true }
21
+ end
22
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'spinners' do
4
+ Given(:screen) do
5
+ start_app
6
+ on(Class.new do
7
+ include Mohawk
8
+ window(title: /MainForm/)
9
+
10
+ spinner(:spinner, id: 'numericUpDown1')
11
+ end)
12
+ end
13
+
14
+ Then { screen.spinner_view.class == Mohawk::Adapters::UIA::Spinner }
15
+
16
+ context '#spinner=' do
17
+ When { screen.spinner = 50.8 }
18
+ Then { screen.spinner == 50.8 }
19
+ end
20
+
21
+ context '#increment_spinner' do
22
+ When { 5.times { screen.increment_spinner} }
23
+ Then { screen.spinner == 5.0 }
24
+ end
25
+
26
+ context '#decrement_spinner' do
27
+ Given { screen.spinner = 10.0 }
28
+ When { 3.times { screen.decrement_spinner } }
29
+ Then { screen.spinner == 7.0 }
30
+ end
31
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'text controls' do
4
+ Given(:main_form) { start_app }
5
+
6
+ Then { main_form.text_field_view.class == Mohawk::Adapters::UIA::TextBox }
7
+
8
+ context '#text= / #text' do
9
+ context 'edit controls' do
10
+ When { main_form.text_field = 'text we set it to' }
11
+ Then { main_form.text_field == 'text we set it to' }
12
+ end
13
+
14
+ context 'multi-line text fields' do
15
+ When { main_form.multiline_text_field = 'multi-line text we set it to' }
16
+ Then { main_form.multiline_text_field == 'multi-line text we set it to' }
17
+ end
18
+ end
19
+
20
+ context '#clear_text' do
21
+ context 'edit controls' do
22
+ Given { main_form.text_field = 'text to be cleared' }
23
+ When { main_form.clear_text_field }
24
+ Then { main_form.text_field == '' }
25
+ end
26
+
27
+ context 'multi-line text fields' do
28
+ Given { main_form.multiline_text_field = 'multiline text to be cleared' }
29
+ When { main_form.clear_multiline_text_field }
30
+ Then { main_form.multiline_text_field == '' }
31
+ end
32
+ end
33
+
34
+ context '#enter_text' do
35
+ context 'masked edit controls' do
36
+ When { main_form.enter_masked_text_field 'abc12345willnotgoin6789' }
37
+ Then { main_form.masked_text_field == '123-45-6789' }
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,54 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'tree views' do
4
+ Given(:main_screen) { start_app }
5
+
6
+ Then { main_screen.tree_view_view.class == Mohawk::Adapters::UIA::TreeView }
7
+
8
+ context '#tree_view=' do
9
+ context 'by index' do
10
+ When { main_screen.tree_view = 1 }
11
+ Then { main_screen.tree_view == 'Parent Two' }
12
+ end
13
+
14
+ context 'by value' do
15
+ When { main_screen.tree_view = 'Parent Two' }
16
+ Then { main_screen.tree_view == 'Parent Two' }
17
+ end
18
+ end
19
+
20
+ context '#tree_view_items' do
21
+ Then { main_screen.tree_view_items == ['Parent One', 'Parent Two'] }
22
+ end
23
+
24
+ context '#expand/collapse_tree_view' do
25
+ Given(:original_items) { ['Parent One', 'Parent Two'] }
26
+ Given(:expected_items) { ['Parent One', 'Child 1', 'Child 2', 'Parent Two'] }
27
+
28
+ context 'by index' do
29
+ When { main_screen.expand_tree_view_item 0 }
30
+
31
+ context 'expand' do
32
+ Then { main_screen.tree_view_items == expected_items}
33
+ end
34
+
35
+ context 'collapse' do
36
+ When { main_screen.collapse_tree_view_item 0 }
37
+ Then { main_screen.tree_view_items == original_items }
38
+ end
39
+ end
40
+
41
+ context 'by value' do
42
+ When { main_screen.expand_tree_view_item 'Parent One' }
43
+
44
+ context 'expand' do
45
+ Then { main_screen.tree_view_items == expected_items}
46
+ end
47
+
48
+ context 'collapse' do
49
+ When { main_screen.collapse_tree_view_item 'Parent One' }
50
+ Then { main_screen.tree_view_items == original_items}
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,84 @@
1
+ require 'spec_helper'
2
+
3
+ describe Mohawk::Adapters::UIA::Window do
4
+ Given(:main_form) { start_app }
5
+ Given!(:not_created_form) { MainForm.new }
6
+ Given(:about) { main_form.about; on(About) }
7
+
8
+ context 'container' do
9
+ Given(:container) do
10
+ start_app
11
+ on(Class.new do
12
+ include Mohawk
13
+ window(title: /MainForm/)
14
+ parent(id: 'numericUpDown')
15
+ end)
16
+ end
17
+
18
+ Then { container.adapter.window.title == 'linkLabel1' }
19
+ end
20
+
21
+ context 'children_only' do
22
+ Given(:limit_scope) do
23
+ start_app.data_grid_view
24
+ on(Class.new do
25
+ include Mohawk
26
+ window(title: /DataGridViewForm/, children_only: true)
27
+
28
+ button(:close, :value => 'Close')
29
+ end)
30
+ end
31
+
32
+ When(:time_it_took) { Benchmark.measure { limit_scope.close } }
33
+ Then { time_it_took.real < 2 }
34
+ end
35
+
36
+ context '#active?' do
37
+ Then { not_created_form.active? == false }
38
+ Then { main_form.active? == true }
39
+
40
+ context 'inactive --> active' do
41
+ Given { about }
42
+ When { about.close; Mohawk::Waiter.wait_until { !about.present? } }
43
+ Then { not_created_form.active? == true }
44
+ end
45
+
46
+ context 'active --> inactive' do
47
+ Given { expect(main_form).to be_active }
48
+ When { about }
49
+ Then { main_form.active? == false }
50
+ end
51
+ end
52
+
53
+ context '#present?' do
54
+ Then { about.present? == true }
55
+
56
+ context 'closing / opening' do
57
+ When { about.close }
58
+ Then { about.present? == false }
59
+ end
60
+ end
61
+
62
+ context '#exist?' do
63
+ Then { not_created_form.exist? == false }
64
+
65
+ context 'not there --> there' do
66
+ When { start_app }
67
+ Then { not_created_form.exist? == true }
68
+ end
69
+
70
+ context 'there --> not there' do
71
+ Given { main_form }
72
+ When { main_form.close }
73
+ Then { main_form.exist? == false }
74
+ end
75
+ end
76
+
77
+ context '#has_text?' do
78
+ Then { expect(main_form).to have_text 'Assorted UI Elements' }
79
+ end
80
+
81
+ context '#wait_for_control' do
82
+ Then { main_form.wait_for_control value: 'Data Entry Form' }
83
+ end
84
+ end
@@ -103,6 +103,31 @@ describe Mohawk do
103
103
  end
104
104
  end
105
105
 
106
+ context '#required_controls' do
107
+ Given { start_app; Mohawk.timeout = 1 }
108
+ Given(:has_controls) do
109
+ Class.new do
110
+ include Mohawk
111
+ window title: /MainForm/
112
+ required_controls :about, :data_grid_view
113
+ button(:about, value: 'About')
114
+ button(:data_grid_view, value: 'Data Grid View')
115
+ end
116
+ end
117
+ Given(:missing_controls) do
118
+ Class.new do
119
+ include Mohawk
120
+ window title: /MainForm/
121
+ required_controls :something
122
+
123
+ button(:something, id: 'notThere')
124
+ end
125
+ end
126
+
127
+ Then { on(has_controls) != nil }
128
+ Then { expect { on(missing_controls) }.to raise_error /Control something was not found on the #<Class:0x.*> screen/ }
129
+ end
130
+
106
131
  context Mohawk::Adapters do
107
132
  Given(:screen) { TestScreen.new }
108
133
  Given(:window) { double('window').as_null_object }
@@ -0,0 +1,7 @@
1
+ class About
2
+ include Mohawk
3
+ window title: 'About'
4
+
5
+ button(:close, id: 'Close')
6
+ tabs(:tab, id: 'tabControl1')
7
+ end
@@ -0,0 +1,4 @@
1
+ class DataEntryForm
2
+ include Mohawk
3
+ window title: 'DataEntryForm'
4
+ end
@@ -0,0 +1,32 @@
1
+ class MainForm
2
+ include Mohawk
3
+ window title: /MainForm/
4
+
5
+ text(:text_field, id: 'textField')
6
+ text(:masked_text_field, :id => 'maskedTextBox')
7
+ text(:multiline_text_field, id: 'multiLineTextField')
8
+
9
+ button(:close, id: 'Close')
10
+ button(:about, id: 'aboutButton')
11
+ button(:data_entry_form, value: 'Data Entry Form')
12
+ button(:data_grid_view, value: 'Data Grid View')
13
+ button(:toggle_multi, value: 'Toggle Multi-Select')
14
+
15
+ checkbox(:checkbox, id: 'checkBox')
16
+
17
+ combo_box(:fruits, id: 'FruitsComboBox')
18
+ select_list(:fruits_list, id: 'FruitListBox')
19
+
20
+ tree_view(:tree_view, id: 'treeView')
21
+
22
+ label(:sample_label, id: 'label1')
23
+ label(:fruits_label, :id => 'fruitsLabel')
24
+
25
+ link(:link_label, id: 'linkLabel1')
26
+
27
+ menu_item(:menu_item_by_path, path: ['File', 'Roundabout Way', 'To', 'About'])
28
+ menu_item(:menu_item_by_text, text: 'About')
29
+
30
+ control(:month_calendar, id: 'automatableMonthCalendar1')
31
+ control(:about_control, id: 'aboutButton')
32
+ end
data/spec/spec_helper.rb CHANGED
@@ -4,8 +4,26 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
  require 'rspec'
5
5
  require 'rspec/mocks'
6
6
  require 'rspec-given'
7
- require 'ffi_stub'
8
7
  require 'mohawk'
9
8
  require 'coveralls'
9
+ require 'benchmark'
10
+
11
+ require 'require_all'
12
+ require_rel 'screens'
10
13
 
11
14
  Coveralls.wear!
15
+
16
+ include Mohawk::Navigation
17
+
18
+ def start_app
19
+ Mohawk.app_path = 'features/support/WindowsForms.exe'
20
+ Mohawk.start
21
+ on(MainForm)
22
+ end
23
+
24
+ RSpec.configure do |config|
25
+ config.after(:each) do
26
+ Mohawk.stop if Mohawk.app
27
+ Mohawk.timeout = 60
28
+ end
29
+ end
data/spec/tabs_spec.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'tabs' do
4
+ Given(:screen) { start_app.about; on(About) }
5
+
6
+ Then { screen.tab == 'Info' }
7
+ Then { screen.tab_items == ['Info', 'Other Info'] }
8
+ Then { screen.tab_view.class == Mohawk::Adapters::UIA::TabControl }
9
+
10
+ context '#select_tab' do
11
+ context 'by index' do
12
+ When { screen.tab = 1 }
13
+ Then { screen.tab == 'Other Info' }
14
+ end
15
+
16
+ context 'by value' do
17
+ When { screen.tab = 'Other Info' }
18
+ When { screen.tab == 'Other Info' }
19
+ end
20
+
21
+ context 'by Regex' do
22
+ When { screen.tab = /[Oo]th/ }
23
+ Then { screen.tab == 'Other Info' }
24
+ end
25
+ end
26
+ end