spec_ui 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,7 +8,7 @@ lib/spec/ui/images/rmagick_not_installed.png
8
8
  lib/spec/ui/images/win32screenshot_not_installed.png
9
9
  lib/spec/ui/images/wrong_win32screenshot.png
10
10
  lib/spec/ui/screenshot_saver.rb
11
- lib/spec/ui/selenium
11
+ lib/spec/ui/selenium.rb
12
12
  lib/spec/ui/selenium/driver_ext.rb
13
13
  lib/spec/ui/version.rb
14
14
  lib/spec/ui/watir.rb
@@ -20,7 +20,7 @@ examples/selenium/spec/google/find_rspecs_homepage_spec.rb
20
20
  examples/selenium/spec/spec_helper.rb
21
21
  examples/watir/Rakefile
22
22
  examples/watir/README.txt
23
- examples/watir/spec/google/find_rspecs_homepage_spec.rb
23
+ examples/watir/spec/watir/find_rspecs_homepage_spec.rb
24
24
  examples/watir/spec/spec_helper.rb
25
25
  spec/spec_helper.rb
26
26
  spec/spec/ui/watir/matchers_spec.rb
@@ -16,7 +16,7 @@ In the first one, run:
16
16
 
17
17
  In the second one, run:
18
18
 
19
- rake spec:ui
19
+ rake spec:selenium
20
20
 
21
21
  = Note for OS X users =
22
22
 
@@ -24,6 +24,9 @@ In the second one, run:
24
24
  If you experience that the selenium server is just hanging, read this:
25
25
  http://forums.openqa.org/message.jspa?messageID=16541
26
26
 
27
+ You may have better luck with one of the snapshot jars found under
28
+ http://maven.openqa.org/org/openqa/selenium/server/selenium-server
29
+
27
30
  == Safari ==
28
31
  You may have to set up Safari's proxy settings manually:
29
32
  http://forums.openqa.org/thread.jspa?messageID=20570&#20570
@@ -1,12 +1,17 @@
1
- require File.dirname(__FILE__) + '/spec/spec_helper'
1
+ # You don't need to tweak the $LOAD_PATH if you have RSpec and Spec::Ui installed as gems
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../../rspec/lib')
3
+
4
+ require 'rubygems'
2
5
  require 'spec/rake/spectask'
3
6
 
4
- desc "Run UI Specs"
5
- Spec::Rake::SpecTask.new('spec:ui') do |t|
6
- t.spec_files = FileList['spec/**/*.rb']
7
+ desc "Run Selenium Specs"
8
+ Spec::Rake::SpecTask.new('spec:selenium') do |t|
9
+ t.spec_files = FileList['spec/google/**/*.rb']
10
+ # This line is not necessary if you have RSpec and Spec::Ui installed as gems
11
+ t.ruby_opts = ["-I#{File.dirname(__FILE__) + '/../../lib'}"]
7
12
  t.spec_opts = [
8
- '--require', 'spec/spec_helper',
13
+ '--require', 'rubygems,spec/ui',
9
14
  '--format', 'Spec::Ui::ScreenshotFormatter:spec_report.html',
10
- '--format', 'progress',
15
+ '--format', 'progress'
11
16
  ]
12
17
  end
@@ -1,12 +1,9 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe "Google's search page" do
4
- before(:all) do
5
- @browser = Selenium::SeleniumDriver.new("localhost", 4444, "*safari", "http://www.google.no", 10000)
6
- @browser.start
7
- end
8
-
4
+
9
5
  before(:each) do
6
+ # The @browser is initialised in spec_helper.rb
10
7
  @browser.open('http://www.google.no')
11
8
  end
12
9
 
@@ -28,11 +25,4 @@ describe "Google's search page" do
28
25
  @browser.is_text_present("Ali G").should be_false
29
26
  end
30
27
 
31
- after(:each) do
32
- Spec::Ui::WebappFormatter.browser = @browser
33
- end
34
-
35
- after(:all) do
36
- @browser.kill! rescue nil
37
- end
38
28
  end
@@ -5,4 +5,22 @@ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../../lib')
5
5
  require 'rubygems'
6
6
  require 'spec'
7
7
  require 'spec/ui'
8
+ require File.dirname(__FILE__) + '/selenium'
8
9
  require 'spec/ui/selenium'
10
+
11
+ Spec::Runner.configure do |config|
12
+
13
+ config.before(:all) do
14
+ @browser = Selenium::SeleniumDriver.new("localhost", 4444, "*firefox", "http://www.google.no", 10000)
15
+ @browser.start
16
+ end
17
+
18
+ config.after(:each) do
19
+ Spec::Ui::ScreenshotFormatter.browser = @browser
20
+ end
21
+
22
+ config.after(:all) do
23
+ @browser.kill! rescue nil
24
+ end
25
+ end
26
+
@@ -9,4 +9,4 @@ with spec/ui. Prerequisites:
9
9
 
10
10
  After this is installed, run the watir specs:
11
11
 
