Sha256: e303a00f8f3c7e2e845a3c7d7b6e10a395a8d280232dabd507c96697084ad455

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

require 'spec_helper'

describe "MsUia::TextField", if: SpecHelper.adapter == :ms_uia do
  let(:main_form) { RAutomation::Window.new(title: "MainFormWindow") }

  it "check for text field class" do
    expect(main_form.text_field(id: "checkBox").exist?).to_not be true
    expect(main_form.text_field(id: "textField").exist?).to be true
  end

  it "enabled/disabled" do
    expect(main_form.text_field(id: "textField").enabled?).to be true
    expect(main_form.text_field(id: "textField").disabled?).to_not be true

    expect(main_form.text_field(id: "textBoxDisabled").enabled?).to_not be true
    expect(main_form.text_field(id: "textBoxDisabled").disabled?).to be true
  end

  it "cannot set a value to a disabled text field" do
    expect { main_form.text_field(id: "textBoxDisabled").set "abc" }.to raise_error(RuntimeError)

    expect { main_form.text_field(id: "textBoxDisabled").clear }.to raise_error(RuntimeError)
  end

  it "considers a document control type a text field as well" do
    # cause the .NET framework to be loaded into the process (required to make this fail)
    main_form.select_list(id: "treeView").expand(0)
    expect(main_form.text_field(id: "multiLineTextField").exist?).to be true
  end

  it "can set the value of a multi line text field" do
    text_field = main_form.text_field(id: "multiLineTextField")

    # initial
    text_field.set("some dater'")
    expect(text_field.value).to eq("some dater'")

    # overwrite
    text_field.set("overwrite with this dater'")
    expect(text_field.value).to eq("overwrite with this dater'")
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rautomation-2.0.1-x86-mingw32 spec/adapter/ms_uia/text_field_spec.rb
rautomation-2.0.1-x64-mingw32 spec/adapter/ms_uia/text_field_spec.rb