Sha256: 5c77e324d0e44c540c94aa67da57575cd51af0df90e8e203918f1e42d25d07ec

Contents?: true

Size: 2 KB

Versions: 8

Compression:

Stored size: 2 KB

Contents

require 'spec_helper'

describe "MsUia::ListBox", :if => SpecHelper.adapter == :ms_uia do

  it "#exists" do
    RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox").should exist
  end

  it "checks for ListBox class" do
    RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "textField").should_not exist
    RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox").should exist
  end

  it "counts items" do
    list_box = RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox")
    list_box.count.should == 3
  end

  it "lists items" do
    list_box = RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox")

    list_box.items[0].value.should == "Apple"
    list_box.items[1].value.should == "Orange"
    list_box.items[2].value.should == "Mango"
  end

  it "returns a value" do
    list_box = RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox")

    list_box.value.should == ""
    list_box.select(0)
    list_box.value.should == "Apple"
    list_box.select(1)
    list_box.value.should == "Orange"
    list_box.select(2)
    list_box.value.should == "Mango"
  end

  it "#selected?" do
    list_box = RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox")

    list_box.selected?(2).should == false
    list_box.select(2)
    list_box.selected?(2).should == true
  end

  it "#select" do
    list_box = RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox")

    list_box.select(1)
    list_box.selected?(1).should == true

    list_box.select(0)
    list_box.selected?(0).should == true

    list_box.select(2)
    list_box.selected?(2).should == true
  end

  it "#strings" do
    list_box = RAutomation::Window.new(:title => "MainFormWindow").list_box(:id => "FruitListBox")

    list_box.strings.should == ["Apple", "Orange", "Mango"]
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rautomation-0.9.2 spec/adapter/ms_uia/listbox_spec.rb
rautomation-0.9.1 spec/adapter/ms_uia/listbox_spec.rb
rautomation-0.9.0 spec/adapter/ms_uia/listbox_spec.rb
rautomation-0.8.0 spec/adapter/ms_uia/listbox_spec.rb
rautomation-0.7.3 spec/adapter/ms_uia/listbox_spec.rb
rautomation-0.7.2 spec/adapter/ms_uia/listbox_spec.rb
rautomation-0.7.1 spec/adapter/ms_uia/listbox_spec.rb
rautomation-0.7.0 spec/adapter/ms_uia/listbox_spec.rb