Sha256: c9f929134c34a184b89b12b49126f728f0487d1ce1ced8304da0bf4452d39acf

Contents?: true

Size: 1.42 KB

Versions: 3

Compression:

Stored size: 1.42 KB

Contents

require 'spec_helper'

describe "MsUia::Button", :if => SpecHelper.adapter == :ms_uia 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

3 entries across 3 versions & 1 rubygems

Version Path
rautomation-0.7.2 spec/adapter/ms_uia/button_spec.rb
rautomation-0.7.1 spec/adapter/ms_uia/button_spec.rb
rautomation-0.7.0 spec/adapter/ms_uia/button_spec.rb