Permalink
Browse files

Will now use Watir 3 API

  • Loading branch information...
1 parent 4b65a40 commit 080890b70f636e68cef4812c41a64db59e2dfb9e Andreas Tolf Tolfsen committed Mar 7, 2011
Showing with 1 addition and 241 deletions.
  1. +0 −144 preferences_spec.rb
  2. +0 −34 screenshot_spec.rb
  3. +0 −62 spatnav_spec.rb
  4. +1 −1 watirspec_helper.rb
View
@@ -1,144 +0,0 @@
-require File.expand_path('../watirspec_helper', __FILE__)
-
-describe 'Preferences' do
-
- before :all do
- @prefs = browser.preferences
- end
-
- describe '#new' do
- it 'constructs a new instance' do
- @prefs.exist?.should be_true
- end
- end
-
- describe '#to_s' do; end
-
- describe '#each_section' do # #each is an alias
- it 'contains a list' do
- @prefs.each_section do |p|
- p.kind_of?(OperaWatir::Preferences::Entry).should be_true
- end
- end
- end
-
- describe '#length' do; end # #size is an alias
- describe '#last' do; end
- describe '#empty?' do; end
-
- describe 'Section' do # Entry / Preferences#method_missing
-
- before :all do
- @section = @prefs.link
- end
-
- describe '#new' do
- it 'constructs a new instance' do
- @section.exist?.should be_true
- end
- end
-
- describe '#value' do; end
- describe '#value=' do; end
- describe '#default' do; end
- describe '#default!' do; end
- describe '#each_key' do; end # #each is an alias
-
- describe '#is_section?' do
- it 'is a section' do
- @section.is_section?.should be_true
- end
- end
-
- describe 'Keys' do # Entry / Entry#method_missing
-
- before :all do
- @key = @section.expiry
- end
-
- describe '#type' do
- it '`expiry` is a type integer' do
- @key.type.should include 'Integer'
- end
-
- it '`color` is a type boolean' do
- @section.color.type.should include 'Boolean'
- end
-
- it '`opera_account.server_address` is a type string' do
- @prefs.opera_account.server_address.should include 'String'
- end
- end
-
- describe '#value' do
- it 'is not empty' do
- @key.value.should_not be_empty
- end
-
- it 'is numeric' do
- @key.value.should be_numeric
- end
- end
-
- describe '#value=' do
- it 'is changed when set' do
- @key.value = '20'
- @key.value.should == '20'
- end
-
- it 'has effect in the browser when changed' do
- @section.strike_through.value = true
- window.url = fixture('simple.html')
- window.a.eval_js('this.currentStyle.textDecoration').should include /strike\-through/
- end
-
- it 'does not allow setting an invalid value' do
- old_value = @section.color.value
- @section.color.value = 'foo'
- @section.color.value.should_not == 'foo'
- @section.color.value.should == old_value
- end
- end
-
- describe '#default' do
- it 'returns the default value' do
- @key.default == '10'
- end
- end
-
- describe '#default!' do
- before :each do
- @default_value = @key.default
- @key.value = '1337'
- end
-
- it 'returns and sets default value' do
- @key.default!.should == @default_value
- @key.value.should == @default_value
- end
-
- after :all do
- @key.value = @default_value
- end
- end
-
- describe '#each_key' do; end # #each is an alias
-
- describe '#is_section?' do
- it 'is not a section' do
- @key.is_section?.should be_false
- end
- end
-
- end
-
- end
-
- describe '#cleanup' do; end
- describe '#cleanup!' do; end
-
- after :all do
- @prefs.cleanup!
- end
-
-end
View
@@ -1,34 +0,0 @@
-require File.expand_path('../watirspec_helper', __FILE__)
-
-describe 'Element' do
-
- before :each do
- browser.url = fixture('boxes.html')
- @one = window.find_by_id('one');
- @two = window.find_by_id('two');
- @three = window.find_by_id('three');
- @four = window.find_by_id('four');
- end
-
- describe '#visual_hash' do
- it 'returns a hash' do
- @one.visual_hash.length.should == 34
- end
-
- it 'returns identical hashes for visually identical elements' do
- @one.visual_hash.should == @three.visual_hash
- end
-
- it 'returns different hashes for visually different elements' do
- @one.visual_hash.should_not == @two.visual_hash
- end
-
- it 'returns correct hashes when querying several elements in sequence' do
- @one.visual_hash.should == @three.visual_hash
- @two.visual_hash.should == @four.visual_hash
- @one.visual_hash.should_not == @two.visual_hash
- @two.visual_hash.should_not == @three.visual_hash
- end
- end
-end
-
View
@@ -1,62 +0,0 @@
-require File.expand_path('../watirspec_helper', __FILE__)
-
-describe 'Spatnav' do
-
- before :each do
- browser.url = fixture('grid.html')
- end
-
- describe '#up' do
- it 'selects the correct links when navigating up' do
- browser.spatnav.up
- window.execute_script("document.activeElement.text;").to_s.should == 'C1'
- browser.spatnav.up
- window.execute_script("document.activeElement.text;").to_s.should == 'C2'
- browser.spatnav.up
- window.execute_script("document.activeElement.text;").to_s.should == 'C3'
- end
- end
-
- describe '#down' do
- it 'selects the correct links when navigating down' do
- browser.spatnav.down
- window.execute_script("document.activeElement.text;").to_s.should == 'C3'
- browser.spatnav.down
- window.execute_script("document.activeElement.text;").to_s.should == 'C2'
- browser.spatnav.down
- window.execute_script("document.activeElement.text;").to_s.should == 'C1'
- end
- end
-
- describe '#left' do
- it 'selects the correct links when navigating left' do
- browser.spatnav.left
- window.execute_script("document.activeElement.text;").to_s.should == 'C1'
- browser.spatnav.left
- window.execute_script("document.activeElement.text;").to_s.should == 'B1'
- browser.spatnav.left
- window.execute_script("document.activeElement.text;").to_s.should == 'A1'
- end
- end
-
- describe '#right' do
- it 'selects the correct links when navigating right' do
- browser.spatnav.right
- window.execute_script("document.activeElement.text;").to_s.should == 'A1'
- browser.spatnav.right
- window.execute_script("document.activeElement.text;").to_s.should == 'B1'
- browser.spatnav.right
- window.execute_script("document.activeElement.text;").to_s.should == 'C1'
- end
- end
-
- describe '#activate!' do
- it 'activates the focused link' do
- browser.spatnav.down
- browser.spatnav.activate
- window.url.should include 'C3'
- end
- end
-
-
-end
View
@@ -8,7 +8,7 @@
require 'operawatir/helper'
-OperaWatir.api = 2
+OperaWatir.api = 3
RSpec.configure do |config|
config.mock_with :rr

0 comments on commit 080890b

Please sign in to comment.