Sha256: da47c4b0565ee1faaff6cdd59bc4c9ed0f62dd110d1a807e32118af17304ee4c

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe RAutomation::Button do
  it "#button" do
    RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).
            button(:value => SpecHelper::DATA[:window2_button_text]).should exist

    RAutomation::Window.wait_timeout = 0.1
    lambda {RAutomation::Window.new(:title => "non-existing-window").button(:value => "Something")}.
            should raise_exception(RAutomation::UnknownWindowException)
  end

  it "#value" do
    RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).
            button(:value => SpecHelper::DATA[:window2_button_text]).value.should == SpecHelper::DATA[:window2_button_text]

    RAutomation::Window.wait_timeout = 0.1
    lambda {RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).button(:value => "non-existent-button").value}.
            should raise_exception(RAutomation::UnknownButtonException)
  end

  it "#exists?" do
    window = RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title])
    window.button(:value => SpecHelper::DATA[:window2_button_text]).should exist
    window.button(:value => "non-existent-button").should_not exist
  end

  it "#click" do
    window = RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title])
    RAutomation::Window.wait_timeout = 0.1
    lambda{window.button(:value => "non-existent-button").click}.
            should raise_exception(RAutomation::UnknownButtonException)

    button = window.button(:value => SpecHelper::DATA[:window2_button_text])
    button.should exist
    button.click
    button.should_not exist
    window.should_not exist
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rautomation-0.2.1 spec/button_spec.rb
rautomation-0.2.0 spec/button_spec.rb
rautomation-0.1.0 spec/button_spec.rb
rautomation-0.0.4 spec/button_spec.rb