Sha256: 7139dd0393410efedcd04c1804dd77990abf32986ef1cffe17aeb6765d439fc7

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require "spec_helper"

describe "AutoIt::Mouse", :if => SpecHelper.adapter == :autoit do

  it "#click" do
    window = RAutomation::Window.new(:title => "MainFormWindow")

    popup = RAutomation::Window.new(:title => "About")
    popup.should_not be_present

    window.maximize
    mouse = window.mouse
    mouse.move :x => 60, :y => 45
    mouse.click

    RAutomation::WaitHelper.wait_until {popup.present?}
  end

  it "#position" do
    window = RAutomation::Window.new(:title => "MainFormWindow")
    mouse = window.mouse

    mouse.move :x => 13, :y => 16
    mouse.position.should == {:x => 13, :y => 16}
  end

  it "#press/#release" do
    window = RAutomation::Window.new(:title => "MainFormWindow")
    window.maximize

    text_field = window.text_field(:index => 1)
    text_field.set("start string")
    text_field.value.should == "start string"

    mouse = window.mouse
    mouse.move :x => 146, :y => 103
    mouse.press
    mouse.move :x => 194
    mouse.release
    window.send_keys "^c"

    text_field.set("new string")
    text_field.value.should == "new string"

    mouse.move :x => 146
    mouse.press
    mouse.move :x => 194
    mouse.release
    window.send_keys "^v"

    text_field.value.should == "start string"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rautomation-0.7.3 spec/adapter/autoit/mouse_spec.rb
rautomation-0.7.2 spec/adapter/autoit/mouse_spec.rb