Sha256: 148c34da1c3580eec7847733147446d6e917fffc53d6b544a33858c235eea2c1

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 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
    expect {RAutomation::Window.new(:title => "non-existing-window").button(:value => "Something")}.
            to 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
    expect {RAutomation::Window.new(:title => SpecHelper::DATA[:window2_title]).button(:value => "non-existent-button").value}.
            to 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
    expect {window.button(:value => "non-existent-button").click}.
            to 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

1 entries across 1 versions & 1 rubygems

Version Path
rautomation-0.3.0 spec/button_spec.rb