This repository was archived by the owner on Nov 16, 2018. It is now read-only.
forked from cucumber/cucumber-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
FunFX and Flex
aslakhellesoy edited this page Aug 13, 2010
·
3 revisions
FunFX is a Watir / SafariWatir / FireWatir extension that lets you talk to an Adobe Flex application straight from Ruby. It works wonderfully with Cucumber. Here is an example to get you started:
# features/support/env.rb
require 'rubygems'
require 'spec'
#require 'funfx/browser/safariwatir'
#BROWSER = Watir::Safari.new
require 'funfx/browser/firewatir'
BROWSER = FireWatir::Firefox.new
#require 'funfx/browser/watir'
#BROWSER = Watir::IE.new
DEMO_APP = "http://localhost:9851/index.html"
Before do
BROWSER.goto(DEMO_APP)
@flex = BROWSER.flex_app('DemoAppId', 'DemoAppName')
end
at_exit do
BROWSER.close
end
# features/step_definitions/date_steps.rb
Given /^I am on the new date page$/ do
tree = @flex.tree({:id => 'objectTree'})
tree.open('Date controls')
tree.select('Date controls>DateField1')
end
When /^I select date (.*)$/ do |date|
date_field = @flex.date_field({:id => 'dateField1'})
date_field.open
date_field.change(date)
end
Then /^I should see (.*) as my date$/ do |date|
date_field = @flex.date_field({:id => 'dateField1'})
date_field.selected_date.to_s.should == Date.parse(date).to_s
end
You can see the full example code in FunFX’ example directory
Ladislav Martincik has written a more general tutorial in his blog that explains how to install FunFX and some basics about the FunFX API.