Sha256: 3f217a2848be68d3065cdccd6dd88b261dadb4720d07072ab1176db6abc4d4e2

Contents?: true

Size: 1014 Bytes

Versions: 17

Compression:

Stored size: 1014 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

Given /^I execute the javascript "([^\"]*)"$/ do |script|
  @answer = @page.execute_script script
end

Then /^I should get the answer "([^\"]*)"$/ do |answer|
  @answer.should == answer.to_i
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
page-object-0.8.1 features/step_definitions/javascript_steps.rb
page-object-0.8 features/step_definitions/javascript_steps.rb
page-object-0.7.6 features/step_definitions/javascript_steps.rb
page-object-0.7.5.1 features/step_definitions/javascript_steps.rb
page-object-0.7.5 features/step_definitions/javascript_steps.rb
page-object-0.7.4 features/step_definitions/javascript_steps.rb
page-object-0.7.3 features/step_definitions/javascript_steps.rb
page-object-0.7.2 features/step_definitions/javascript_steps.rb
page-object-0.7.1 features/step_definitions/javascript_steps.rb
page-object-0.7.0 features/step_definitions/javascript_steps.rb
page-object-0.6.9 features/step_definitions/javascript_steps.rb
page-object-0.6.8 features/step_definitions/javascript_steps.rb
page-object-0.6.7 features/step_definitions/javascript_steps.rb
page-object-0.6.6 features/step_definitions/javascript_steps.rb
page-object-0.6.5 features/step_definitions/javascript_steps.rb
page-object-0.6.4 features/step_definitions/javascript_steps.rb
page-object-0.6.3 features/step_definitions/javascript_steps.rb