browsercuke 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,15 @@
1
+ === 0.1.2 / 2010-01-07
2
+
3
+ * Reformatted license
4
+ * Added instructions for creating new releases to the README.md
5
+ * Removed the broken and unnecessary browsercuke-setup CLI tool
6
+ * Fixed browsercuke & sapphirecuke CLI tools to be written in ruby (necessary for them to work).
7
+ * Moved version number to a better location. The existence of the lib/ directory makes Hoe run better.
8
+
9
+ === 0.1.1 / 2010-01-07
10
+
11
+ * BUGFIX: Fixed problems with gem dependencies
12
+
13
+ === 0.1.0 / 2010-01-07
14
+
15
+ * Initial release as a rubygem
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- = BrowserCuke
1
+ # BrowserCuke
2
2
 
3
3
  http://github.com/sminnee/browsercuke
4
4
 
5
- == DESCRIPTION:
5
+ ## DESCRIPTION:
6
6
 
7
7
  BrowserCuke is a layer of browser-based testing on top of Cucumber. It provides an intuitive way of
8
8
  writing business-readable tests for your web applications, that use real web browsers to test. Your
@@ -14,7 +14,7 @@ For more information about Cucumber, see [the cucumber website](http://cukes.inf
14
14
  BrowserCuke currently uses Watir to perform the browser automation, although it may be extended in
15
15
  the future to use something like WebRat to test applications sans-JavaScript.
16
16
 
17
- == FEATURES
17
+ ## FEATURES
18
18
 
19
19
  * Tests Safari and Firefox
20
20
  * Looks for page elements like a human would: e.g. ignores hidden elements, and you can use form element labels as identifiers.
@@ -37,29 +37,30 @@ Roadmap:
37
37
  * Add tests for colour and image changes
38
38
  * Get the FireWatir and SafariWatir monkey patches submitted to those upstream projects.
39
39
 
40
- == INSTALL:
40
+ ## INSTALL:
41
41
 
42
42
  BrowserCuke is packaged as a gem, so the easiest way of installing BrowserCuke is by running this
43
43
  command:
44
44
 
45
- $ gem install browsercuke
45
+ $ gem install browsercuke
46
46
 
47
- After you have installed the gem, you should run this command to set up your browsers properly:
47
+ You will also need to make some changes on your system to get the browser
48
48
 
49
- $ browsercuke-setup
49
+ * Safari: Go to System Prefences -> Universal Access and check the box labelled 'Enable access for assistive devices'
50
+ * Firefox: Install the JSSH extension. You can download it here:
51
+ * [OS X + FF 3.5](http://wiki.openqa.org/download/attachments/13893658/jssh-3.5.x-Darwin-param.xpi)
50
52
 
51
- == SYNOPSIS:
53
+ ## SYNOPSIS:
52
54
 
53
55
  Run something like this to execute a test freature.
54
56
 
55
57
  browsercuke http://localhost/yoursite create-page.feature
56
58
 
57
- === Using BrowserCuke to run tests from another project
59
+ ### Using BrowserCuke to run tests from another project
58
60
 
59
61
  BrowserCuke doesn't come bundled with any actual tests, so usually you have to write tests as part
60
62
  of your project.
61
63
 
62
-
63
64
  This example runs a copy of BrowserCuke installed in ~/browsercuke to execute the features
64
65
  contained in a Sapphire project. `sake SapphireURL/baseurl` return the URL of the current Sapphire
65
66
  project.
@@ -67,11 +68,12 @@ project.
67
68
  browsercuke firefox `sake SapphireInfo/baseurl` */tests/cuke/*.feature
68
69
 
69
70
  Because BrowserCuke was written in order to support testing of Sapphire projects, we have a special
70
- script for this particular example. This will probably go away as BrowserCuke matures
71
+ script for this particular example. This will probably be merged into Sapphire as BrowserCuke
72
+ matures.
71
73
 
72
74
  sapphirecuke firefox
73
75
 
74
- === Rules
76
+ ### Rules
75
77
 
76
78
  Please see [the cucumber website](http://cukes.info) for information about the exact cucumber
77
79
  syntax.
@@ -179,7 +181,7 @@ Misc
179
181
 
180
182
  ### I put "(text)" in pop-ups
181
183
 
182
- == REQUIREMENTS:
184
+ ## REQUIREMENTS:
183
185
 
184
186
  Currently browsercuke works with the following browsers.
185
187
 
@@ -188,32 +190,48 @@ Currently browsercuke works with the following browsers.
188
190
 
189
191
  It has been tested on OS X only; Windows and IE support coming soon!
190
192
 
191
- == DEVELOPERS:
193
+ ## DEVELOPERS:
192
194
 
193
195
  After checking out the source, run:
194
196
 
195
- $ rake newb
197
+ $ rake newb
196
198
 
197
199
  This task will install any missing dependencies, run the tests/specs,
198
200
  and generate the RDoc.
199
201
 
200
- == LICENSE:
202
+ To create a new release of the gem, to the following:
203
+
204
+ * Update the version number in lib/browsercuke.rb
205
+ * Rebuild the manifest. If it fails initially, create a manifest containaining only
206
+ `lib/browsercuke.rb` and re-execute.
207
+
208
+ rake git:manifest
209
+
210
+ * Call `rake git:changelog` and put the result at the top of History.txt, with the appropriate
211
+ version number
212
+ * Commit the changes to lib/browsercuke.rb and History.txt with commit message like "Created vX.Y.Z"
213
+ * Package the gem and release it to Gemcutter
214
+
215
+ rake publish
216
+
217
+ ## LICENSE:
201
218
 
202
219
  Browsercuke is licensed under the BSD license
203
220
 
204
- Copyright (c) 2009, Sam Minnée
221
+ Copyright (c) 2009, Sam Minnée
205
222
  All rights reserved.
206
223
 
207
224
  Redistribution and use in source and binary forms, with or without
208
225
  modification, are permitted provided that the following conditions are met:
209
- * Redistributions of source code must retain the above copyright
210
- notice, this list of conditions and the following disclaimer.
211
- * Redistributions in binary form must reproduce the above copyright
212
- notice, this list of conditions and the following disclaimer in the
213
- documentation and/or other materials provided with the distribution.
214
- * Neither the name of the <organization> nor the
215
- names of its contributors may be used to endorse or promote products
216
- derived from this software without specific prior written permission.
226
+
227
+ * Redistributions of source code must retain the above copyright
228
+ notice, this list of conditions and the following disclaimer.
229
+ * Redistributions in binary form must reproduce the above copyright
230
+ notice, this list of conditions and the following disclaimer in the
231
+ documentation and/or other materials provided with the distribution.
232
+ * Neither the name of the <organization> nor the
233
+ names of its contributors may be used to endorse or promote products
234
+ derived from this software without specific prior written permission.
217
235
 
218
236
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
219
237
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require 'rubygems'
2
+ require 'hoe'
3
+
4
+ Hoe.plugin :git
5
+
6
+ Hoe.spec 'browsercuke' do
7
+ self.readme_file = 'README.md'
8
+
9
+ developer('Sam Minnée', 'sam@silverstripe.com')
10
+
11
+ extra_deps << ['cucumber', '>= 0.4.4']
12
+ extra_deps << ['firewatir', '>= 1.6.5']
13
+ extra_deps << ['safariwatir', '>= 0.3.7']
14
+ extra_deps << ['rb-appscript', '>= 0.5.3']
15
+ end
data/bin/browsercuke CHANGED
@@ -1,6 +1,10 @@
1
- #!/usr/bin/env bash
2
- if [ "$2" = "" ]; then
3
- echo "Usage: $0 (browser) (url) (feature-file) (other cucumber args)
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'ftools'
4
+ require 'rubygems'
5
+
6
+ if ARGV.count < 2 then
7
+ puts "Usage: $0 (browser) (url) (feature-file) (other cucumber args)
4
8
 
5
9
  Run the given feature file using the URL has the test site, on the given browser.
6
10
 
@@ -10,20 +14,33 @@ Supported browsers:
10
14
 
11
15
  "
12
16
  exit 1
13
- fi
17
+ end
14
18
 
15
- basedir=`dirname $0`
19
+ # Build list of step def -r arguments
20
+ baseDir = File.dirname(File.dirname(__FILE__))
21
+ stepDefArgs = ['-r', baseDir + '/support', '-r', baseDir + '/step_definitions']
16
22
 
17
- export BROWSERSALAD_BROWSER=$1
18
- export BROWSERSALAD_URL=$2
23
+ # Special case for Sapphire applications - collect all the step_definitions from the modules
24
+ if File.exist?('sapphire/tests/cuke') then
25
+ dirs = Dir.entries(".")
26
+ dirs.each do | item |
27
+ if File.exist?(item + '/tests/cuke') then
28
+ stepDefArgs << "-r"
29
+ stepDefArgs << item + '/tests/cuke'
30
+ end
31
+ end
32
+ end
19
33
 
34
+ # Pass data along to cucumber
35
+ extraArgs = ARGV.dup
36
+ ENV['BROWSERSALAD_BROWSER'] = extraArgs.shift
37
+ ENV['BROWSERSALAD_URL'] = extraArgs.shift
20
38
 
21
- # Special case for Sapphire applications - collect all the step_definitions from the modules
22
- if [ -d sapphire/tests/cuke ]; then
23
- for file in `ls -1d */tests/cuke/step_definitions`; do
24
- extras="$extras -r $file"
25
- done
26
- fi
27
-
28
- echo "cucumber -r $basedir/support -r $basedir/step_definitions $extras $3 $4 $5 $6 $7 $8 $9"
29
- cucumber -r $basedir/support -r $basedir/step_definitions $extras $3 $4 $5 $6 $7 $8 $9
39
+ # We can't reassign ARGV but we can manipulate its contents
40
+ ARGV.clear
41
+ (stepDefArgs+extraArgs).each do |arg|
42
+ ARGV.push arg
43
+ end
44
+
45
+ # Call cucumber
46
+ load Gem.bin_path('cucumber', 'cucumber', ">= 0")
data/bin/sapphirecuke CHANGED
@@ -1,16 +1,26 @@
1
- #!/usr/bin/env bash
2
- if [ "$1" = "" ]; then
3
- echo "Usage: $0 (browser)
1
+ #!/usr/bin/env ruby
2
+ if ARGV.count < 1 then
3
+ puts "Usage: $0 (browser)
4
4
  "
5
5
  exit 1
6
- fi
6
+ end
7
7
 
8
- if [ ! -f sapphire/main.php ]; then
9
- echo "Please run $0 from within your sapphire project root.
8
+ if not File.exist?('sapphire/main.php') then
9
+ puts "Please run $0 from within your sapphire project root.
10
10
  I couldn't find ./sapphire/main.php.
11
11
  "
12
12
  exit 2
13
- fi
13
+ end
14
14
 
15
- dirname=`dirname $0`
16
- $dirname/browsercuke $1 `./sapphire/sake SapphireInfo/baseurl` */tests/cuke/*.feature
15
+ # We can't reassign ARGV but we can manipulate its contents
16
+ browser = ARGV[1]
17
+ baseURL = `php ./sapphire/cli-script.php SapphireInfo/baseurl`
18
+ features = "*/tests/cuke/*.feature"
19
+
20
+ ARGV.clear
21
+ ARGV << browser
22
+ ARGV << baseURL
23
+ ARGV << features
24
+
25
+ # Call browsercuke
26
+ load File.dirname(__FILE__) + '/browsercuke'
@@ -0,0 +1,7 @@
1
+ # This is a stub class for defining the version
2
+ # In time, the non-Watir ruby code that the step definitions make use of can be moved into this.
3
+ module BrowserCuke
4
+ class BrowserCuke
5
+ VERSION = "0.1.2"
6
+ end
7
+ end
data/support/env.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  require 'spec'
2
- VERSION = "0.1.1"
3
-
4
2
 
5
3
  $killFF = false
6
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browsercuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Sam Minn\xC3\xA9e"
@@ -76,18 +76,19 @@ email:
76
76
  - sam@silverstripe.com
77
77
  executables:
78
78
  - browsercuke
79
- - browsercuke-setup
80
79
  - sapphirecuke
81
80
  extensions: []
82
81
 
83
- extra_rdoc_files: []
84
-
82
+ extra_rdoc_files:
83
+ - History.txt
85
84
  files:
86
85
  - .gitignore
86
+ - History.txt
87
87
  - README.md
88
+ - Rakefile
88
89
  - bin/browsercuke
89
- - bin/browsercuke-setup
90
90
  - bin/sapphirecuke
91
+ - lib/browsercuke.rb
91
92
  - step_definitions/browser/README.md
92
93
  - step_definitions/browser/ajax.rb
93
94
  - step_definitions/browser/buttons.rb
@@ -1,31 +0,0 @@
1
- #!/usr/bin/env bash
2
- echo "Browsercuke OS X installer
3
- ===========================
4
- "
5
-
6
- ffbin=/Applications/Firefox.app/Contents/MacOS/firefox-bin
7
-
8
-
9
- if [ ! -f jssh-3.5.x-Darwin-param.xpi ]; then
10
- echo "> Downloading Firefox 3.5 JSSH plugin"
11
- wget http://wiki.openqa.org/download/attachments/13893658/jssh-3.5.x-Darwin-param.xpi
12
- fi
13
-
14
- echo "> Installing Firefox 3.5 JSSH plugin"
15
- open ./jssh-3.5.x-Darwin-param.xpi
16
-
17
- echo "> Please go to System Prefences -> Universal Access and check the box labelled 'Enable access for assistive devices'
18
-
19
- When you're done, press enter to continue."
20
-
21
- read -s -n1
22
-
23
- echo "
24
- Done!
25
-
26
- You should be able to run one of these commands now:
27
-
28
- browsercuke firefox http://localhost/yourtestsite create-page.feature
29
- browsercuke safari http://localhost/yourtestsite create-page.feature
30
-
31
- "