Sha256: 4c1bde066ba4ee017f1ce9281a22d2831cba1ba3a0fcb57346b584d30ce79bc3

Contents?: true

Size: 1.39 KB

Versions: 4

Compression:

Stored size: 1.39 KB

Contents

require_relative '../../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
    browser = Object.new
    Watir::Browser.stubs(:find).returns(browser)
    Watir::Browser.stubs(:new).returns(browser)
    old_browser = Watir::Browser.new
    new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir, :attach => true)
    expect(new_browser).to eql old_browser
  end

  it "should be able to open a new IE instance if there is no instance to attach to" do
    browser = Object.new
    Watir::Browser.stubs(:find).returns(stub_everything)
    Watir::Browser.stubs(:new).returns(browser)
    Taza::Browser.create(:browser => :ie, :driver => :watir)
    expect(browser).to be_truthy
  end

  it "should be able to open a new IE instance if attach not specified" do
    foo = Object.new
    bar = Object.new
    Watir::Browser.stubs(:find).returns(foo)
    Watir::Browser.stubs(:new).returns(bar)
    new_browser = Taza::Browser.create(:browser => :ie, :driver => :watir)
    expect(new_browser).to_not eql foo
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
taza-3.0.0 spec/platform/windows/browser_win.rb
taza-2.1.0 spec/platform/windows/browser_win.rb
taza-2.0 spec/platform/windows/browser_win.rb
taza-1.0 spec/platform/windows/browser_win.rb