bryan-ash-wx-nobbie 0.0.3.3 → 0.0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/README.txt +153 -0
  2. metadata +3 -3
@@ -0,0 +1,153 @@
1
+ = Wx-Nobbie -- An implementation of the Nobbie GUI Driving API for WxRuby2
2
+
3
+ Nobbie is a simple generic api for driving GUI's (both web and rich-client interfaces). This
4
+ particular implementation is for driving WxRuby2 applications. There are other implementations available for
5
+ driving Java Swing and Web Applications - but they all use the same generic API.
6
+
7
+ Nobbie attempts to make the driving of UI's as simple as possible. Whereas most UI drivers tend to give you multiple
8
+ ways to find components and subsequently multiple ways to interact with them, Nobbie's philosophy is:
9
+
10
+ * finding components by name is the simplest, least brittle approach.
11
+ * *most* UI interactions boil down to: *typing*, *choosing* and *clicking*
12
+
13
+ (Note: if you can't sleep without the ability to find things using xpath or whatever, there are hooks to specify your
14
+ own component finding strategies).
15
+
16
+ With this in mind, Nobbie provides a simple method of {finding components}[link:classes/Nobbie/Wx/ElementPathBuilder.html]
17
+ and a simple set of {Operations}[link:classes/Nobbie/Wx/Operations.html] to perform on them.
18
+
19
+ A quick overview with examples:
20
+
21
+ * Paths ...
22
+
23
+ In order to perform operations[link:classes/Nobbie/Wx/Operations.html] on a component, you need to first find it.
24
+ Only very simple 'named' paths are supported by default (but you can implement your own by providing an object that
25
+ responds to 'find_component'). When specifying a path, if you do not provide an object that responds to
26
+ 'find_component', Nobbie will attempt to coerce the path into the default path type: Nobbie::Wx::ElementPathBuilder.
27
+
28
+ That may sound complicated but its really just sugar. The following paths will all find the component
29
+ named 'text_ctrl':
30
+
31
+ 'text_ctrl'
32
+ :in => 'text_ctrl'
33
+ in_('text_ctrl')
34
+ Nobbie::Wx::ElementPathBuilder.new('text_ctrl')
35
+ :text_ctrl
36
+
37
+
38
+ * Typing[link:classes/Nobbie/Wx/Operations.html#type] ...
39
+
40
+ type(value, path)
41
+
42
+ e.g.
43
+
44
+ type('fred', in_('first_name'))
45
+
46
+ ...or if you're one of those DSL/anglification people
47
+
48
+ type 'fred', :in => 'first_name'
49
+ type 'fred', 'first_name'
50
+ type 'fred', :first_name
51
+
52
+ This will find the component named 'first_name' and type 'fred' into it.
53
+ ...this works for anything you can type into, see:
54
+ {supported components}[link:classes/Nobbie/Wx/Operations.html#type].
55
+
56
+
57
+ * Selecting[link:classes/Nobbie/Wx/Operations.html#selection] ...
58
+
59
+ selection(path).choose(value)
60
+
61
+ e.g.
62
+
63
+ selection(in_('title')).choose('Mr')
64
+
65
+ ...or
66
+
67
+ selection(:in => 'title').choose 'Mr'
68
+ selection('title').choose 'Mr'
69
+ selection(:title).choose 'Mr'
70
+
71
+ This will find the component named 'title' and select 'Mr'.
72
+ ...this works for anything where you can make a selection from a number of options
73
+ (which is quite a lot of things), see:
74
+ {supported components}[link:classes/Nobbie/Wx/SelectOperations.html#selection].
75
+
76
+ You can get the value of the current selection using:
77
+
78
+ selection(path).selected_value
79
+
80
+
81
+ * Clicking[link:classes/Nobbie/Wx/Operations.html#click] ...
82
+
83
+ click(path) (for buttons you can also use the label instead of a path)
84
+
85
+ e.g.
86
+
87
+ click('save')
88
+
89
+ ...or
90
+
91
+ click 'save'
92
+ click :save
93
+ etc
94
+
95
+ This will find the component named (or labelled) 'save' and click it.
96
+ ...this works for anything you can click, see:
97
+ {supported components}[link:classes/Nobbie/Wx/Operations.html#click].
98
+
99
+
100
+ * Choosing[link:classes/Nobbie/Wx/Operations.html#choosable] ...
101
+
102
+ choosable(path).choose
103
+
104
+ e.g.
105
+
106
+ choosable(in_('female')).choose
107
+
108
+ ...or
109
+
110
+ choosable(:in => 'female').choose
111
+ choosable('female').choose
112
+ choosable(:female).choose
113
+
114
+ This will find the component named 'female' and choose it
115
+ ...this works for anything that has a chosen/non-chosen state, see:
116
+ {supported components}[link:classes/Nobbie/Wx/ChoosableOperations.html#choose].
117
+
118
+ You can determine if a component is currently chosen using:
119
+
120
+ choosable(path).chosen?
121
+
122
+ Hopefully that makes some degree of sense, there are a few other operations available, that should be self
123
+ explanatory from the documentation[link:classes/Nobbie/Wx/Operations.html].
124
+
125
+ * Writing that first test ...
126
+
127
+ By default Nobbie hooks into test/unit. However, due to a Wx limitation its not possible to launch a new
128
+ instance of your application for every test run (this would also be very slow anyway). So, instead Nobbie
129
+ will launch your application, run all the tests in your suite and then close down the application. (Note: If
130
+ anyone has a better solution to this ... please let me know).
131
+
132
+ In order for this to happen, you must advise Nobbie which application you wish to test by setting the constant
133
+ APPLICATION_UNDER_TEST to an instance of your application, i.e.:
134
+
135
+ require 'rubygems'
136
+ require_gem 'nobbie-wx-preview'
137
+
138
+ require 'your_application'
139
+ require 'your_test_suite'
140
+
141
+ APPLICATION_UNDER_TEST = YourApp.new
142
+
143
+ Finally, to prevent your application being loaded when its file is 'required', edit your application startup
144
+ as follows:
145
+
146
+ YourApp.new.main_loop if __FILE__ == $0
147
+
148
+ * More examples ...
149
+
150
+ Nobbie has a suite of tests which are installed as part of the gem. Take a look at the 'test' directory.
151
+
152
+
153
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bryan-ash-wx-nobbie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3.3
4
+ version: 0.0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Alton
@@ -41,7 +41,7 @@ extra_rdoc_files: []
41
41
 
42
42
  files:
43
43
  - KNOWN_ISSUES
44
- - README
44
+ - README.txt
45
45
  - lib/nobbie/wx/acceptance_test.rb
46
46
  - lib/nobbie/wx/command.rb
47
47
  - lib/nobbie/wx/command_executor.rb
@@ -77,7 +77,7 @@ homepage: http://github.com/bryan-ash/wx-nobbie
77
77
  post_install_message:
78
78
  rdoc_options:
79
79
  - --main
80
- - README
80
+ - README.txt
81
81
  - --inline-source
82
82
  - --charset=UTF-8
83
83
  require_paths: