Sha256: 1624b8104520bcbb553ed9a997083a9c0fbd19ac4ede4251edf9661f5cd7dcd3

Contents?: true

Size: 1.9 KB

Versions: 1

Compression:

Stored size: 1.9 KB

Contents

$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', '..') unless $SETUP_LOADED

require 'unittests/setup'
require 'watir/contrib/ie-new-process'
require 'watir/process'

class TC_New < Test::Unit::TestCase
  
  def setup
    @background_iexplore_processes = Watir::IE.process_count
    if @background_iexplore_process == 0
      @background = Watir::IE.new
      assert_equal 1, Watir::IE.process_count
      @background_iexplore_process = 1
    end
  end

  def teardown
    @background.close if @background
    @new.close if @new
    sleep 1.0 # give it time to close
  end

  def test_new_window_does_not_create_new_process
    @new = Watir::IE.new_window
    assert_equal @background_iexplore_processes, Watir::IE.process_count
  end
  
  def test_new_does_not_create_new_process
    @new = Watir::IE.new
    assert_equal @background_iexplore_processes, Watir::IE.process_count
  end
  
  def test_start_window_with_no_args_works_like_new_window
    @new = Watir::IE.start_window
    assert_equal @background_iexplore_processes, Watir::IE.process_count
  end
  
  def test_start_window_with_url_also_goes_to_that_page
    @new = Watir::IE.start_window 'http://wtr.rubyforge.org'
    assert_equal @background_iexplore_processes, Watir::IE.process_count
    assert_equal 'http://wtr.rubyforge.org/', @new.url
  end
  
  tag_method :test_new_process_creates_a_new_process, :fails_on_ie
  def test_new_process_creates_a_new_process
    @new = Watir::IE.new_process
    assert_equal @background_iexplore_processes + 1, Watir::IE.process_count
  end
  
  tag_method :test_start_process_with_arg_creates_a_new_process_and_goes_to_that_page, :fails_on_ie
  def test_start_process_with_arg_creates_a_new_process_and_goes_to_that_page
    @new = Watir::IE.start_process 'http://wtr.rubyforge.org'
    assert_equal @background_iexplore_processes + 1, Watir::IE.process_count
    assert_equal 'http://wtr.rubyforge.org/', @new.url
  end
end
     

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-1.6.5 unittests/windows/new_test.rb