Sha256: 68caaa96d5b23f56087007d0b1b38ae2303f1ab1339f6214bf4557506132c4bb

Contents?: true

Size: 1.4 KB

Versions: 6

Compression:

Stored size: 1.4 KB

Contents

require 'spec/spec_helper'
require 'taza/browser'
require 'taza/settings'
require 'taza/options'
require 'selenium'
require 'watir'

describe Taza::Browser do

  before :each do
    Taza::Settings.stubs(:config_file).returns({})
    ENV['TAZA_ENV'] = 'isolation'
    ENV['SERVER_PORT'] = nil
    ENV['SERVER_IP'] = nil
    ENV['BROWSER'] = nil
    ENV['DRIVER'] = nil
    ENV['TIMEOUT'] = nil
  end
  it "should be able to attach to an open IE instance" do
    require 'watir'
    browser = Object.new
    Watir::IE.stubs(:find).returns(browser)
    Watir::IE.stubs(:new).returns(browser)
    old_browser = Watir::IE.new
    new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir, :attach => true) 
    new_browser.should eql(old_browser)
  end
  
  it "should be able to open a new IE instance if there is no instance to attach to" do
    require 'watir'
    browser = Object.new
    Watir::IE.stubs(:find).returns()
    Watir::IE.stubs(:new).returns(browser)
    new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir) 
    browser.nil?.should be_false 
  end
  it "should be able to open a new IE instance if attach not specified" do
    require 'watir'
    foo = Object.new
    bar = Object.new
    Watir::IE.stubs(:find).returns(foo)
    Watir::IE.stubs(:new).returns(bar)
    new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir) 
    new_browser.should_not eql(foo)
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
taza-0.9.2.1 spec/platform/windows/browser_win.rb
taza-0.9.2.0 spec/platform/windows/browser_win.rb
taza-0.9.1.2 spec/platform/windows/browser_win.rb
taza-0.9.1.1 spec/platform/windows/browser_win.rb
taza-0.9.1 spec/platform/windows/browser_win.rb
taza-0.9.0 spec/platform/windows/browser_win.rb