Sha256: 60a4960e2466f4f04eac110db8dcf4ae0aa85e2da1b03b1c7676773b9358490b

Contents?: true

Size: 1020 Bytes

Versions: 2

Compression:

Stored size: 1020 Bytes

Contents

# encoding: utf-8
require File.expand_path('spec_helper', File.dirname(__FILE__))

describe "TextFields" do

  before :each do
    browser.goto(WatirSpec.files + "/forms_with_input_elements.html")
  end

  describe "#length" do
    it "returns the number of text fields" do
      browser.text_fields.length.should == 9
    end
  end

  describe "#[]" do
    it "returns the text field at the given index" do
      browser.text_fields[0].id.should == "new_user_first_name"
      browser.text_fields[1].id.should == "new_user_last_name"
      browser.text_fields[2].id.should == "new_user_email"
    end
  end

  describe "#each" do
    it "iterates through text fields correctly" do
      count = 0

      browser.text_fields.each_with_index do |r, index|
        r.name.should == browser.text_field(:index, index).name
        r.id.should ==  browser.text_field(:index, index).id
        r.value.should == browser.text_field(:index, index).value

        count += 1
      end

      count.should > 0
    end
  end


end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-webdriver-0.0.9 spec/watirspec/text_fields_spec.rb
watir-webdriver-0.0.8 spec/watirspec/text_fields_spec.rb