Sha256: a786f342236eb8af641efa945204e2a6bc9c3fa9921546fca759ba96d6a52ce1

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require 'spec_helper'

describe "WinFfi::Button", :if => SpecHelper.adapter == :win_ffi do
  it "find by id" do
    window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
    window.button(:id => "aboutButton").should exist
  end

  it "check for button class" do
    RAutomation::Window.new(:title => "MainFormWindow").button(:id => "textField").should_not exist
  end


  it "enabled/disabled" do
    window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
    window.button(:id => "enabledButton").should be_enabled
    window.button(:id => "enabledButton").should_not be_disabled

    window.button(:id => "disabledButton").should be_disabled
    window.button(:id => "disabledButton").should_not be_enabled
  end

  it "#set_focus" do
    button = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title]).button(:id => "enabledButton")
    button.should_not have_focus

    button.set_focus
    button.should have_focus
  end

  it "cannot click disabled button" do
    window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
    lambda { window.button(:id => "disabledButton").click }.should raise_error
  end

  it "cannot set focus to disabled button" do
    window = RAutomation::Window.new(:title => SpecHelper::DATA[:window1_title])
    lambda { window.button(:id => "disabledButton").set_focus }.should raise_error
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rdp-rautomation-0.6.3.1 spec/adapter/win_ffi/button_spec.rb