Sha256: 72e61d1096e2c1ac83fed4630e8ec056f75c0652f37f81e76d4f2c3aed042eff

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

require "spec_helper"

describe "Win32::Mouse", if: SpecHelper.adapter == :win_32 do
  let(:window) { RAutomation::Window.new(title: "MainFormWindow") }
  it "#click" do
    popup = RAutomation::Window.new(title: "About")
    expect(popup.present?).to_not be true

    window.maximize
    mouse = window.mouse
    mouse.move(x: 60, y: 65)
    mouse.click

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

  it "#position" do
    mouse = window.mouse

    mouse.move(x: 13, y: 16)
    expect(mouse.position).to be == {x: 13, y: 16}
  end

  it "#press/#release" do
    window.maximize

    text_field = window.text_field(index: 2)
    text_field.set("start string")
    expect(text_field.value).to be == "start string"

    mouse = window.mouse
    mouse.move(x: 146, y: 125)
    mouse.press
    mouse.move(x: 194)
    mouse.release
    window.send_keys([:control, "c"])

    text_field.set("new string")
    expect(text_field.value).to be == "new string"

    mouse.move(x: 146)
    mouse.press
    mouse.move(x: 194)
    mouse.release
    window.send_keys([:control, "v"])

    expect(text_field.value).to be == "start string"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rautomation-2.0.1-x86-mingw32 spec/adapter/win_32/mouse_spec.rb
rautomation-2.0.1-x64-mingw32 spec/adapter/win_32/mouse_spec.rb