12
- rake spec:ui
12
+ rake spec:watir
@@ -1,12 +1,17 @@
1
- require File.dirname(__FILE__) + '/spec/spec_helper'
1
+ # You don't need to tweak the $LOAD_PATH if you have RSpec and Spec::Ui installed as gems
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../../rspec/lib')
3
+
4
+ require 'rubygems'
2
5
  require 'spec/rake/spectask'
3
6
 
4
- desc "Run UI Specs"
5
- Spec::Rake::SpecTask.new('spec:ui') do |t|
6
- t.spec_files = FileList['spec/**/*.rb']
7
+ desc "Run Watir Specs"
8
+ Spec::Rake::SpecTask.new('spec:watir') do |t|
9
+ t.spec_files = FileList['spec/watir/**/*.rb']
10
+ # This line is not necessary if you have RSpec and Spec::Ui installed as gems
11
+ t.ruby_opts = ["-I#{File.dirname(__FILE__) + '/../../lib'}"]
7
12
  t.spec_opts = [
8
- '--require', 'spec/spec_helper',
13
+ '--require', 'rubygems,spec/ui',
9
14
  '--format', 'Spec::Ui::ScreenshotFormatter:spec_report.html',
10
- '--format', 'progress',
15
+ '--format', 'progress'
11
16
  ]
12
17
  end
@@ -7,8 +7,16 @@ require 'spec'
7
7
  require 'spec/ui'
8
8
  require 'spec/ui/watir'
9
9
 
10
- class Spec::DSL::Behaviour
11
- def before_eval #:nodoc:
12
- include Spec::Matchers::Watir # This gives us Watir matchers
10
+ Spec::Runner.configure do |config|
11
+ config.before(:all) do
12
+ @browser = Watir::Browser.new
13
+ end
14
+
15
+ config.after(:each) do
16
+ Spec::Ui::ScreenshotFormatter.browser = @browser
17
+ end
18
+
19
+ config.after(:all) do
20
+ @browser.kill! rescue nil
13
21
  end
14
22
  end
@@ -1,11 +1,8 @@
1
1
  require File.dirname(__FILE__) + '/../spec_helper'
2
2
 
3
3
  describe "Google's search page" do
4
- before(:all) do
5
- @browser = Watir::Browser.new
6
- end
7
-
8
4
  before(:each) do
5
+ # The @browser is initialised in spec_helper.rb
9
6
  @browser.goto('http://www.google.com')
10
7
  end
11
8
 
@@ -26,12 +23,4 @@ describe "Google's search page" do
26
23
  @browser.button(:name, "btnG").click
27
24
  @browser.should_not have_text("Ali G")
28
25
  end
29
-
30
- after(:each) do
31
- Spec::Ui::ScreenshotFormatter.browser = @browser
32
- end
33
-
34
- after(:all) do
35
- @browser.kill! rescue nil
36
- end
37
26
  end
@@ -27,7 +27,7 @@ module Spec
27
27
  end
28
28
 
29
29
  def png_path
30
- raise "Screenshot not taken. You must call #{self.class}#screenshot! or #{self.class}#browser=(@browser) from after(:each)" if @png_path.nil?
30
+ raise "Screenshot not taken. You must call #{self.name}.screenshot! or #{self.name}.browser = @browser from after(:each)" if @png_path.nil?
31
31
  @png_path
32
32
  end
33
33
 
@@ -0,0 +1 @@
1
+ require 'spec/ui/selenium/driver_ext'
@@ -3,7 +3,7 @@ module Spec
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 2
6
- TINY = 0
6
+ TINY = 2
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
9
9
  end
@@ -1,2 +1,3 @@
1
1
  require 'spec/ui/watir/browser'
2
2
  require 'spec/ui/watir/matchers'
3
+ require 'spec/ui/watir/watir_behaviour'
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: spec_ui
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.0
7
- date: 2007-05-10 00:00:00 +02:00
6
+ version: 0.2.2
7
+ date: 2007-05-18 00:00:00 -07:00
8
8
  summary: Run UI RSpec examples with screenshot reports
9
9
  require_paths:
10
10
  - lib
@@ -39,7 +39,7 @@ files:
39
39
  - lib/spec/ui/images/win32screenshot_not_installed.png
40
40
  - lib/spec/ui/images/wrong_win32screenshot.png
41
41
  - lib/spec/ui/screenshot_saver.rb
42
- - lib/spec/ui/selenium
42
+ - lib/spec/ui/selenium.rb
43
43
  - lib/spec/ui/selenium/driver_ext.rb
44
44
  - lib/spec/ui/version.rb
45
45
  - lib/spec/ui/watir.rb
@@ -51,7 +51,7 @@ files:
51
51
  - examples/selenium/spec/spec_helper.rb
52
52
  - examples/watir/Rakefile
53
53
  - examples/watir/README.txt
54
- - examples/watir/spec/google/find_rspecs_homepage_spec.rb
54
+ - examples/watir/spec/watir/find_rspecs_homepage_spec.rb
55
55
  - examples/watir/spec/spec_helper.rb
56
56
  - spec/spec_helper.rb
57
57
  - spec/spec/ui/watir/matchers_spec.rb