Sha256: ddab781faf4e6beb35c2cc06ea33b1fc6bdce20a41dc0ebc840294b3a5f834d6

Contents?: true

Size: 1.9 KB

Versions: 13

Compression:

Stored size: 1.9 KB

Contents

require 'spec_helper'

describe RAutomation::TextField do
  let(:main_form) { RAutomation::Window.new(:title => "MainFormWindow") }
  let(:text_field) { main_form.text_field(:class => /Edit/i, :index => 2) }

  it "#text_field" do
    main_form.text_field(:class => /Edit/i, :index => 1).should exist

    RAutomation::Window.wait_timeout = 0.1
    expect { RAutomation::Window.new(:title => "non-existent-window").
        text_field(:class => "Edit") }.
        to raise_exception(RAutomation::UnknownWindowException)
  end

  it "#set" do
    text_field.set "hello!"

    RAutomation::Window.wait_timeout = 0.1
    expect { main_form.text_field(:class => "non-existing-field").set "hello!" }.
        to raise_exception(RAutomation::UnknownTextFieldException)
  end

  it "#clear" do
    text_field.set "hello!"
    text_field.value.should == "hello!"
    text_field.clear
    text_field.value.should be_empty

    RAutomation::Window.wait_timeout = 0.1
    expect { main_form.text_field(:class => "non-existent-field").clear }.
        to raise_exception(RAutomation::UnknownTextFieldException)
  end

  it "#value" do
    text_field.set "hello!"
    text_field.value.should == "hello!"

    RAutomation::Window.wait_timeout = 0.1
    expect { main_form.text_field(:class => "non-existent-field").value }.
        to raise_exception(RAutomation::UnknownTextFieldException)
  end

  it "#exists?" do
    field  = main_form.text_field(:class => /Edit/i, :index => 1)
    field.should exist
    main_form.text_field(:class => "non-existent-field").should_not exist
  end


  it "#hwnd" do
    field  = main_form.text_field(:class => /Edit/i, :index => 1)
    field.hwnd.should be_a(Fixnum)

    RAutomation::Window.wait_timeout = 0.1
    expect { main_form.text_field(:class => "non-existing-window").hwnd }.
        to raise_exception(RAutomation::UnknownTextFieldException)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rautomation-0.16.0 spec/text_field_spec.rb
rautomation-0.15.0 spec/text_field_spec.rb
rautomation-0.14.1 spec/text_field_spec.rb
rautomation-0.14.0 spec/text_field_spec.rb
rautomation-0.13.0 spec/text_field_spec.rb
rautomation-0.12.0 spec/text_field_spec.rb
rautomation-0.11.0 spec/text_field_spec.rb
rautomation-0.10.0 spec/text_field_spec.rb
rautomation-0.9.4 spec/text_field_spec.rb
rautomation-0.9.3 spec/text_field_spec.rb
rautomation-0.9.2 spec/text_field_spec.rb
rautomation-0.9.1 spec/text_field_spec.rb
rautomation-0.9.0 spec/text_field_spec.rb