funfx 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +18 -0
- data/License.txt +20 -0
- data/Manifest.txt +87 -0
- data/README.txt +48 -0
- data/Rakefile +5 -0
- data/config/hoe.rb +67 -0
- data/config/requirements.rb +15 -0
- data/ext/FunFX.swc +0 -0
- data/lib/funfx.rb +34 -0
- data/lib/funfx/browser/firewatir.rb +47 -0
- data/lib/funfx/browser/flex_app_lookup.rb +22 -0
- data/lib/funfx/browser/safariwatir.rb +47 -0
- data/lib/funfx/browser/watir.rb +41 -0
- data/lib/funfx/decoder.rb +67 -0
- data/lib/funfx/flex/element.rb +161 -0
- data/lib/funfx/flex/elements.rb +2712 -0
- data/lib/funfx/flex/flex_app_id.rb +15 -0
- data/lib/funfx/flex/tabular_data.rb +22 -0
- data/lib/funfx/meta/class_dot.erb +24 -0
- data/lib/funfx/meta/code.erb +33 -0
- data/lib/funfx/meta/generator.rb +18 -0
- data/lib/funfx/meta/parser.rb +190 -0
- data/lib/funfx/version.rb +9 -0
- data/rake_tasks/deployment.rake +34 -0
- data/rake_tasks/environment.rake +7 -0
- data/rake_tasks/generation.rake +37 -0
- data/rake_tasks/hoe_ext.rake +11 -0
- data/rake_tasks/rspec.rake +28 -0
- data/script/console +10 -0
- data/script/console.cmd +1 -0
- data/script/destroy +14 -0
- data/script/destroy.cmd +1 -0
- data/script/generate +14 -0
- data/script/generate.cmd +1 -0
- data/script/txt2html +82 -0
- data/script/txt2html.cmd +1 -0
- data/setup.rb +1585 -0
- data/spec/funfx/demo_app/accordion_spec.rb +38 -0
- data/spec/funfx/demo_app/advanced_data_grid_spec.rb +74 -0
- data/spec/funfx/demo_app/alert_spec.rb +33 -0
- data/spec/funfx/demo_app/button_bar_spec.rb +21 -0
- data/spec/funfx/demo_app/button_spec.rb +68 -0
- data/spec/funfx/demo_app/check_box_spec.rb +62 -0
- data/spec/funfx/demo_app/control_bar_spec.rb +19 -0
- data/spec/funfx/demo_app/controls_with_same_id_spec.rb +37 -0
- data/spec/funfx/demo_app/data_grid_editable_spec.rb +78 -0
- data/spec/funfx/demo_app/data_grid_spec.rb +65 -0
- data/spec/funfx/demo_app/date_chooser_spec.rb +67 -0
- data/spec/funfx/demo_app/date_field_spec.rb +36 -0
- data/spec/funfx/demo_app/form_spec.rb +22 -0
- data/spec/funfx/demo_app/grid_layout_spec.rb +23 -0
- data/spec/funfx/demo_app/h_scrollbar_spec.rb +25 -0
- data/spec/funfx/demo_app/h_slider_spec.rb +21 -0
- data/spec/funfx/demo_app/horizontal_list_spec.rb +24 -0
- data/spec/funfx/demo_app/label_spec.rb +18 -0
- data/spec/funfx/demo_app/link_bar_spec.rb +57 -0
- data/spec/funfx/demo_app/link_button_spec.rb +21 -0
- data/spec/funfx/demo_app/list_spec.rb +23 -0
- data/spec/funfx/demo_app/menu_bar_spec.rb +33 -0
- data/spec/funfx/demo_app/menu_spec.rb +27 -0
- data/spec/funfx/demo_app/numeric_stepper_spec.rb +37 -0
- data/spec/funfx/demo_app/popup_button_spec.rb +36 -0
- data/spec/funfx/demo_app/popup_menu_bar_spec.rb +42 -0
- data/spec/funfx/demo_app/progress_bar_spec.rb +24 -0
- data/spec/funfx/demo_app/radio_button_group_spec.rb +50 -0
- data/spec/funfx/demo_app/radio_button_spec.rb +26 -0
- data/spec/funfx/demo_app/record_test_spec.rb +20 -0
- data/spec/funfx/demo_app/repeater_control_spec.rb +65 -0
- data/spec/funfx/demo_app/tab_bar_spec.rb +19 -0
- data/spec/funfx/demo_app/tab_navigator_spec.rb +19 -0
- data/spec/funfx/demo_app/test_spec.rb +19 -0
- data/spec/funfx/demo_app/text_area_spec.rb +28 -0
- data/spec/funfx/demo_app/text_input_spec.rb +28 -0
- data/spec/funfx/demo_app/text_spec.rb +18 -0
- data/spec/funfx/demo_app/tile_button_spec.rb +20 -0
- data/spec/funfx/demo_app/tile_list_spec.rb +25 -0
- data/spec/funfx/demo_app/title_window_spec.rb +40 -0
- data/spec/funfx/demo_app/toggle_button_spec.rb +19 -0
- data/spec/funfx/demo_app/tree_drag_and_drop_spec.rb +39 -0
- data/spec/funfx/demo_app/tree_spec.rb +24 -0
- data/spec/funfx/demo_app/view_stack_spec.rb +27 -0
- data/spec/funfx/flex/element_spec.rb +115 -0
- data/spec/funfx/flex/flex_app_id_spec.rb +40 -0
- data/spec/funfx/meta/generator_spec.rb +16 -0
- data/spec/funfx/meta/parser_spec.rb +88 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +41 -0
- metadata +166 -0
data/History.txt
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
== 0.2.0 yyyy-mm-dd
|
2
|
+
|
3
|
+
Complete rewrite of FunFX.
|
4
|
+
|
5
|
+
* 13 major enhancements:
|
6
|
+
* FunFX is a plugin to Watir/SafariWatir/FireWatir
|
7
|
+
* The FunFX API is statically generated code instead of dynamically generated
|
8
|
+
* Big poster with class diagram
|
9
|
+
* Hash based lookup of elements
|
10
|
+
* Flex stacktrace is included in Ruby stack trace
|
11
|
+
* Elements can be looked up by a "path" of ids: several hashes
|
12
|
+
* Types are coerced back to correct Ruby types when asking for properties
|
13
|
+
* Full demo app included in the source tree
|
14
|
+
* Moved to Git
|
15
|
+
* Automated build using Rake
|
16
|
+
* Proper packaging as a Ruby gem (NEEDS WORK TO INCLUDE THE FUNFX.SWC)
|
17
|
+
* Automated testing using RSpec
|
18
|
+
* The code is largely based on Adobe's AutoQuick example
|
data/License.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Peter Nicolai Motzfeldt
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest.txt
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
History.txt
|
2
|
+
License.txt
|
3
|
+
Manifest.txt
|
4
|
+
README.txt
|
5
|
+
Rakefile
|
6
|
+
config/hoe.rb
|
7
|
+
config/requirements.rb
|
8
|
+
ext/FunFX.swc
|
9
|
+
lib/funfx.rb
|
10
|
+
lib/funfx/browser/firewatir.rb
|
11
|
+
lib/funfx/browser/flex_app_lookup.rb
|
12
|
+
lib/funfx/browser/safariwatir.rb
|
13
|
+
lib/funfx/browser/watir.rb
|
14
|
+
lib/funfx/decoder.rb
|
15
|
+
lib/funfx/flex/element.rb
|
16
|
+
lib/funfx/flex/elements.rb
|
17
|
+
lib/funfx/flex/flex_app_id.rb
|
18
|
+
lib/funfx/flex/tabular_data.rb
|
19
|
+
lib/funfx/meta/class_dot.erb
|
20
|
+
lib/funfx/meta/code.erb
|
21
|
+
lib/funfx/meta/generator.rb
|
22
|
+
lib/funfx/meta/parser.rb
|
23
|
+
lib/funfx/version.rb
|
24
|
+
rake_tasks/deployment.rake
|
25
|
+
rake_tasks/environment.rake
|
26
|
+
rake_tasks/generation.rake
|
27
|
+
rake_tasks/hoe_ext.rake
|
28
|
+
rake_tasks/rspec.rake
|
29
|
+
script/console
|
30
|
+
script/console.cmd
|
31
|
+
script/destroy
|
32
|
+
script/destroy.cmd
|
33
|
+
script/generate
|
34
|
+
script/generate.cmd
|
35
|
+
script/txt2html
|
36
|
+
script/txt2html.cmd
|
37
|
+
setup.rb
|
38
|
+
spec/funfx/demo_app/accordion_spec.rb
|
39
|
+
spec/funfx/demo_app/advanced_data_grid_spec.rb
|
40
|
+
spec/funfx/demo_app/alert_spec.rb
|
41
|
+
spec/funfx/demo_app/button_bar_spec.rb
|
42
|
+
spec/funfx/demo_app/button_spec.rb
|
43
|
+
spec/funfx/demo_app/check_box_spec.rb
|
44
|
+
spec/funfx/demo_app/control_bar_spec.rb
|
45
|
+
spec/funfx/demo_app/controls_with_same_id_spec.rb
|
46
|
+
spec/funfx/demo_app/data_grid_editable_spec.rb
|
47
|
+
spec/funfx/demo_app/data_grid_spec.rb
|
48
|
+
spec/funfx/demo_app/date_chooser_spec.rb
|
49
|
+
spec/funfx/demo_app/date_field_spec.rb
|
50
|
+
spec/funfx/demo_app/form_spec.rb
|
51
|
+
spec/funfx/demo_app/grid_layout_spec.rb
|
52
|
+
spec/funfx/demo_app/h_scrollbar_spec.rb
|
53
|
+
spec/funfx/demo_app/h_slider_spec.rb
|
54
|
+
spec/funfx/demo_app/horizontal_list_spec.rb
|
55
|
+
spec/funfx/demo_app/label_spec.rb
|
56
|
+
spec/funfx/demo_app/link_bar_spec.rb
|
57
|
+
spec/funfx/demo_app/link_button_spec.rb
|
58
|
+
spec/funfx/demo_app/list_spec.rb
|
59
|
+
spec/funfx/demo_app/menu_bar_spec.rb
|
60
|
+
spec/funfx/demo_app/menu_spec.rb
|
61
|
+
spec/funfx/demo_app/numeric_stepper_spec.rb
|
62
|
+
spec/funfx/demo_app/popup_button_spec.rb
|
63
|
+
spec/funfx/demo_app/popup_menu_bar_spec.rb
|
64
|
+
spec/funfx/demo_app/progress_bar_spec.rb
|
65
|
+
spec/funfx/demo_app/radio_button_group_spec.rb
|
66
|
+
spec/funfx/demo_app/radio_button_spec.rb
|
67
|
+
spec/funfx/demo_app/record_test_spec.rb
|
68
|
+
spec/funfx/demo_app/repeater_control_spec.rb
|
69
|
+
spec/funfx/demo_app/tab_bar_spec.rb
|
70
|
+
spec/funfx/demo_app/tab_navigator_spec.rb
|
71
|
+
spec/funfx/demo_app/test_spec.rb
|
72
|
+
spec/funfx/demo_app/text_area_spec.rb
|
73
|
+
spec/funfx/demo_app/text_input_spec.rb
|
74
|
+
spec/funfx/demo_app/text_spec.rb
|
75
|
+
spec/funfx/demo_app/tile_button_spec.rb
|
76
|
+
spec/funfx/demo_app/tile_list_spec.rb
|
77
|
+
spec/funfx/demo_app/title_window_spec.rb
|
78
|
+
spec/funfx/demo_app/toggle_button_spec.rb
|
79
|
+
spec/funfx/demo_app/tree_drag_and_drop_spec.rb
|
80
|
+
spec/funfx/demo_app/tree_spec.rb
|
81
|
+
spec/funfx/demo_app/view_stack_spec.rb
|
82
|
+
spec/funfx/flex/element_spec.rb
|
83
|
+
spec/funfx/flex/flex_app_id_spec.rb
|
84
|
+
spec/funfx/meta/generator_spec.rb
|
85
|
+
spec/funfx/meta/parser_spec.rb
|
86
|
+
spec/spec.opts
|
87
|
+
spec/spec_helper.rb
|
data/README.txt
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
= funfx
|
2
|
+
|
3
|
+
* FIX (url)
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
FIX (describe your package)
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* FIX (list of features or problems)
|
12
|
+
|
13
|
+
== SYNOPSIS:
|
14
|
+
|
15
|
+
FIX (code sample of usage)
|
16
|
+
|
17
|
+
== REQUIREMENTS:
|
18
|
+
|
19
|
+
* FIX (list of requirements)
|
20
|
+
|
21
|
+
== INSTALL:
|
22
|
+
|
23
|
+
* FIX (sudo gem install, anything else)
|
24
|
+
|
25
|
+
== LICENSE:
|
26
|
+
|
27
|
+
(The MIT License)
|
28
|
+
|
29
|
+
Copyright (c) 2008 Peter Nicolai Motzfeldt
|
30
|
+
|
31
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
32
|
+
a copy of this software and associated documentation files (the
|
33
|
+
'Software'), to deal in the Software without restriction, including
|
34
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
35
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
36
|
+
permit persons to whom the Software is furnished to do so, subject to
|
37
|
+
the following conditions:
|
38
|
+
|
39
|
+
The above copyright notice and this permission notice shall be
|
40
|
+
included in all copies or substantial portions of the Software.
|
41
|
+
|
42
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
43
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
44
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
45
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
data/config/hoe.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
require 'funfx/version'
|
2
|
+
|
3
|
+
DESCRIPTION = "Functional testing for Flex"
|
4
|
+
GEM_NAME = 'funfx' # what ppl will type to install your gem
|
5
|
+
RUBYFORGE_PROJECT = 'funfx' # The unix name for your project
|
6
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
7
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
8
|
+
|
9
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
10
|
+
@config = nil
|
11
|
+
RUBYFORGE_USERNAME = nil
|
12
|
+
def rubyforge_username
|
13
|
+
unless @config
|
14
|
+
begin
|
15
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
16
|
+
rescue
|
17
|
+
puts <<-EOS
|
18
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
19
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
20
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
21
|
+
EOS
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
end
|
25
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
REV = nil
|
30
|
+
# UNCOMMENT IF REQUIRED:
|
31
|
+
# REV = YAML.load(`svn info`)['Revision']
|
32
|
+
VERS = FunFX::VERSION::STRING + (REV ? ".#{REV}" : "")
|
33
|
+
RDOC_OPTS = ['--quiet', '--title', 'FunFX documentation',
|
34
|
+
"--opname", "index.html",
|
35
|
+
"--line-numbers",
|
36
|
+
"--main", "README",
|
37
|
+
"--inline-source"]
|
38
|
+
|
39
|
+
class Hoe
|
40
|
+
def extra_deps
|
41
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
42
|
+
@extra_deps
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# Generate all the Rake tasks
|
47
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
48
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
49
|
+
p.developer('Peter Nicolai Motzfeldt', "motzfeldt@gmail.com")
|
50
|
+
p.developer('Aslak Hellesøy', "aslak.hellesoy@gmail.com")
|
51
|
+
p.description = DESCRIPTION
|
52
|
+
p.summary = DESCRIPTION
|
53
|
+
p.url = HOMEPATH
|
54
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
55
|
+
p.test_globs = ["test/**/test_*.rb"]
|
56
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', 'coverage'] #An array of file patterns to delete on clean.
|
57
|
+
p.rdoc_pattern = /^(lib|bin)|txt$/ # We don't want the ext/FunFX.swc in RDoc!
|
58
|
+
|
59
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
60
|
+
p.extra_deps = [ ['fastercsv', '>= 1.4.0'] ]
|
61
|
+
end
|
62
|
+
|
63
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
64
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
65
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
66
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
67
|
+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
include FileUtils
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
%w[rake hoe newgem rubigen].each do |req_gem|
|
6
|
+
begin
|
7
|
+
require req_gem
|
8
|
+
rescue LoadError
|
9
|
+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
|
10
|
+
puts "Installation: gem install #{req_gem} -y"
|
11
|
+
exit
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
|
data/ext/FunFX.swc
ADDED
Binary file
|
data/lib/funfx.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require 'funfx/decoder'
|
5
|
+
require 'funfx/browser/flex_app_lookup'
|
6
|
+
require 'funfx/flex/element'
|
7
|
+
require 'funfx/flex/elements'
|
8
|
+
require 'funfx/flex/flex_app_id'
|
9
|
+
|
10
|
+
module FunFX
|
11
|
+
class << self
|
12
|
+
# Turn on debug information
|
13
|
+
def debug=(b)
|
14
|
+
@debug = b
|
15
|
+
end
|
16
|
+
|
17
|
+
# Prints debug information (if debug is on - it's off by default)
|
18
|
+
def debug(s)
|
19
|
+
if @debug
|
20
|
+
puts s
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Set how many seconds to sleep after an event is fired.
|
25
|
+
def fire_pause=(t)
|
26
|
+
@fire_pause = t
|
27
|
+
end
|
28
|
+
|
29
|
+
# How many seconds to sleep after an event is fired. Defaults to 2 seconds.
|
30
|
+
def fire_pause
|
31
|
+
@fire_pause || 2
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'firewatir'
|
3
|
+
require 'funfx'
|
4
|
+
|
5
|
+
module FireWatir
|
6
|
+
# FireWatir extension for FunFX. Allows lookup of FlexApp objects via FunFX::Browser::FlexAppLookup#flex_app.
|
7
|
+
class Firefox
|
8
|
+
include FunFX::Browser::FlexAppLookup
|
9
|
+
def platform_flex_app(dom_id, app_name) #:nodoc:
|
10
|
+
sleep(2) # TODO: Try to remove this
|
11
|
+
FlexApp.new(dom_id, app_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
class FlexApp < ::Element #:nodoc:
|
15
|
+
include FunFX::Flex::Elements
|
16
|
+
include FunFX::Flex::FlexAppId
|
17
|
+
|
18
|
+
def initialize(dom_id, app_name)
|
19
|
+
@dom_id, @app_name = dom_id, app_name
|
20
|
+
end
|
21
|
+
|
22
|
+
def fire_event(flex_locator, event_name, args) # :nodoc:
|
23
|
+
javascript = %|#{DOCUMENT_VAR}.getElementById("#{@dom_id}").fireFunFXEvent(#{flex_locator}, #{event_name.inspect}, "#{args}");\n|
|
24
|
+
$jssh_socket.send(javascript, 0)
|
25
|
+
read_socket
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_property_value(flex_locator, property) # :nodoc:
|
29
|
+
javascript = %|#{DOCUMENT_VAR}.getElementById("#{@dom_id}").getFunFXPropertyValue(#{flex_locator}, #{property.inspect});\n|
|
30
|
+
$jssh_socket.send(javascript, 0)
|
31
|
+
read_socket
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_tabular_property_value(flex_locator, property) # :nodoc:
|
35
|
+
javascript = %|#{DOCUMENT_VAR}.getElementById("#{@dom_id}").getFunFXTabularPropertyValue(#{flex_locator}, #{property.inspect});\n|
|
36
|
+
$jssh_socket.send(javascript, 0)
|
37
|
+
read_socket
|
38
|
+
end
|
39
|
+
|
40
|
+
def invoke_tabular_method(flex_locator, method_name, *args) # :nodoc:
|
41
|
+
javascript = %|#{DOCUMENT_VAR}.getElementById("#{@dom_id}").invokeFunFXTabularMethod(#{flex_locator}, #{method_name.inspect}, #{args.map{|a| a.inspect}.join(', ')});\n|
|
42
|
+
$jssh_socket.send(javascript, 0)
|
43
|
+
read_socket
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module FunFX
|
2
|
+
module Browser
|
3
|
+
module FlexAppLookup
|
4
|
+
# Returns a FlexApp object.
|
5
|
+
#
|
6
|
+
# Look at the source of the HTML file hosting and look for the following:
|
7
|
+
#
|
8
|
+
# AC_FL_RunContent(
|
9
|
+
# "id", "MyId",
|
10
|
+
# "name", "MyName"
|
11
|
+
# );
|
12
|
+
#
|
13
|
+
# In this example you would use:
|
14
|
+
#
|
15
|
+
# flex = browser.flex_app("MyId", "MyName")
|
16
|
+
#
|
17
|
+
def flex_app(dom_id, app_name)
|
18
|
+
platform_flex_app(dom_id, app_name)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'safariwatir'
|
3
|
+
require 'funfx'
|
4
|
+
|
5
|
+
module Watir
|
6
|
+
# SafariWatir extension for FunFX. Allows lookup of FlexApp objects via FunFX::Browser::FlexAppLookup#flex_app.
|
7
|
+
class Safari
|
8
|
+
include FunFX::Browser::FlexAppLookup
|
9
|
+
def platform_flex_app(dom_id, app_name) #:nodoc:
|
10
|
+
FlexApp.new(scripter, :id, dom_id, app_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
class FlexApp < HtmlElement #:nodoc:
|
14
|
+
include FunFX::Flex::Elements
|
15
|
+
include FunFX::Flex::FlexAppId
|
16
|
+
|
17
|
+
def initialize(scripter, how, what, app_name)
|
18
|
+
super(scripter, how, what)
|
19
|
+
@id_prefix = "id{#{app_name} string}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def fire_event(flex_locator, event_name, args) # :nodoc:
|
23
|
+
eval_js %{return element.fireFunFXEvent(#{flex_locator}, #{event_name.inspect}, "#{args}")}
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_property_value(flex_locator, property) # :nodoc:
|
27
|
+
eval_js %{return element.getFunFXPropertyValue(#{flex_locator}, #{property.inspect})}
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_tabular_property_value(flex_locator, property) # :nodoc:
|
31
|
+
eval_js %{return element.getFunFXTabularPropertyValue(#{flex_locator}, #{property.inspect})}
|
32
|
+
end
|
33
|
+
|
34
|
+
def invoke_tabular_method(flex_locator, method_name, *args) # :nodoc:
|
35
|
+
eval_js %{return element.invokeFunFXTabularMethod(#{flex_locator}, #{method_name.inspect}, #{args.map{|a| a.inspect}.join(', ')})}
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def eval_js(js)
|
41
|
+
result = @scripter.__send__(:execute, operate{js}, self)
|
42
|
+
raise "Nothing returned from Safari. Are you sure you have compiled the Flex app with FunFX?" if result.nil?
|
43
|
+
result
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'watir'
|
3
|
+
require 'funfx'
|
4
|
+
|
5
|
+
module Watir
|
6
|
+
# Watir extension for FunFX. Allows lookup of FlexApp objects via FunFX::Browser::FlexAppLookup#flex_app.
|
7
|
+
class IE
|
8
|
+
include FunFX::Browser::FlexAppLookup
|
9
|
+
def platform_flex_app(dom_id, app_name)
|
10
|
+
FlexApp.new(self, dom_id, app_name)
|
11
|
+
end
|
12
|
+
|
13
|
+
class FlexApp < Element #:nodoc:
|
14
|
+
include FunFX::Flex::Elements
|
15
|
+
include FunFX::Flex::FlexAppId
|
16
|
+
|
17
|
+
def initialize(ole_object, dom_id, app_name)
|
18
|
+
super(ole_object)
|
19
|
+
@flex_object = ole_object.ie.Document.getElementsByName(dom_id).item(0)
|
20
|
+
raise "Couldn't find Flex object with id #{dom_id.inspect}" if @flex_object.nil?
|
21
|
+
@app_name = app_name
|
22
|
+
end
|
23
|
+
|
24
|
+
def fire_event(flex_locator, event_name, args) # :nodoc:
|
25
|
+
@flex_object.fireFunFXEvent(flex_locator, event_name, args)
|
26
|
+
end
|
27
|
+
|
28
|
+
def get_property_value(flex_locator, property) # :nodoc:
|
29
|
+
@flex_object.getFunFXPropertyValue(flex_locator, property)
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_tabular_property_value(flex_locator, property) # :nodoc:
|
33
|
+
@flex_object.getFunFXTabularPropertyValue(flex_locator, property)
|
34
|
+
end
|
35
|
+
|
36
|
+
def invoke_tabular_method(flex_locator, method_name, *args) # :nodoc:
|
37
|
+
@flex_object.invokeFunFXTabularMethod(flex_locator, method_name, *args)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|