Sha256: fe9c3e447e6300799d3da71f03ffd7b7f47db991d6970beb6e5fdccc405ad239

Contents?: true

Size: 818 Bytes

Versions: 1

Compression:

Stored size: 818 Bytes

Contents

class JavascriptPage
  include PageObject

  text_field(:expression, :id => 'calculator-expression')
  text_field(:results, :id => 'calculator-result')
  button(:compute, :value => 'Compute')

end

Given /^I am on jQuery example page$/ do
  PageObject.javascript_framework = :jquery
  @page = JavascriptPage.new(@browser)
  @page.navigate_to "http://localhost:4567/jquery.html"
end

Given /^I am on the Prototype example page$/ do
  PageObject.javascript_framework = :prototype
  @page = JavascriptPage.new(@browser)
  @page.navigate_to "http://localhost:4567/prototype.html"
end

When /^I ask to compute "([^\"]*)"$/ do |expression|
  @page.expression = expression
  @page.compute
end

Then /^I should be able to wait for the answer "([^\"]*)"$/ do |answer|
  @page.wait_for_ajax
  @page.results.should == answer
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
page-object-0.6.2 features/step_definitions/javascript_steps.rb