Sha256: a0f3caa2aa729f45f6b16715835c92ee5bdd6b0e013a44d6d3917c50556eb736

Contents?: true

Size: 1.24 KB

Versions: 38

Compression:

Stored size: 1.24 KB

Contents

# mock library for testing the IE controller
require 'watir'

class FakeFrame
  def length
    return 0
  end
end

class FakeDoc
  
  attr_accessor :links, :all
  
  def initialize
    @links = ""
    @doc = self
  end
  
  def getElementsByTagName(tag)
    @doc.links
  end
  
  def frames
    return FakeFrame.new
  end
  
  def readyState
    return "complete"
  end
  
  def addLink(value)
    if @links.nil?
      @links = value
    else
      @links << value
    end
  end
  def location
    self
  end
  def url
    return "file://fake"
  end
  alias :href :url  
end

class StubExplorer
  
  attr_accessor :timeToWait
  
  def initialize
    @timeToWait = 1
    @visible = $HIDE_IE
    @document = FakeDoc.new
  end
  
  def document
    return @document
  end
  
  def busy
    sleep @timeToWait
    return FALSE
  end
  
  def readyState
    return 4
  end
  
  def visible=(value)
  end
  
  def visible
  end
  
end

class TestIE < Watir::IE
  
  def create_browser_window
    @ie = StubExplorer.new
  end
  
  def addLink(link)
    @ie.document.addLink(link)
  end
  
  def setTimeToWait(time = 1)
    @ie.timeToWait = time
  end
  
  def goto(url)
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
watir-3.0.0.rc3 unittests/ie_mock.rb
watir-3.0.0.rc2 unittests/ie_mock.rb
watir-3.0.0.rc1 unittests/ie_mock.rb
watir-2.0.4 unittests/ie_mock.rb
watir-2.0.3 unittests/ie_mock.rb
watir-2.0.2 unittests/ie_mock.rb
watir-2.0.2.rc1 unittests/ie_mock.rb
watir-2.0.1 unittests/ie_mock.rb
watir-2.0.0 unittests/ie_mock.rb
watir-2.0.0.rc3 unittests/ie_mock.rb
watir-2.0.0.rc2 unittests/ie_mock.rb
watir-1.9.2 unittests/ie_mock.rb
watir-1.9.2.rc1 unittests/ie_mock.rb
watir-1.9.1 unittests/ie_mock.rb
watir-1.9.1.rc1 unittests/ie_mock.rb
watir-1.9.0 unittests/ie_mock.rb
watir-1.9.0.rc7 unittests/ie_mock.rb
watir-1.9.0.rc6 unittests/ie_mock.rb
watir-1.9.0.rc5 unittests/ie_mock.rb
watir-1.9.0.rc4 unittests/ie_mock.rb