bret-watircraft 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/BUGS.txt +11 -0
- data/History.txt +209 -0
- data/Manifest.txt +103 -0
- data/README.rdoc +75 -0
- data/VERSION.yml +4 -0
- data/app_generators/watircraft/USAGE +11 -0
- data/app_generators/watircraft/templates/config.yml.erb +3 -0
- data/app_generators/watircraft/templates/feature_helper.rb +12 -0
- data/app_generators/watircraft/templates/initialize.rb.erb +10 -0
- data/app_generators/watircraft/templates/rakefile.rb +3 -0
- data/app_generators/watircraft/templates/script/console +5 -0
- data/app_generators/watircraft/templates/script/console.cmd +1 -0
- data/app_generators/watircraft/templates/site_start.rb.erb +12 -0
- data/app_generators/watircraft/templates/spec_helper.rb +9 -0
- data/app_generators/watircraft/templates/spec_initialize.rb +16 -0
- data/app_generators/watircraft/templates/world.rb +12 -0
- data/app_generators/watircraft/watircraft_generator.rb +108 -0
- data/bin/watircraft +17 -0
- data/lib/extensions/array.rb +10 -0
- data/lib/extensions/hash.rb +5 -0
- data/lib/extensions/object.rb +24 -0
- data/lib/extensions/string.rb +17 -0
- data/lib/extensions/watir.rb +41 -0
- data/lib/taza/browser.rb +45 -0
- data/lib/taza/entity.rb +34 -0
- data/lib/taza/fixture.rb +66 -0
- data/lib/taza/flow.rb +40 -0
- data/lib/taza/page.rb +259 -0
- data/lib/taza/settings.rb +80 -0
- data/lib/taza/site.rb +227 -0
- data/lib/taza/tasks.rb +30 -0
- data/lib/taza.rb +35 -0
- data/lib/watircraft/generator_helper.rb +27 -0
- data/lib/watircraft/table.rb +56 -0
- data/lib/watircraft/version.rb +3 -0
- data/lib/watircraft.rb +1 -0
- data/spec/array_spec.rb +16 -0
- data/spec/browser_spec.rb +68 -0
- data/spec/entity_spec.rb +9 -0
- data/spec/fake_table.rb +34 -0
- data/spec/fixture_spec.rb +34 -0
- data/spec/fixtures_spec.rb +21 -0
- data/spec/hash_spec.rb +12 -0
- data/spec/object_spec.rb +29 -0
- data/spec/page_generator_spec.rb +111 -0
- data/spec/page_spec.rb +342 -0
- data/spec/project_generator_spec.rb +103 -0
- data/spec/sandbox/config/config.yml +1 -0
- data/spec/sandbox/config/environments.yml +4 -0
- data/spec/sandbox/config/simpler.yml +1 -0
- data/spec/sandbox/config/simpler_site.yml +2 -0
- data/spec/sandbox/config.yml +2 -0
- data/spec/sandbox/fixtures/examples.yml +8 -0
- data/spec/sandbox/fixtures/users.yml +2 -0
- data/spec/sandbox/flows/batman.rb +5 -0
- data/spec/sandbox/flows/robin.rb +4 -0
- data/spec/sandbox/pages/foo/bar_page.rb +9 -0
- data/spec/sandbox/pages/foo/partials/partial_the_reckoning.rb +2 -0
- data/spec/settings_spec.rb +103 -0
- data/spec/site_generator_spec.rb +62 -0
- data/spec/site_spec.rb +249 -0
- data/spec/spec_generator_helper.rb +40 -0
- data/spec/spec_generator_spec.rb +24 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/steps_generator_spec.rb +29 -0
- data/spec/string_spec.rb +17 -0
- data/spec/table_spec.rb +32 -0
- data/spec/taza_spec.rb +12 -0
- data/spec/watircraft_bin_spec.rb +14 -0
- data/watircraft.gemspec +53 -0
- data/watircraft_generators/page/USAGE +11 -0
- data/watircraft_generators/page/page_generator.rb +65 -0
- data/watircraft_generators/page/templates/page.rb.erb +8 -0
- data/watircraft_generators/site/site_generator.rb +51 -0
- data/watircraft_generators/site/templates/environments.yml.erb +4 -0
- data/watircraft_generators/site/templates/site.rb.erb +10 -0
- data/watircraft_generators/spec/USAGE +8 -0
- data/watircraft_generators/spec/spec_generator.rb +54 -0
- data/watircraft_generators/spec/templates/spec.rb.erb +17 -0
- data/watircraft_generators/steps/USAGE +13 -0
- data/watircraft_generators/steps/steps_generator.rb +62 -0
- data/watircraft_generators/steps/templates/steps.rb.erb +12 -0
- metadata +229 -0
data/BUGS.txt
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Known Bugs
|
2
|
+
|
3
|
+
* Support for FireWatir is incomplete (specifically: Page fields)
|
4
|
+
* Page fields do not support Radio lists.
|
5
|
+
* Need to provide homepage for project.
|
6
|
+
|
7
|
+
Reported Bugs which we can't reproduce
|
8
|
+
|
9
|
+
* "Couldn't find 'site' generator" when running watircraft command.
|
10
|
+
(using 0.3.1, neither taza nor watircraft-beta is also installed)
|
11
|
+
|
data/History.txt
ADDED
@@ -0,0 +1,209 @@
|
|
1
|
+
=== 0.4.0 / 2009-02-23
|
2
|
+
|
3
|
+
You will need to run "watircraft ." at the root of your project in order to
|
4
|
+
update your test suite to work with this version of the WatirCraft Framework.
|
5
|
+
|
6
|
+
Summary
|
7
|
+
|
8
|
+
* Code for cucumber or rspec now runs in the same context. There is also a new
|
9
|
+
console that allows you to run code in the same context. This should vastly
|
10
|
+
simplify learnability and debugging options. Please try out the new script
|
11
|
+
console.
|
12
|
+
|
13
|
+
* Added support for tables. Please see the rdoc for Page#table for details on
|
14
|
+
how to use this.
|
15
|
+
|
16
|
+
Details on New Features
|
17
|
+
|
18
|
+
* Added script/console. This provides an interactive Ruby shell (irb) that
|
19
|
+
executes in the context of your site. Hopefully a useful learning and
|
20
|
+
debugging tool.
|
21
|
+
|
22
|
+
* Added new methods primarily intended to be used from within the script/console.
|
23
|
+
In the default context (site), there is "pages" which returns a list of the
|
24
|
+
pages defined for the site. In the context of a page, there are "elements" and
|
25
|
+
"fields". And also "elements_exist?" and "values". To get better formatted
|
26
|
+
results, type "y" before these commands.
|
27
|
+
|
28
|
+
* Rspec tests ("describe" & "it") now execute in the context of a site, or at least
|
29
|
+
something very similar. This makes it easier to share libraries between
|
30
|
+
rspec and cucumber tests. Also easier to translate learning from one to the
|
31
|
+
other.
|
32
|
+
|
33
|
+
* Added Site#page method. Now, site.page("check out") is the same as
|
34
|
+
site.check_out_page
|
35
|
+
|
36
|
+
* You can now use strings as arguments to Page.element and Page.field. These
|
37
|
+
strings can even be in "human-form" with spaces and capitolization. They will
|
38
|
+
automatically be "computerized".
|
39
|
+
|
40
|
+
Other Changes
|
41
|
+
|
42
|
+
* Site#origin now returns the base url of the site. (Was: Site#url).
|
43
|
+
|
44
|
+
* Hard-coded dependencies on Cucumber 0.1.16 and Rspec 1.1.12. Previously,
|
45
|
+
watircraft would install the latest versions of these gems, which could
|
46
|
+
create inconsistencies if installed over time on different machines. Now
|
47
|
+
this won't happen. However, if newer versions are installed on your machine,
|
48
|
+
they will be used.
|
49
|
+
|
50
|
+
* Updated to use Cucumber 0.1.16 instead of 0.1.13.
|
51
|
+
|
52
|
+
* Explicitly declare dependency on Watir 1.6.2 (or newer). Previously this
|
53
|
+
was assumed.
|
54
|
+
|
55
|
+
|
56
|
+
=== 0.3.2 / 2009-02-04
|
57
|
+
|
58
|
+
Another patch release. Like 0.3.1, no need to update if your project is
|
59
|
+
already at 0.3.x
|
60
|
+
|
61
|
+
* Fix "undefined method display_value" error that appeared when creating
|
62
|
+
page fields with links or parents.
|
63
|
+
|
64
|
+
=== 0.3.1 / 2009-02-03
|
65
|
+
|
66
|
+
This patch release includes some fixes and an improved updater.
|
67
|
+
|
68
|
+
Update Notes
|
69
|
+
|
70
|
+
You can update an existing project created with a previous release
|
71
|
+
by typing "watircraft ." in root of your project.
|
72
|
+
(That is _watircraft space period_.)
|
73
|
+
|
74
|
+
If your project was created with or already updated to 0.3.0, you do not
|
75
|
+
need to update (although it won't hurt if you do).
|
76
|
+
|
77
|
+
If your project was created with beta2 or previous, you will need to update
|
78
|
+
to use this version.
|
79
|
+
|
80
|
+
Improvements to Updater
|
81
|
+
|
82
|
+
* When using "watircraft" to update an existing project, you no longer
|
83
|
+
have to specify the site name.
|
84
|
+
* When updating, the "correct" files will automatically be replaced.
|
85
|
+
* The initialize.rb file is now stamped with the time and version.
|
86
|
+
|
87
|
+
Fixes
|
88
|
+
|
89
|
+
* Automatically install cucumber when installing watircraft.
|
90
|
+
* Allow pages to be specified in camel case (or not) in the page generator.
|
91
|
+
* Changed method of declaring dependencies in an attempt to fix reported
|
92
|
+
"could not find site generator" error which I cannot reproduce.
|
93
|
+
* Improved documentation for generators. (Type "watircraft" or
|
94
|
+
"script\generate page" to see this.)
|
95
|
+
* You can now use the cucumber command from inside the tests/features
|
96
|
+
directory (previously it would only work from project root).
|
97
|
+
|
98
|
+
=== 0.3.0 / 2009-02-02
|
99
|
+
|
100
|
+
Repackaged as watircraft gem version 0.3.0.
|
101
|
+
|
102
|
+
Features
|
103
|
+
|
104
|
+
* You can now get a list of the script/generate commands that are available to
|
105
|
+
you by typing "script/generate" from the root of your project. Currently these
|
106
|
+
are *page*, *spec* and *steps*. However, additional generators will be made
|
107
|
+
available in future versions of this framework, as well as other plug-ins.
|
108
|
+
|
109
|
+
Installation Instructions
|
110
|
+
|
111
|
+
gem install watircraft
|
112
|
+
|
113
|
+
Update Instructions
|
114
|
+
|
115
|
+
If you have a project created with a prior version of watircraft (aka taza), you
|
116
|
+
will need to do the following.
|
117
|
+
|
118
|
+
# Open a command shell to the root of your project (i.e. where you type
|
119
|
+
rake commands).
|
120
|
+
# Type "watircraft . --site=your_site_name". This will add some files and
|
121
|
+
ask whether you want
|
122
|
+
to replace several files. Say yes ('y') and replace the following files (only):
|
123
|
+
|
124
|
+
* script/destroy
|
125
|
+
* script/generate
|
126
|
+
* feature_helper.rb
|
127
|
+
* spec_helper.rb
|
128
|
+
* world.rb
|
129
|
+
|
130
|
+
User Visible Changes
|
131
|
+
|
132
|
+
* Renamed gem from "taza" to "watircraft".
|
133
|
+
* Rename "taza" command to "watircraft".
|
134
|
+
* Removed flow generator. Plan is to use Watirloo's use case class instead.
|
135
|
+
* Now uses rspec version 1.1.12.
|
136
|
+
* Added Readme and History files.
|
137
|
+
* Added initialize.rb file to test projects. This will simplify future updates.
|
138
|
+
* The "watircraft" command now takes an option to specify a site.
|
139
|
+
|
140
|
+
Technical Changes
|
141
|
+
|
142
|
+
* Merged in changes from Taza 0.8.2., including
|
143
|
+
* Fix a bug in filters leading to infinite regress.
|
144
|
+
* Added rake task for Manifest.txt.
|
145
|
+
* Renamed generator_helper from taza to watircraft.
|
146
|
+
* Removed partials. Need to review how to provide this functionality in
|
147
|
+
watircraft.
|
148
|
+
* Taza generators are now WatirCraft generators.
|
149
|
+
* Executable version number is now automatically built from VERSION.yml.
|
150
|
+
(With taza, you had to maintain this by hand)
|
151
|
+
|
152
|
+
Known Bugs
|
153
|
+
|
154
|
+
* Need to provide homepage for project.
|
155
|
+
|
156
|
+
=== Beta 2 / 2009-01-23
|
157
|
+
|
158
|
+
Fixes
|
159
|
+
|
160
|
+
* Updated documentation for Taza::Page. It includes details on the element and
|
161
|
+
field commands.
|
162
|
+
* Fix bug preventing the cucumber command from working.
|
163
|
+
|
164
|
+
Known Bugs
|
165
|
+
|
166
|
+
* Cucumber command will only work when run from the root of the project.
|
167
|
+
|
168
|
+
Update Notes
|
169
|
+
|
170
|
+
Like Beta 1, this is delivered as a gem called taza version 0.8.1. You should
|
171
|
+
delete that one before installing this one.
|
172
|
+
|
173
|
+
If you already have a project created with Beta 1, you will need to add the
|
174
|
+
following code to the top of your lib/<project_name>.rb file:
|
175
|
+
|
176
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(FILE), '..')) unless defined?(APP_ROOT)
|
177
|
+
|
178
|
+
=== Beta 1 / 2009-01-14
|
179
|
+
|
180
|
+
Forked from Taza 0.8.1.
|
181
|
+
|
182
|
+
Summary of Features
|
183
|
+
|
184
|
+
* Tests can be configured to work with different environments.
|
185
|
+
* Rich page classes simplify tests, and make theme easier to read and maintain.
|
186
|
+
* Support for both rspec and cucumber style tests.
|
187
|
+
* Defined pages can be used with both rspec and cucumber tests.
|
188
|
+
* Generate scripts create templates for pages, specs (rspec tests) and steps (for cucumber tests).
|
189
|
+
|
190
|
+
Known Bugs
|
191
|
+
|
192
|
+
* Support for FireWatir is incomplete (specifically: Page fields)
|
193
|
+
* Flows are not supported.
|
194
|
+
* Need to merge with latest version of taza/master.
|
195
|
+
* Need to update to latest version of rspec (1.1.12)
|
196
|
+
* Page fields do not support Radio lists.
|
197
|
+
|
198
|
+
Differences from Taza/Master
|
199
|
+
|
200
|
+
* Only supports a single site per project
|
201
|
+
* Simplified directory structure
|
202
|
+
* Added support for cucumber
|
203
|
+
* Added spec generator (rspec).
|
204
|
+
* Addition of Page fields.
|
205
|
+
* Simplified config files.
|
206
|
+
|
207
|
+
This version is delivered as a gem purporting to be taza version 0.8.1. This
|
208
|
+
will be fixed in a future release.
|
209
|
+
|
data/Manifest.txt
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
BUGS.txt
|
2
|
+
History.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.rdoc
|
5
|
+
VERSION.yml
|
6
|
+
watircraft.gemspec
|
7
|
+
bin/watircraft
|
8
|
+
lib/extensions
|
9
|
+
lib/extensions/array.rb
|
10
|
+
lib/extensions/hash.rb
|
11
|
+
lib/extensions/object.rb
|
12
|
+
lib/extensions/string.rb
|
13
|
+
lib/extensions/watir.rb
|
14
|
+
lib/taza
|
15
|
+
lib/taza/browser.rb
|
16
|
+
lib/taza/entity.rb
|
17
|
+
lib/taza/fixture.rb
|
18
|
+
lib/taza/flow.rb
|
19
|
+
lib/taza/page.rb
|
20
|
+
lib/taza/settings.rb
|
21
|
+
lib/taza/site.rb
|
22
|
+
lib/taza/tasks.rb
|
23
|
+
lib/taza.rb
|
24
|
+
lib/watircraft
|
25
|
+
lib/watircraft/generator_helper.rb
|
26
|
+
lib/watircraft/table.rb
|
27
|
+
lib/watircraft/version.rb
|
28
|
+
lib/watircraft.rb
|
29
|
+
spec/array_spec.rb
|
30
|
+
spec/browser_spec.rb
|
31
|
+
spec/entity_spec.rb
|
32
|
+
spec/fake_table.rb
|
33
|
+
spec/fixtures_spec.rb
|
34
|
+
spec/fixture_spec.rb
|
35
|
+
spec/hash_spec.rb
|
36
|
+
spec/object_spec.rb
|
37
|
+
spec/page_generator_spec.rb
|
38
|
+
spec/page_spec.rb
|
39
|
+
spec/project_generator_spec.rb
|
40
|
+
spec/sandbox
|
41
|
+
spec/sandbox/config
|
42
|
+
spec/sandbox/config/config.yml
|
43
|
+
spec/sandbox/config/environments.yml
|
44
|
+
spec/sandbox/config/simpler.yml
|
45
|
+
spec/sandbox/config/simpler_site.yml
|
46
|
+
spec/sandbox/config.yml
|
47
|
+
spec/sandbox/fixtures
|
48
|
+
spec/sandbox/fixtures/examples.yml
|
49
|
+
spec/sandbox/fixtures/users.yml
|
50
|
+
spec/sandbox/flows
|
51
|
+
spec/sandbox/flows/batman.rb
|
52
|
+
spec/sandbox/flows/robin.rb
|
53
|
+
spec/sandbox/pages
|
54
|
+
spec/sandbox/pages/foo
|
55
|
+
spec/sandbox/pages/foo/bar_page.rb
|
56
|
+
spec/sandbox/pages/foo/partials
|
57
|
+
spec/sandbox/pages/foo/partials/partial_the_reckoning.rb
|
58
|
+
spec/settings_spec.rb
|
59
|
+
spec/site_generator_spec.rb
|
60
|
+
spec/site_spec.rb
|
61
|
+
spec/spec_generator_helper.rb
|
62
|
+
spec/spec_generator_spec.rb
|
63
|
+
spec/spec_helper.rb
|
64
|
+
spec/steps_generator_spec.rb
|
65
|
+
spec/string_spec.rb
|
66
|
+
spec/table_spec.rb
|
67
|
+
spec/taza_spec.rb
|
68
|
+
spec/watircraft_bin_spec.rb
|
69
|
+
app_generators/watircraft
|
70
|
+
app_generators/watircraft/templates
|
71
|
+
app_generators/watircraft/templates/config.yml.erb
|
72
|
+
app_generators/watircraft/templates/feature_helper.rb
|
73
|
+
app_generators/watircraft/templates/initialize.rb.erb
|
74
|
+
app_generators/watircraft/templates/rakefile.rb
|
75
|
+
app_generators/watircraft/templates/script
|
76
|
+
app_generators/watircraft/templates/script/console
|
77
|
+
app_generators/watircraft/templates/script/console.cmd
|
78
|
+
app_generators/watircraft/templates/site_start.rb.erb
|
79
|
+
app_generators/watircraft/templates/spec_helper.rb
|
80
|
+
app_generators/watircraft/templates/spec_initialize.rb
|
81
|
+
app_generators/watircraft/templates/world.rb
|
82
|
+
app_generators/watircraft/USAGE
|
83
|
+
app_generators/watircraft/watircraft_generator.rb
|
84
|
+
watircraft_generators/page
|
85
|
+
watircraft_generators/page/page_generator.rb
|
86
|
+
watircraft_generators/page/templates
|
87
|
+
watircraft_generators/page/templates/page.rb.erb
|
88
|
+
watircraft_generators/page/USAGE
|
89
|
+
watircraft_generators/site
|
90
|
+
watircraft_generators/site/site_generator.rb
|
91
|
+
watircraft_generators/site/templates
|
92
|
+
watircraft_generators/site/templates/environments.yml.erb
|
93
|
+
watircraft_generators/site/templates/site.rb.erb
|
94
|
+
watircraft_generators/spec
|
95
|
+
watircraft_generators/spec/spec_generator.rb
|
96
|
+
watircraft_generators/spec/templates
|
97
|
+
watircraft_generators/spec/templates/spec.rb.erb
|
98
|
+
watircraft_generators/spec/USAGE
|
99
|
+
watircraft_generators/steps
|
100
|
+
watircraft_generators/steps/steps_generator.rb
|
101
|
+
watircraft_generators/steps/templates
|
102
|
+
watircraft_generators/steps/templates/steps.rb.erb
|
103
|
+
watircraft_generators/steps/USAGE
|
data/README.rdoc
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
= WatirCraft
|
2
|
+
|
3
|
+
== DESCRIPTION
|
4
|
+
|
5
|
+
WatirCraft is a testing framework that builds on Watir.
|
6
|
+
It allows tests to be expressed as Rspec or Cucumber tests and provides
|
7
|
+
a library structure to support maintainable testing. It gives you
|
8
|
+
a place to put things.
|
9
|
+
|
10
|
+
* http://testobsessed.com/2008/05/31/a-place-to-put-things/
|
11
|
+
|
12
|
+
== FEATURES
|
13
|
+
|
14
|
+
* Generate a directory structure for your test suite with one command.
|
15
|
+
* Provides page adapters you can customize for your application.
|
16
|
+
* Configure application URL and browser type (IE, Firefox) in one location.
|
17
|
+
* Framework automatically initializes browser for testing.
|
18
|
+
|
19
|
+
== APPROACH
|
20
|
+
|
21
|
+
WatirCraft is an object-oriented testing framework that helps you create
|
22
|
+
class libraries to support the tests for your application. On their own,
|
23
|
+
many testers have created procedural libraries for testing because they
|
24
|
+
understand these and find them easier to create and understand.
|
25
|
+
|
26
|
+
Although object-oriented frameworks like WatirCraft are somewhat more difficult
|
27
|
+
to understand at first, they are easier to customize and upgrade. As we add
|
28
|
+
more features to the WatirCraft framework, your test suite will automatically
|
29
|
+
get the benefit.
|
30
|
+
|
31
|
+
== INSTALL
|
32
|
+
|
33
|
+
* gem update --system
|
34
|
+
* gem install watircraft
|
35
|
+
|
36
|
+
== EXAMPLE
|
37
|
+
|
38
|
+
An example test suite for this framework can be found in the framework
|
39
|
+
examples project on github. Look in the watircraft directory.
|
40
|
+
* http://github.com/bret/framework-examples/
|
41
|
+
|
42
|
+
== ORIGIN
|
43
|
+
|
44
|
+
WatirCraft is based on the Taza framework.
|
45
|
+
* http://github.com/scudco/taza/wikis
|
46
|
+
|
47
|
+
== LICENSE
|
48
|
+
|
49
|
+
(The MIT License)
|
50
|
+
|
51
|
+
Copyright (c) 2008 Charley Baker
|
52
|
+
|
53
|
+
Copyright (c) 2009 Charley Baker, Bret Pettichord
|
54
|
+
|
55
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
56
|
+
a copy of this software and associated documentation files (the
|
57
|
+
'Software'), to deal in the Software without restriction, including
|
58
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
59
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
60
|
+
permit persons to whom the Software is furnished to do so, subject to
|
61
|
+
the following conditions:
|
62
|
+
|
63
|
+
The above copyright notice and this permission notice shall be
|
64
|
+
included in all copies or substantial portions of the Software.
|
65
|
+
|
66
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
67
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
68
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
69
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
70
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
71
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
72
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
73
|
+
|
74
|
+
|
75
|
+
WatirCraft is a trademark of WatirCraft LLC.
|
data/VERSION.yml
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
Description:
|
2
|
+
|
3
|
+
Creates a watircraft test project.
|
4
|
+
|
5
|
+
To update an existing project to this version, run this command on the project.
|
6
|
+
|
7
|
+
Examples:
|
8
|
+
|
9
|
+
watircraft google # to create a new project (or update a project called google)
|
10
|
+
watircraft . # to update an existing project
|
11
|
+
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file is autogenerated. Do not edit this file.
|
2
|
+
# It may be replaced when you upgrade to new versions of watircraft.
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
|
6
|
+
library = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
7
|
+
$LOAD_PATH.unshift library
|
8
|
+
require 'initialize'
|
9
|
+
require 'cucumber'
|
10
|
+
|
11
|
+
step_libs = Dir.chdir(library) {Dir["steps/*.rb"]}
|
12
|
+
step_libs.each {|f| require f}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# This file is autogenerated. Do not edit this file.
|
2
|
+
# It may be replaced when you upgrade to new versions of watircraft.
|
3
|
+
|
4
|
+
<%= "# Generated at #{Time.now}" %>
|
5
|
+
<%= "# Generated by watircraft #{WatirCraft::VERSION}" %>
|
6
|
+
|
7
|
+
ENV['ENVIRONMENT'] ||= "test"
|
8
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..')) unless defined?(APP_ROOT)
|
9
|
+
|
10
|
+
require 'watircraft'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
requires = %w(irb/completion watir/irb-history site_start pp)
|
4
|
+
puts "Type 'irb START' at the prompt."
|
5
|
+
exec "irb.bat -I #{APP_ROOT}/lib -r #{requires.join " -r "} --simple-prompt --readline"
|
@@ -0,0 +1 @@
|
|
1
|
+
@ruby script/console %*
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file is autogenerated. Do not edit this file.
|
2
|
+
# It may be replaced when you upgrade to new versions of watircraft.
|
3
|
+
|
4
|
+
require 'initialize'
|
5
|
+
require '<%= site %>'
|
6
|
+
|
7
|
+
SITE = <%= site.camelize %>::<%= site.camelize %>.new
|
8
|
+
at_exit {SITE.close}
|
9
|
+
|
10
|
+
require 'spec/expectations'
|
11
|
+
START = SITE.execution_context
|
12
|
+
START.extend Spec::Expectations
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# This file is autogenerated. Do not edit this file.
|
2
|
+
# It may be replaced when you upgrade to new versions of watircraft.
|
3
|
+
|
4
|
+
require 'init/site_start'
|
5
|
+
require 'spec'
|
6
|
+
require 'mocha'
|
7
|
+
|
8
|
+
Spec::Runner.configure do |config|
|
9
|
+
config.mock_with :mocha
|
10
|
+
config.before(:all) do
|
11
|
+
SITE.initialize_context!(self)
|
12
|
+
end
|
13
|
+
config.before(:each) do
|
14
|
+
SITE.initialize_context!(self)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# This file is autogenerated. Do not edit this file.
|
2
|
+
# It may be replaced when you upgrade to new versions of watircraft.
|
3
|
+
|
4
|
+
require 'spec'
|
5
|
+
require 'cucumber'
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
|
8
|
+
require 'init/site_start'
|
9
|
+
|
10
|
+
World do
|
11
|
+
START
|
12
|
+
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rubigen'
|
3
|
+
require 'extensions/string'
|
4
|
+
require 'watircraft/version'
|
5
|
+
|
6
|
+
class WatircraftGenerator < RubiGen::Base
|
7
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
8
|
+
Config::CONFIG['ruby_install_name'])
|
9
|
+
|
10
|
+
default_options :author => nil
|
11
|
+
|
12
|
+
attr_reader :name, :site, :driver
|
13
|
+
|
14
|
+
# so we can use the site generator
|
15
|
+
prepend_sources(RubiGen::GemPathSource.new([:watircraft]))
|
16
|
+
|
17
|
+
def initialize(runtime_args, runtime_options = {})
|
18
|
+
super
|
19
|
+
usage if args.empty?
|
20
|
+
@destination_root = File.expand_path(args.shift)
|
21
|
+
@name = base_name
|
22
|
+
extract_options
|
23
|
+
@site ||= installed_site || @name
|
24
|
+
@site = @site.computerize
|
25
|
+
end
|
26
|
+
|
27
|
+
# return the site name if we are upgrading an existing project
|
28
|
+
def installed_site
|
29
|
+
return nil unless File.exists? @destination_root + "/config/config.yml"
|
30
|
+
require 'taza/settings'
|
31
|
+
initializer = @destination_root + "/lib/initialize.rb"
|
32
|
+
load initializer if File.exists? initializer
|
33
|
+
Taza::Settings.path = @destination_root
|
34
|
+
Taza::Settings.config[:site]
|
35
|
+
end
|
36
|
+
|
37
|
+
def manifest
|
38
|
+
record do |m|
|
39
|
+
@@new_directories.each { |path| m.directory path }
|
40
|
+
|
41
|
+
m.file "rakefile.rb", "rakefile", :collision => :force
|
42
|
+
m.template "config.yml.erb", "config/config.yml", :collision => :skip
|
43
|
+
|
44
|
+
m.file "spec_helper.rb", "test/specs/spec_helper.rb", :collision => :force
|
45
|
+
m.file "feature_helper.rb", "test/features/feature_helper.rb", :collision => :force
|
46
|
+
|
47
|
+
m.template "initialize.rb.erb", "lib/initialize.rb", :collision => :ask
|
48
|
+
m.file "spec_initialize.rb", "lib/init/spec_initialize.rb", :collision => :force
|
49
|
+
m.file "world.rb", "lib/steps/world.rb", :collision => :force
|
50
|
+
m.template "site_start.rb.erb", "lib/init/site_start.rb", :collision => :force
|
51
|
+
|
52
|
+
m.file_copy_each ["console", "console.cmd"], "script", :collision => :force
|
53
|
+
|
54
|
+
m.dependency "install_rubigen_scripts", [destination_root, 'watircraft'],
|
55
|
+
:shebang => options[:shebang], :collision => :ask
|
56
|
+
m.dependency "site", [@site], :destination => destination_root
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
@@new_directories =
|
61
|
+
%w(
|
62
|
+
config
|
63
|
+
script
|
64
|
+
lib
|
65
|
+
lib/init
|
66
|
+
lib/pages
|
67
|
+
lib/steps
|
68
|
+
test
|
69
|
+
test/specs
|
70
|
+
test/features
|
71
|
+
)
|
72
|
+
|
73
|
+
protected
|
74
|
+
def banner
|
75
|
+
<<-EOS
|
76
|
+
USAGE: #{spec.name} project_name [options]
|
77
|
+
EOS
|
78
|
+
end
|
79
|
+
|
80
|
+
def add_options!(opts)
|
81
|
+
opts.separator ''
|
82
|
+
opts.separator 'Options:'
|
83
|
+
# For each option below, place the default
|
84
|
+
# at the top of the file next to "default_options"
|
85
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
86
|
+
# "Some comment about this option",
|
87
|
+
# "Default: none") { |options[:author]| }
|
88
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
89
|
+
opts.on("--site=SITE", String,
|
90
|
+
"Name of the Site for the project.",
|
91
|
+
"Default: existing site (if updating) or project_name."
|
92
|
+
) { |v| options[:site] = v }
|
93
|
+
opts.on("--driver=DRIVER", String,
|
94
|
+
"Name of the browser driver for the project.",
|
95
|
+
"Default: watir."
|
96
|
+
) { |v| options[:driver] = v }
|
97
|
+
end
|
98
|
+
|
99
|
+
def extract_options
|
100
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
101
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
102
|
+
# raw instance variable value.
|
103
|
+
# @author = options[:author]
|
104
|
+
@site = options[:site]
|
105
|
+
@driver = options[:driver] || :watir
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
data/bin/watircraft
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rubigen'
|
5
|
+
|
6
|
+
if %w(-v --version).include? ARGV.first
|
7
|
+
require 'watircraft'
|
8
|
+
puts "#{File.basename($0)} #{WatirCraft::VERSION}"
|
9
|
+
exit(0)
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rubigen/scripts/generate'
|
13
|
+
source = RubiGen::PathSource.new(:application,
|
14
|
+
File.join(File.dirname(__FILE__), "../app_generators"))
|
15
|
+
RubiGen::Base.reset_sources
|
16
|
+
RubiGen::Base.append_sources source
|
17
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'watircraft')
|
@@ -0,0 +1,10 @@
|
|
1
|
+
class Array
|
2
|
+
# Returns true if the two arrays elements are equal ignoring order
|
3
|
+
# Example:
|
4
|
+
# [1,2].equivalent([2,1]) # => true
|
5
|
+
# [1,2,3].equivalent([2,1]) # => false
|
6
|
+
def equivalent?(other_array)
|
7
|
+
merged_array = self & other_array
|
8
|
+
merged_array.size == self.size && merged_array.size == other_array.size
|
9
|
+
end
|
10
|
+
end
|