Sha256: 8c1dfb3c10da7f2359f516174737395c1e0e05b5d6429f8abee21517fdae64e2

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

require 'spec_helper'

describe Domkey::View do

  class DomsExample
    include Domkey::View
    doms(:streets) { text_fields(class: 'street1') }
  end


  before :all do
    goto_html("test.html")
  end

  it 'doms collection' do
    view = DomsExample.new
    view.should respond_to(:streets)
    view.streets.should be_kind_of(Domkey::View::PageObjectCollection)
    view.streets.each { |e| e.should be_kind_of(Domkey::View::PageObject) }
    view.streets.should_not respond_to(:value) # or should it?
    view.streets.should_not respond_to(:set) # or should it?


    # talk to the browser
    view.streets.each { |e| e.set "hello" }
    view.streets.map { |e| e.value }.should eql ["hello", "hello", "hello"]
  end

end

#require 'benchmark'
#Benchmark.bm do |bm|
#  howmany = 50
#  # setup browser
#  goto_html("test.html")
#  view = DomkeyExample::Doms.new Domkey.browser
#  bm.report('domkey') do
#    howmany.times do
#      view.streets.each { |e| e.set "hello" }
#      view.streets.map { |e| e.value }
#    end
#  end
#  bm.report('watir-') do
#    howmany.times do
#      Domkey.browser.text_fields(class: 'street1').each { |e| e.set "hello" }
#      Domkey.browser.text_field(class: 'street1').map { |e| e.value }
#    end
#  end
#end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
domkey-0.4.0 spec/view_doms_spec.rb
domkey-0.3.1 spec/view_doms_spec.rb
domkey-0.3.0 spec/view_doms_spec.rb
domkey-0.2.0 spec/view_doms_spec.rb