Sha256: 58f4305719d74945301f121415780c8eb2eadbb0bece1f0c5f02ff05a562b439

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

require "watirspec_helper"

describe "Collections" do

  it "returns inner elements of parent element having different html tag" do
    browser.goto(WatirSpec.url_for("collections.html"))
    expect(browser.span(id: "a_span").divs.size).to eq 2
  end

  it "returns inner elements of parent element having same html tag" do
    browser.goto(WatirSpec.url_for("collections.html"))
    expect(browser.span(id: "a_span").spans.size).to eq 2
  end

  it "returns correct subtype of elements" do
    browser.goto(WatirSpec.url_for("collections.html"))
    collection = browser.span(id: "a_span").spans.to_a
    expect(collection.all? { |el| el.is_a? Watir::Span}).to eq true
  end

  it "can contain more than one type of element" do
    browser.goto(WatirSpec.url_for("nested_elements.html"))
    collection = browser.div(id: "parent").children
    expect(collection.any? { |el| el.is_a? Watir::Span}).to eq true
    expect(collection.any? { |el| el.is_a? Watir::Div}).to eq true
  end

  it "relocates the same element" do
    browser.goto(WatirSpec.url_for("nested_elements.html"))
    collection = browser.div(id: "parent").children
    tag = collection[3].tag_name
    browser.refresh
    expect(collection[3].tag_name).to eq tag
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
watir-6.5.0 spec/watirspec/elements/collections_spec.rb
watir-6.4.3 spec/watirspec/elements/collections_spec.rb