browsercuke 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ === 0.1.3 / 2010-01-07
2
+
3
+ * Changing copyright notice
4
+ * Fixed sapphirecuke's browser argument, and removed the use of environment variables.
5
+ * Include a sample test, google-search.feature, and insturctions in the readme.
6
+
1
7
  === 0.1.2 / 2010-01-07
2
8
 
3
9
  * Reformatted license
data/README.md CHANGED
@@ -52,9 +52,37 @@ You will also need to make some changes on your system to get the browser
52
52
 
53
53
  ## SYNOPSIS:
54
54
 
55
- Run something like this to execute a test freature.
55
+ Now it's time to create your first test. As an example, we will test Google's search. Create a
56
+ file called `google-search.feature` and put this content into it.
56
57
 
57
- browsercuke http://localhost/yoursite create-page.feature
58
+ Feature: Google Search
59
+ As a user of the web
60
+ I want to search for interesting websites
61
+ So that I can find things on the web.
62
+
63
+ Scenario: Search for SilverStripe
64
+ Given I visit /
65
+ When I put "SilverStripe" in the "q" field
66
+ And I click the "Google Search" button
67
+ Then I see "www.silverstripe.com"
68
+ And I see "Open Source CMS / Framework"
69
+
70
+ Run your test with this command. You should see the text of your test printed in green, as it
71
+ executes each line of the test.
72
+
73
+ $ browsercuke firefox http://www.google.com google-search.feature
74
+
75
+ The arguments are as follows:
76
+
77
+ * `firefox` - the first argument specifies the browser: "firefox" or "safari"
78
+ * `http://www.google.com` - the second argument specifies the root URL of your site. All URLs in
79
+ the test are specified relative to this URL. That makes it easy to run your tests on different
80
+ instances of your application.
81
+ * `google-search.feature` - the final argument is the name of the .feature file to run. You can
82
+ pass multiple files, or use wildcards, if you prefer.
83
+
84
+ In addition to these arguments, you can pass any other cucumber arguments. Call `cucumber --help`
85
+ for more information.
58
86
 
59
87
  ### Using BrowserCuke to run tests from another project
60
88
 
@@ -218,7 +246,7 @@ To create a new release of the gem, to the following:
218
246
 
219
247
  Browsercuke is licensed under the BSD license
220
248
 
221
- Copyright (c) 2009, Sam Minnée
249
+ Copyright (c) 2009, SilverStripe Limited
222
250
  All rights reserved.
223
251
 
224
252
  Redistribution and use in source and binary forms, with or without
data/bin/browsercuke CHANGED
@@ -33,8 +33,9 @@ end
33
33
 
34
34
  # Pass data along to cucumber
35
35
  extraArgs = ARGV.dup
36
- ENV['BROWSERSALAD_BROWSER'] = extraArgs.shift
37
- ENV['BROWSERSALAD_URL'] = extraArgs.shift
36
+
37
+ $browserName = extraArgs.shift
38
+ $baseURL = extraArgs.shift
38
39
 
39
40
  # We can't reassign ARGV but we can manipulate its contents
40
41
  ARGV.clear
data/bin/sapphirecuke CHANGED
@@ -12,15 +12,27 @@ I couldn't find ./sapphire/main.php.
12
12
  exit 2
13
13
  end
14
14
 
15
- # We can't reassign ARGV but we can manipulate its contents
16
- browser = ARGV[1]
15
+ browser = ARGV[0]
17
16
  baseURL = `php ./sapphire/cli-script.php SapphireInfo/baseurl`
18
- features = "*/tests/cuke/*.feature"
19
17
 
18
+ # By default, use "*/tests/cuke/*.feature" as the features
19
+ if ARGV.count == 1 then
20
+ features = []
21
+ Dir.glob("*/tests/cuke/*.feature").each { |filename|
22
+ features << filename
23
+ }
24
+
25
+ # Otherwise take the feature from ARGV
26
+ else
27
+ features = ARGV.dup
28
+ features.shift
29
+ end
30
+
31
+ # We can't reassign ARGV but we can manipulate its contents
20
32
  ARGV.clear
21
33
  ARGV << browser
22
34
  ARGV << baseURL
23
- ARGV << features
35
+ features.each { |item| ARGV << item }
24
36
 
25
37
  # Call browsercuke
26
38
  load File.dirname(__FILE__) + '/browsercuke'
@@ -0,0 +1,11 @@
1
+ Feature: Google Search
2
+ As a user of the web
3
+ I want to search for interesting websites
4
+ So that I can find things on the web.
5
+
6
+ Scenario: Search for SilverStripe
7
+ Given I visit /
8
+ When I put "SilverStripe" in the "q" field
9
+ And I click the "Google Search" button
10
+ Then I see "www.silverstripe.com"
11
+ And I see "Open Source CMS / Framework"
data/lib/browsercuke.rb CHANGED
@@ -2,6 +2,6 @@
2
2
  # In time, the non-Watir ruby code that the step definitions make use of can be moved into this.
3
3
  module BrowserCuke
4
4
  class BrowserCuke
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.3"
6
6
  end
7
7
  end
data/support/env.rb CHANGED
@@ -2,7 +2,7 @@ require 'spec'
2
2
 
3
3
  $killFF = false
4
4
 
5
- if ENV['BROWSERSALAD_BROWSER'] and ENV['BROWSERSALAD_BROWSER'].downcase == 'safari'
5
+ if $browserName and $browserName.downcase == 'safari'
6
6
  require 'safariwatir'
7
7
  Browser = Watir::Safari
8
8
  else
@@ -73,8 +73,7 @@ end
73
73
  # Set up
74
74
  $browser = Browser.new
75
75
 
76
- if ENV['BROWSERSALAD_URL'] then
77
- $baseURL = ENV['BROWSERSALAD_URL']
76
+ if $baseURL then
78
77
  if not $baseURL.match(/\/$/) then
79
78
  $baseURL += '/'
80
79
  end
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.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Sam Minn\xC3\xA9e"
@@ -88,6 +88,7 @@ files:
88
88
  - Rakefile
89
89
  - bin/browsercuke
90
90
  - bin/sapphirecuke
91
+ - google-search.feature
91
92
  - lib/browsercuke.rb
92
93
  - step_definitions/browser/README.md
93
94
  - step_definitions/browser/ajax.rb