Sha256: 1fa54a86b93038e45f50661960d31f5ae0bbf7bc4de953002e5662542efe2601

Contents?: true

Size: 1.6 KB

Versions: 6

Compression:

Stored size: 1.6 KB

Contents

require 'watirspec_helper'

describe 'Table' do
  before :each do
    browser.goto(WatirSpec.url_for('nested_tables.html'))
  end

  it 'returns the correct number of rows under a table element' do
    tables = browser.div(id: 'table-rows-test').tables(id: /^tbl/)
    expect(tables.length).to be > 0

    tables.each do |table|
      expected = Integer(table.data_row_count)
      actual = table.rows.length
      browser_count = Integer(table.data_browser_count)

      msg = "expected #{expected} rows, got #{actual} for table id=#{table.id}, browser reported: #{browser_count}"
      expect(actual).to eql(expected), msg
    end
  end

  it 'returns the correct number of cells under a row' do
    rows = browser.div(id: 'row-cells-test').trs(id: /^row/)
    expect(rows.length).to be > 0

    rows.each do |row|
      expected = Integer(row.data_cell_count)
      actual = row.cells.length
      browser_count = Integer(row.data_browser_count)

      msg = "expected #{expected} cells, got #{actual} for row id=#{row.id}, browser reported: #{browser_count}"
      expect(actual).to eql(expected), msg
    end
  end

  it 'returns the correct number of rows under a table section' do
    tbodies = browser.table(id: 'tbody-rows-test').tbodys(id: /^body/)
    expect(tbodies.length).to be > 0

    tbodies.each do |tbody|
      expected = Integer(tbody.data_rows_count)
      actual = tbody.rows.count
      browser_count = Integer(tbody.data_browser_count)

      msg = "expected #{expected} rows, got #{actual} for tbody id=#{tbody.id}, browser reported: #{browser_count}"
      expect(actual).to eql(expected), msg
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
watir-7.1.0 spec/watirspec/elements/table_nesting_spec.rb
watir-7.0.0 spec/watirspec/elements/table_nesting_spec.rb
watir-7.0.0.beta5 spec/watirspec/elements/table_nesting_spec.rb
watir-7.0.0.beta4 spec/watirspec/elements/table_nesting_spec.rb
watir-7.0.0.beta3 spec/watirspec/elements/table_nesting_spec.rb
watir-7.0.0.beta2 spec/watirspec/elements/table_nesting_spec.rb