Sha256: a97b942b5a37f2caf0638239403b2bdeef098d5edae09cde20bd9345e36c8704

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

require File.expand_path('../watirspec/spec_helper', __FILE__)

describe Watir::Element do
  describe "#click" do
    before {
      browser.goto WatirSpec.url_for('clicks.html', needs_server: true)
    }

    let(:clicker) { browser.element(id: "click-logger") }
    let(:log)     { browser.element(id: "log").ps.map { |e| e.text } }

    bug "https://github.com/watir/watir-webdriver/issues/343", :webdriver do
      it "clicks an element with text in nested text node using text selector" do
        browser.element(text: "Can You Click This?").click
        expect(browser.element(text: "You Clicked It!")).to exist
      end
    end

    # TODO: make guards more flexible, in reality this currently only works on linux with native events
    compliant_on %i(webdriver firefox native_events) do
      it "should perform a click with no modifier keys" do
        clicker.click
        expect(log).to eq ["shift=false alt=false"]
      end

      it "should perform a click with the shift key pressed" do
        clicker.click(:shift)
        expect(log).to eq ["shift=true alt=false"]
      end

      it "should perform a click with the alt key pressed" do
        clicker.click(:alt)
        expect(log).to eq ["shift=false alt=true"]
      end

      it "should perform a click with the shift and alt keys pressed" do
        clicker.click(:shift, :alt)
        expect(log).to eq ["shift=true alt=true"]
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir-webdriver-0.8.0 spec/click_spec.rb