features/step_definitions/javascript_steps.rb in page-object-0.8.1 vs features/step_definitions/javascript_steps.rb in page-object-0.8.2
- old
+ new
@@ -5,19 +5,25 @@
text_field(:results, :id => 'calculator-result')
button(:compute, :value => 'Compute')
end
+def build_url(page)
+ target = ENV['BROWSER']
+ return "http://localhost:4567/#{page}" if target.nil? or target.include? 'local'
+ "http://ec2-107-22-131-88.compute-1.amazonaws.com:4567/#{page}"
+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"
+ @page.navigate_to build_url("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"
+ @page.navigate_to build_url('prototype.html')
end
When /^I ask to compute "([^\"]*)"$/ do |expression|
@page.expression = expression
@page.compute