Sha256: a1dec80f31e544baa662eb512ab133490e8a500653cb1f527caaac58b6a61be9

Contents?: true

Size: 1008 Bytes

Versions: 4

Compression:

Stored size: 1008 Bytes

Contents

class JavascriptPage
  include Druid

  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
  Druid.javascript_framework = :jquery
  @page = JavascriptPage.new(@driver)
  @page.navigate_to "http://localhost:4567/jquery.html"
end

Given(/^I am on the Prototype example page$/) do
  Druid.javascript_framework = :prototype
  @page = JavascriptPage.new(@driver)
  @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
  expect(@page.results).to eql answer
end

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
druid-ts-1.1.6 features/step_definations/javasript_steps.rb
druid-ts-1.1.5 features/step_definations/javasript_steps.rb
druid-ts-1.1.4 features/step_definations/javasript_steps.rb
druid-ts-1.1.3 features/step_definations/javasript_steps.rb