symbiont 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +10 -39
- data/HISTORY.md +6 -0
- data/lib/symbiont.rb +8 -4
- data/lib/symbiont/enclosers.rb +4 -4
- data/lib/symbiont/evaluators.rb +22 -29
- data/lib/symbiont/generators.rb +82 -317
- data/lib/symbiont/platform_selenium.rb +18 -0
- data/lib/symbiont/platform_selenium/platform_object.rb +236 -0
- data/lib/symbiont/platform_selenium/web_objects/button.rb +13 -0
- data/lib/symbiont/platform_selenium/web_objects/checkbox.rb +21 -0
- data/lib/symbiont/platform_selenium/web_objects/common.rb +104 -0
- data/lib/symbiont/platform_selenium/web_objects/link.rb +13 -0
- data/lib/symbiont/platform_selenium/web_objects/radio.rb +21 -0
- data/lib/symbiont/platform_selenium/web_objects/select_list.rb +79 -0
- data/lib/symbiont/platform_selenium/web_objects/table.rb +40 -0
- data/lib/symbiont/platform_selenium/web_objects/table_row.rb +36 -0
- data/lib/symbiont/platform_selenium/web_objects/text_field.rb +14 -0
- data/lib/symbiont/platform_watir.rb +13 -4
- data/lib/symbiont/platform_watir/platform_object.rb +74 -262
- data/lib/symbiont/platform_watir/web_objects/checkbox.rb +21 -0
- data/lib/symbiont/platform_watir/web_objects/common.rb +82 -0
- data/lib/symbiont/platform_watir/web_objects/radio.rb +21 -0
- data/lib/symbiont/platform_watir/web_objects/select_list.rb +67 -0
- data/lib/symbiont/platform_watir/web_objects/table.rb +31 -0
- data/lib/symbiont/platform_watir/web_objects/table_row.rb +31 -0
- data/lib/symbiont/platform_watir/web_objects/text_field.rb +13 -0
- data/lib/symbiont/platforms.rb +18 -6
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/_common.rb +53 -74
- data/lib/symbiont/web_objects/button.rb +23 -4
- data/lib/symbiont/web_objects/checkbox.rb +24 -10
- data/lib/symbiont/web_objects/div.rb +9 -1
- data/lib/symbiont/web_objects/link.rb +25 -4
- data/lib/symbiont/web_objects/paragraph.rb +11 -0
- data/lib/symbiont/web_objects/radio.rb +27 -1
- data/lib/symbiont/web_objects/select_list.rb +20 -56
- data/lib/symbiont/web_objects/span.rb +9 -1
- data/lib/symbiont/web_objects/table.rb +19 -22
- data/lib/symbiont/web_objects/table_cell.rb +17 -1
- data/lib/symbiont/web_objects/table_row.rb +18 -25
- data/lib/symbiont/web_objects/text_field.rb +27 -11
- data/symbiont.gemspec +3 -8
- metadata +29 -122
- data/app/Gemfile +0 -4
- data/app/app.rb +0 -181
- data/app/config/database.rb +0 -9
- data/app/models/plan.rb +0 -10
- data/app/models/product.rb +0 -10
- data/app/models/study.rb +0 -11
- data/app/models/user.rb +0 -13
- data/app/public/css/style.css +0 -138
- data/app/views/create_plan.erb +0 -21
- data/app/views/create_product.erb +0 -15
- data/app/views/create_study.erb +0 -24
- data/app/views/create_user.erb +0 -60
- data/app/views/db_plans.erb +0 -31
- data/app/views/db_products.erb +0 -29
- data/app/views/db_studies.erb +0 -33
- data/app/views/db_users.erb +0 -23
- data/app/views/entity_list.erb +0 -10
- data/app/views/index.erb +0 -8
- data/app/views/layout.erb +0 -39
- data/app/views/login_page.erb +0 -17
- data/app/views/success_1.erb +0 -2
- data/app/views/success_2.erb +0 -2
- data/app/views/test_database.erb +0 -13
- data/app/views/test_events.erb +0 -51
- data/app/views/test_login.erb +0 -53
- data/app/views/test_login_error.erb +0 -22
- data/app/views/test_login_success.erb +0 -22
- data/app/views/test_page.erb +0 -184
- data/specs/button.feature +0 -44
- data/specs/checkbox.feature +0 -40
- data/specs/data_setter.feature +0 -29
- data/specs/definitions/pages.rb +0 -156
- data/specs/div.feature +0 -11
- data/specs/evaluators.feature +0 -17
- data/specs/events.feature +0 -30
- data/specs/frame.feature +0 -5
- data/specs/link.feature +0 -42
- data/specs/locators.feature +0 -17
- data/specs/radio.feature +0 -38
- data/specs/select_list.feature +0 -50
- data/specs/simple_test.feature +0 -13
- data/specs/span.feature +0 -11
- data/specs/support/env.rb +0 -20
- data/specs/support/hooks.rb +0 -11
- data/specs/support/test_steps/action_steps_buttons.rb +0 -70
- data/specs/support/test_steps/action_steps_checkboxes.rb +0 -75
- data/specs/support/test_steps/action_steps_data_setter.rb +0 -56
- data/specs/support/test_steps/action_steps_divs.rb +0 -18
- data/specs/support/test_steps/action_steps_evaluators.rb +0 -15
- data/specs/support/test_steps/action_steps_events.rb +0 -77
- data/specs/support/test_steps/action_steps_frames.rb +0 -13
- data/specs/support/test_steps/action_steps_links.rb +0 -61
- data/specs/support/test_steps/action_steps_locators.rb +0 -44
- data/specs/support/test_steps/action_steps_navigate.rb +0 -25
- data/specs/support/test_steps/action_steps_radios.rb +0 -75
- data/specs/support/test_steps/action_steps_select_lists.rb +0 -106
- data/specs/support/test_steps/action_steps_spans.rb +0 -18
- data/specs/support/test_steps/action_steps_tables.rb +0 -82
- data/specs/support/test_steps/action_steps_text_fields.rb +0 -107
- data/specs/support/test_steps/action_steps_webobjects.rb +0 -31
- data/specs/support/test_steps/simple_test_steps.rb +0 -8
- data/specs/table.feature +0 -39
- data/specs/text_field.feature +0 -47
- data/specs/web_object.feature +0 -15
data/Gemfile.lock
CHANGED
|
@@ -1,58 +1,29 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
symbiont (0.1.
|
|
5
|
-
|
|
4
|
+
symbiont (0.1.8)
|
|
5
|
+
selenium-webdriver (= 2.29.0)
|
|
6
|
+
watir-webdriver (= 0.6.2)
|
|
6
7
|
|
|
7
8
|
GEM
|
|
8
9
|
remote: http://rubygems.org/
|
|
9
10
|
specs:
|
|
10
|
-
|
|
11
|
-
builder (3.0.0)
|
|
12
|
-
childprocess (0.3.5)
|
|
11
|
+
childprocess (0.3.7)
|
|
13
12
|
ffi (~> 1.0, >= 1.0.6)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
diff-lcs (>= 1.1.3)
|
|
17
|
-
gherkin (~> 2.11.0)
|
|
18
|
-
json (>= 1.4.6)
|
|
19
|
-
diff-lcs (1.1.3)
|
|
20
|
-
ffi (1.1.5)
|
|
21
|
-
ffi (1.1.5-x86-mingw32)
|
|
22
|
-
gherkin (2.11.1-x86-mingw32)
|
|
23
|
-
json (>= 1.4.6)
|
|
24
|
-
json (1.7.3)
|
|
25
|
-
libwebsocket (0.1.5)
|
|
26
|
-
addressable
|
|
27
|
-
multi_json (1.3.5)
|
|
28
|
-
rspec (2.11.0)
|
|
29
|
-
rspec-core (~> 2.11.0)
|
|
30
|
-
rspec-expectations (~> 2.11.0)
|
|
31
|
-
rspec-mocks (~> 2.11.0)
|
|
32
|
-
rspec-core (2.11.0)
|
|
33
|
-
rspec-expectations (2.11.1)
|
|
34
|
-
diff-lcs (~> 1.1.3)
|
|
35
|
-
rspec-mocks (2.11.1)
|
|
13
|
+
ffi (1.3.1-x86-mingw32)
|
|
14
|
+
multi_json (1.5.0)
|
|
36
15
|
rubyzip (0.9.9)
|
|
37
|
-
selenium-webdriver (2.
|
|
16
|
+
selenium-webdriver (2.29.0)
|
|
38
17
|
childprocess (>= 0.2.5)
|
|
39
|
-
libwebsocket (~> 0.1.3)
|
|
40
18
|
multi_json (~> 1.0)
|
|
41
19
|
rubyzip
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
simplecov-html (~> 0.5.3)
|
|
45
|
-
simplecov-html (0.5.3)
|
|
46
|
-
watir-webdriver (0.6.1)
|
|
20
|
+
websocket (~> 1.0.4)
|
|
21
|
+
watir-webdriver (0.6.2)
|
|
47
22
|
selenium-webdriver (>= 2.18.0)
|
|
48
|
-
|
|
23
|
+
websocket (1.0.7)
|
|
49
24
|
|
|
50
25
|
PLATFORMS
|
|
51
26
|
x86-mingw32
|
|
52
27
|
|
|
53
28
|
DEPENDENCIES
|
|
54
|
-
cucumber (= 1.2.1)
|
|
55
|
-
rspec (= 2.11.0)
|
|
56
|
-
simplecov (= 0.6.4)
|
|
57
29
|
symbiont!
|
|
58
|
-
yard (= 0.8.2.1)
|
data/HISTORY.md
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
Change Log and History
|
|
2
2
|
======================
|
|
3
3
|
|
|
4
|
+
Version 0.1.8 / 2013-01-30
|
|
5
|
+
--------------------------
|
|
6
|
+
|
|
7
|
+
This release made a lot of internal changes in order to begin incorporating Selenium, similar to how the page-object gem works. It's still very uncertain to me whether it makes sense to include Selenium at all so this will be a trial of that. Currently my focus is still on Watir and there is a lot of logic that does not yet work with Selenium.
|
|
8
|
+
|
|
9
|
+
|
|
4
10
|
Version 0.1.7 / 2012-10-16
|
|
5
11
|
--------------------------
|
|
6
12
|
|
data/lib/symbiont.rb
CHANGED
|
@@ -15,10 +15,8 @@ module Symbiont
|
|
|
15
15
|
include Locators
|
|
16
16
|
include DataSetter
|
|
17
17
|
|
|
18
|
-
# Used to make a platform object accessible. Will hold object
|
|
19
|
-
# references like these:
|
|
20
|
-
# <Symbiont::Platforms::WatirWebDriver::PlatformObject:0x2cbe8a0>
|
|
21
18
|
attr_reader :platform
|
|
19
|
+
attr_reader :browser
|
|
22
20
|
|
|
23
21
|
def self.version
|
|
24
22
|
"Symbiont v#{Symbiont::VERSION}"
|
|
@@ -41,6 +39,12 @@ module Symbiont
|
|
|
41
39
|
@page_wait ||= 15
|
|
42
40
|
end
|
|
43
41
|
|
|
42
|
+
# Returns the default wait value for elements on a page. This value is
|
|
43
|
+
# the default value beyond which a timeout is assumed.
|
|
44
|
+
def self.element_level_wait
|
|
45
|
+
@element_wait ||= 5
|
|
46
|
+
end
|
|
47
|
+
|
|
44
48
|
# The initialize method will be invoked when a page definition includes
|
|
45
49
|
# Symbiont. Some key things are happening here that are critical to
|
|
46
50
|
# Symbiont working correctly:
|
|
@@ -65,7 +69,7 @@ module Symbiont
|
|
|
65
69
|
#
|
|
66
70
|
# @param [Object] browser a browser instance with a tool driver
|
|
67
71
|
def establish_platform_object_for(browser)
|
|
68
|
-
@platform = get_platform_for(browser)
|
|
72
|
+
@platform = get_platform_for(browser, Symbiont::Platforms.list)
|
|
69
73
|
end
|
|
70
74
|
|
|
71
75
|
end
|
data/lib/symbiont/enclosers.rb
CHANGED
|
@@ -52,7 +52,7 @@ module Symbiont
|
|
|
52
52
|
# @page.title.should == "Test App"
|
|
53
53
|
# end
|
|
54
54
|
def wait_for(timeout=Symbiont.page_level_wait, message=nil, &block)
|
|
55
|
-
|
|
55
|
+
platform.wait_for(timeout, message, &block)
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
# Provides a context for an action that will generate a JavaScript alert
|
|
@@ -66,7 +66,7 @@ module Symbiont
|
|
|
66
66
|
# @page.submitForm
|
|
67
67
|
# end
|
|
68
68
|
def will_alert(&block)
|
|
69
|
-
|
|
69
|
+
platform.will_alert(&block)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
# Provides a context for an action that will generate a JavaScript
|
|
@@ -82,7 +82,7 @@ module Symbiont
|
|
|
82
82
|
# @page.areYouSure
|
|
83
83
|
# end
|
|
84
84
|
def will_confirm(response, &block)
|
|
85
|
-
|
|
85
|
+
platform.will_confirm(response, &block)
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
# Provides a context for an action that will generate a JavaScript prompt
|
|
@@ -98,7 +98,7 @@ module Symbiont
|
|
|
98
98
|
# @page.useValue
|
|
99
99
|
# end
|
|
100
100
|
def will_prompt(response, &block)
|
|
101
|
-
|
|
101
|
+
platform.will_prompt(response, &block)
|
|
102
102
|
end
|
|
103
103
|
|
|
104
104
|
end # module: Enclosers
|
data/lib/symbiont/evaluators.rb
CHANGED
|
@@ -1,71 +1,64 @@
|
|
|
1
1
|
module Symbiont
|
|
2
2
|
module Evaluators
|
|
3
3
|
|
|
4
|
-
# Visits a page via a specified URL. The URL can be specified as a domain
|
|
5
|
-
# address or as a file-based link.
|
|
6
|
-
# @param [String] url the full URL to navigate to
|
|
7
4
|
def visit(url)
|
|
8
|
-
|
|
5
|
+
platform.visit(url)
|
|
9
6
|
end
|
|
10
7
|
|
|
11
|
-
# Returns the text of the current page. This is the text minus any
|
|
12
|
-
# markup.
|
|
13
8
|
def text
|
|
14
|
-
|
|
9
|
+
platform.text
|
|
15
10
|
end
|
|
16
11
|
|
|
17
|
-
# Returns the markup of the current page.
|
|
18
12
|
def markup
|
|
19
|
-
|
|
13
|
+
platform.markup
|
|
20
14
|
end
|
|
21
15
|
|
|
22
|
-
|
|
16
|
+
alias_method :html, :markup
|
|
23
17
|
|
|
24
|
-
# Returns the title of the current page.
|
|
25
18
|
def title
|
|
26
|
-
|
|
19
|
+
platform.title
|
|
27
20
|
end
|
|
28
21
|
|
|
29
|
-
# Returns the URL of the active page.
|
|
30
22
|
def url
|
|
31
|
-
|
|
23
|
+
platform.url
|
|
32
24
|
end
|
|
33
25
|
|
|
34
26
|
# Save a snapshot of the current screen to a provided file location.
|
|
35
27
|
# The file will be saved as a PNG file in the path specified or in the
|
|
36
28
|
# location where the tests are being run from.
|
|
37
|
-
# @param [String] file the file name to save the image as
|
|
38
29
|
def screenshot(file)
|
|
39
|
-
|
|
30
|
+
platform.screenshot file
|
|
40
31
|
end
|
|
41
32
|
|
|
42
|
-
# Returns the web object that currently has focus.
|
|
43
33
|
def focus
|
|
44
|
-
|
|
34
|
+
platform.focus
|
|
45
35
|
end
|
|
46
|
-
|
|
36
|
+
|
|
37
|
+
alias_method :what_has_focus?, :focus
|
|
38
|
+
|
|
47
39
|
# Executes JavaScript against the browser instance.
|
|
48
40
|
def run_script(script)
|
|
49
|
-
|
|
41
|
+
platform.run_script(script)
|
|
50
42
|
end
|
|
51
43
|
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
alias_method :execute_script, :run_script
|
|
45
|
+
|
|
46
|
+
def back
|
|
47
|
+
platform.back
|
|
48
|
+
end
|
|
49
|
+
|
|
54
50
|
# Provides an evaluator that attempts to wait for any pending AJAX
|
|
55
51
|
# requests from the jQuery library.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
# @param [String] message text to print if timeout period is exceeded
|
|
59
|
-
def wait_for_pending_requests(timeout=30, message=nil)
|
|
60
|
-
end_time = ::Time.now + timeout
|
|
52
|
+
def wait_for_pending_requests(time_limit=30, message_if_timeout=nil)
|
|
53
|
+
end_time = ::Time.now + time_limit
|
|
61
54
|
until ::Time.now > end_time
|
|
62
55
|
begin
|
|
63
|
-
return if
|
|
56
|
+
return if browser.execute_script('return jQuery.active') == 0
|
|
64
57
|
rescue ReferenceError
|
|
65
58
|
end
|
|
66
59
|
sleep 0.5
|
|
67
60
|
end
|
|
68
|
-
message = "Pending requests never indicated completion" unless
|
|
61
|
+
message = "Pending jQuery requests never indicated completion." unless message_if_timeout
|
|
69
62
|
raise message
|
|
70
63
|
end
|
|
71
64
|
|
data/lib/symbiont/generators.rb
CHANGED
|
@@ -1,65 +1,28 @@
|
|
|
1
1
|
module Symbiont
|
|
2
|
-
|
|
3
|
-
# The Generators module is used to provide groupings of methods that are
|
|
4
|
-
# generated dynamically based on object declarations in page definitions.
|
|
5
|
-
# The method provided allow for referencing and accessing web objects.
|
|
6
|
-
# The platform object acts as a delegate for all method calls.
|
|
7
|
-
|
|
8
2
|
module Generators
|
|
9
3
|
|
|
10
|
-
# This method allows for a url_is() method in definitions that will
|
|
11
|
-
# define a direct means of accessing a resource. The most common
|
|
12
|
-
# example will be a URL for a web page, but any URI is valid. The
|
|
13
|
-
# URL provided can be navigated to using the generated view() method
|
|
14
|
-
# on a definition instance.
|
|
15
|
-
#
|
|
16
|
-
# @param [String] url the resource identifier to access
|
|
17
|
-
# @return [Nil]
|
|
18
4
|
def url_is(url)
|
|
19
5
|
define_method("view") do
|
|
20
|
-
|
|
6
|
+
platform.visit(url)
|
|
21
7
|
end
|
|
22
8
|
end
|
|
23
9
|
|
|
24
|
-
# This method allows for a begin_at() method in definitions. The
|
|
25
|
-
# URL provided can be navigated to using the generated start()
|
|
26
|
-
# method on a definition instance.
|
|
27
|
-
#
|
|
28
|
-
# @see Symbiont::Generators#url_is
|
|
29
|
-
# @param [String] url the resource identifier to access
|
|
30
|
-
# @return [Nil]
|
|
31
10
|
def begin_at(url)
|
|
32
11
|
define_method("start") do
|
|
33
|
-
|
|
12
|
+
platform.visit(url)
|
|
34
13
|
end
|
|
35
14
|
end
|
|
36
15
|
|
|
37
|
-
# This method allows for a title_is() method in definitions. The idea
|
|
38
|
-
# is that you can specify the title of a page. This title can then be
|
|
39
|
-
# checked on. Note that the assumption here is that the title will
|
|
40
|
-
# be static. The argument to the method can, however, be a
|
|
41
|
-
# regular expression.
|
|
42
|
-
#
|
|
43
|
-
# @param [String] title the literal string of the expected title
|
|
44
|
-
# @param [Regexp] title the pattern string of the expected title
|
|
45
|
-
# @return [Nil]
|
|
46
|
-
# @raise exception if the title found does not match the title expected
|
|
47
16
|
def title_is(title)
|
|
48
17
|
define_method('has_title?') do
|
|
49
|
-
|
|
50
|
-
valid_title = title
|
|
51
|
-
|
|
18
|
+
sleep 1
|
|
19
|
+
valid_title = title =~ browser.title if title.kind_of?(Regexp)
|
|
20
|
+
valid_title = title == browser.title if title.kind_of?(String)
|
|
21
|
+
raise "\n\nExpected title: '#{title}'; Actual title: '#{browser.title}'" unless valid_title
|
|
52
22
|
valid_title
|
|
53
23
|
end
|
|
54
24
|
end
|
|
55
25
|
|
|
56
|
-
# This method allows for a look_for() method in definitions. The idea
|
|
57
|
-
# is that you can specify an object that should appear on a given page
|
|
58
|
-
# when that page appears.
|
|
59
|
-
#
|
|
60
|
-
# @param [Symbol] widget the friendly name of the object declaration
|
|
61
|
-
# @param [optional, Integer] timeout the time to wait for the object to appear
|
|
62
|
-
# @return [Boolean] true if object was found
|
|
63
26
|
def look_for(widget, timeout=5)
|
|
64
27
|
define_method('has_object?') do
|
|
65
28
|
if self.respond_to? "#{widget}_object"
|
|
@@ -69,283 +32,111 @@ module Symbiont
|
|
|
69
32
|
end
|
|
70
33
|
end
|
|
71
34
|
end
|
|
72
|
-
|
|
73
|
-
# Definition method for links. Methods for the following actions will
|
|
74
|
-
# be created:
|
|
75
|
-
# * reference a link (identifier_object, identifier_link)
|
|
76
|
-
# * check text of link (identifier_text)
|
|
77
|
-
# * click a link (identifier)
|
|
78
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
79
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
80
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
81
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
82
|
-
# @return [Object] instance of Symbiont::WebObjects::Link
|
|
83
|
-
def link(identifier, locator)
|
|
84
|
-
define_method("#{identifier}_object") do
|
|
85
|
-
@platform.get_link_for(locator.clone)
|
|
86
|
-
end
|
|
87
35
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
define_method("#{identifier}_text") do
|
|
91
|
-
@platform.get_link_text_for(locator.clone)
|
|
92
|
-
end
|
|
93
|
-
|
|
36
|
+
def paragraph(identifier, locator)
|
|
94
37
|
define_method(identifier) do
|
|
95
|
-
|
|
38
|
+
platform.paragraph_text_for(locator.clone)
|
|
96
39
|
end
|
|
97
40
|
|
|
98
|
-
|
|
99
|
-
@platform.check_link_for_existence(locator.clone)
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
|
|
103
|
-
|
|
104
|
-
define_method("#{identifier}_visible?") do
|
|
105
|
-
@platform.check_link_for_visibility(locator.clone)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
|
|
41
|
+
common_definition_methods(identifier, locator, 'paragraph_element')
|
|
109
42
|
end
|
|
110
43
|
|
|
111
|
-
|
|
112
|
-
# be created:
|
|
113
|
-
# * reference a button (identifier_object, identifier_button)
|
|
114
|
-
# * get text from button (identifier_text)
|
|
115
|
-
# * click a button (identifier)
|
|
116
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
117
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
118
|
-
# * check for enabled (identifier!, identifier_enabled?)
|
|
119
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
120
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
121
|
-
# @return [Object] instance of Symbiont::WebObjects::Button
|
|
122
|
-
def button(identifier, locator)
|
|
123
|
-
define_method("#{identifier}_object") do
|
|
124
|
-
@platform.get_button_for(locator.clone)
|
|
125
|
-
end
|
|
44
|
+
alias_method :p, :paragraph
|
|
126
45
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
define_method("#{identifier}_text") do
|
|
130
|
-
@platform.get_button_text_for(locator.clone)
|
|
131
|
-
end
|
|
132
|
-
|
|
46
|
+
def link(identifier, locator)
|
|
133
47
|
define_method(identifier) do
|
|
134
|
-
|
|
48
|
+
platform.click_link_for(locator.clone)
|
|
135
49
|
end
|
|
136
50
|
|
|
137
|
-
|
|
138
|
-
@platform.check_button_for_existence(locator.clone)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
|
|
142
|
-
|
|
143
|
-
define_method("#{identifier}_visible?") do
|
|
144
|
-
@platform.check_button_for_visibility(locator.clone)
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
|
|
148
|
-
|
|
149
|
-
define_method("#{identifier}_enabled?") do
|
|
150
|
-
@platform.check_button_for_enabled(locator.clone)
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
|
|
51
|
+
common_definition_methods(identifier, locator, 'link_element')
|
|
154
52
|
end
|
|
155
53
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
162
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
163
|
-
# * check for enabled (identifier!, identifier_enabled?)
|
|
164
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
165
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
166
|
-
# @return [Object] instance of Symbiont::WebObjects::TextField
|
|
167
|
-
def text_field(identifier, locator)
|
|
168
|
-
define_method("#{identifier}_object") do
|
|
169
|
-
@platform.get_text_field_for(locator.clone)
|
|
54
|
+
alias_method :a, :link
|
|
55
|
+
|
|
56
|
+
def button(identifier, locator)
|
|
57
|
+
define_method(identifier) do
|
|
58
|
+
platform.click_button_for(locator.clone)
|
|
170
59
|
end
|
|
171
60
|
|
|
172
|
-
|
|
61
|
+
common_definition_methods(identifier, locator, 'button_element')
|
|
62
|
+
end
|
|
173
63
|
|
|
64
|
+
def text_field(identifier, locator)
|
|
174
65
|
define_method(identifier) do
|
|
175
|
-
|
|
66
|
+
platform.get_text_field_value_for(locator.clone)
|
|
176
67
|
end
|
|
177
|
-
|
|
68
|
+
|
|
178
69
|
define_method("#{identifier}=") do |value|
|
|
179
|
-
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
define_method("#{identifier}_exists?") do
|
|
183
|
-
@platform.check_text_field_for_existence(locator.clone)
|
|
184
|
-
end
|
|
185
|
-
|
|
186
|
-
alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
|
|
187
|
-
|
|
188
|
-
define_method("#{identifier}_visible?") do
|
|
189
|
-
@platform.check_text_field_for_visibility(locator.clone)
|
|
70
|
+
platform.set_text_field_value_for(locator.clone, value)
|
|
190
71
|
end
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
define_method("#{identifier}_enabled?") do
|
|
195
|
-
@platform.check_text_field_for_enabled(locator.clone)
|
|
196
|
-
end
|
|
197
|
-
|
|
198
|
-
alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
|
|
72
|
+
|
|
73
|
+
common_definition_methods(identifier, locator, 'text_field_element')
|
|
199
74
|
end
|
|
200
75
|
|
|
201
|
-
# Definition method for select lists. Methods for the following actions
|
|
202
|
-
# will be created:
|
|
203
|
-
# * reference a checkbox (identifier_object, identifier_select_list)
|
|
204
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
205
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
206
|
-
# * check for enabled (identifier!, identifier_enabled?)
|
|
207
|
-
# * check for option (identifier_option?)
|
|
208
|
-
# * set selected value (identifier=)
|
|
209
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
210
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
211
|
-
# @return [Object] instance of Symbiont::WebObjects::SelectList
|
|
212
76
|
def select_list(identifier, locator)
|
|
213
|
-
define_method("#{identifier}_object") do
|
|
214
|
-
@platform.get_select_list_for(locator.clone)
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
alias_method "#{identifier}_select_list".to_sym, "#{identifier}_object".to_sym
|
|
218
|
-
|
|
219
77
|
define_method(identifier) do
|
|
220
|
-
|
|
78
|
+
platform.get_select_list_item_for(locator.clone)
|
|
221
79
|
end
|
|
222
80
|
|
|
223
81
|
define_method("#{identifier}_option?") do
|
|
224
|
-
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
define_method("#{identifier}=") do |value|
|
|
228
|
-
@platform.set_select_list_value_for(locator.clone, value)
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
define_method("#{identifier}_exists?") do
|
|
232
|
-
@platform.check_select_list_for_existence(locator.clone)
|
|
82
|
+
platform.get_select_list_value_for(locator.clone)
|
|
233
83
|
end
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
@platform.check_select_list_for_visibility(locator.clone)
|
|
84
|
+
|
|
85
|
+
define_method("#{identifier}_options?") do
|
|
86
|
+
object = self.send("#{identifier}_object")
|
|
87
|
+
(object && object.options) ? object.options.collect(&:text) : []
|
|
239
88
|
end
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
define_method("#{identifier}_enabled?") do
|
|
244
|
-
@platform.check_select_list_for_enabled(locator.clone)
|
|
89
|
+
|
|
90
|
+
define_method("#{identifier}=") do |value|
|
|
91
|
+
platform.set_select_list_value_for(locator.clone, value)
|
|
245
92
|
end
|
|
246
|
-
|
|
247
|
-
|
|
93
|
+
|
|
94
|
+
common_definition_methods(identifier, locator, 'select_list_element')
|
|
248
95
|
end
|
|
96
|
+
|
|
97
|
+
alias_method :select, :select_list
|
|
249
98
|
|
|
250
|
-
# Definition method for checkboxes. Methods for the following actions
|
|
251
|
-
# will be created:
|
|
252
|
-
# * reference a checkbox (identifier_object, identifier_checkbox)
|
|
253
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
254
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
255
|
-
# * check for enabled (identifier!, identifier_enabled?)
|
|
256
|
-
# * check for checked (identifier_checked?)
|
|
257
|
-
# * set checked state (check_identifier)
|
|
258
|
-
# * set unchecked state (uncheck_identifier)
|
|
259
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
260
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
261
|
-
# @return [Object] instance of Symbiont::WebObjects::CheckBox
|
|
262
99
|
def checkbox(identifier, locator)
|
|
263
|
-
define_method("#{identifier}_object") do
|
|
264
|
-
@platform.get_checkbox_for(locator.clone)
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
alias_method "#{identifier}_checkbox".to_sym, "#{identifier}_object".to_sym
|
|
268
|
-
|
|
269
100
|
define_method("check_#{identifier}") do
|
|
270
|
-
|
|
101
|
+
platform.check_checkbox_for(locator.clone)
|
|
271
102
|
end
|
|
272
103
|
|
|
273
104
|
define_method("uncheck_#{identifier}") do
|
|
274
|
-
|
|
105
|
+
platform.uncheck_checkbox_for(locator.clone)
|
|
275
106
|
end
|
|
276
107
|
|
|
277
108
|
define_method("#{identifier}_checked?") do
|
|
278
|
-
|
|
279
|
-
end
|
|
280
|
-
|
|
281
|
-
define_method("#{identifier}_exists?") do
|
|
282
|
-
@platform.check_checkbox_for_existence(locator.clone)
|
|
109
|
+
platform.check_checkbox_for_checked(locator.clone)
|
|
283
110
|
end
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
define_method("#{identifier}_visible?") do
|
|
288
|
-
@platform.check_checkbox_for_visibility(locator.clone)
|
|
289
|
-
end
|
|
290
|
-
|
|
291
|
-
alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
|
|
292
|
-
|
|
293
|
-
define_method("#{identifier}_enabled?") do
|
|
294
|
-
@platform.check_checkbox_for_enabled(locator.clone)
|
|
295
|
-
end
|
|
296
|
-
|
|
297
|
-
alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
|
|
111
|
+
|
|
112
|
+
common_definition_methods(identifier, locator, 'checkbox_element')
|
|
298
113
|
end
|
|
299
114
|
|
|
300
|
-
# Definition method for radios. Methods for the following actions will be created:
|
|
301
|
-
# * reference a radio (identifier_object, identifier_radio, identifier_radio_button)
|
|
302
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
303
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
304
|
-
# * check for enabled (identifier!, identifier_enabled?)
|
|
305
|
-
# * check for selected (identifier_set?, identifier_selected?)
|
|
306
|
-
# * set selected state (set_identifier, select_identifier)
|
|
307
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
308
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
309
|
-
# @return [Object] instance of Symbiont::WebObjects::Radio
|
|
310
115
|
def radio(identifier, locator)
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
end
|
|
314
|
-
|
|
315
|
-
alias_method "#{identifier}_radio".to_sym, "#{identifier}_object".to_sym
|
|
316
|
-
alias_method "#{identifier}_radio_button".to_sym, "#{identifier}_object".to_sym
|
|
116
|
+
#alias_method "#{identifier}_radio".to_sym, "#{identifier}_object".to_sym
|
|
117
|
+
#alias_method "#{identifier}_radio_button".to_sym, "#{identifier}_object".to_sym
|
|
317
118
|
|
|
318
119
|
define_method("#{identifier}_selected?") do
|
|
319
|
-
|
|
120
|
+
platform.check_radio_for_selected(locator.clone)
|
|
320
121
|
end
|
|
321
122
|
|
|
322
123
|
alias_method "#{identifier}_set?".to_sym, "#{identifier}_selected?".to_sym
|
|
323
124
|
|
|
324
125
|
define_method("select_#{identifier}") do
|
|
325
|
-
|
|
126
|
+
platform.select_radio_for(locator.clone)
|
|
326
127
|
end
|
|
327
128
|
|
|
328
129
|
alias_method "set_#{identifier}".to_sym, "select_#{identifier}".to_sym
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
@platform.check_radio_for_existence(locator.clone)
|
|
332
|
-
end
|
|
333
|
-
|
|
334
|
-
alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
|
|
335
|
-
|
|
336
|
-
define_method("#{identifier}_visible?") do
|
|
337
|
-
@platform.check_radio_for_visibility(locator.clone)
|
|
338
|
-
end
|
|
339
|
-
|
|
340
|
-
alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
|
|
341
|
-
|
|
342
|
-
define_method("#{identifier}_enabled?") do
|
|
343
|
-
@platform.check_radio_for_enabled(locator.clone)
|
|
344
|
-
end
|
|
345
|
-
|
|
346
|
-
alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
|
|
130
|
+
|
|
131
|
+
common_definition_methods(identifier, locator, 'radio_element')
|
|
347
132
|
end
|
|
348
|
-
|
|
133
|
+
|
|
134
|
+
alias_method :radio_button, :radio
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
349
140
|
# Definition method for tables. Methods for the following actions will be created:
|
|
350
141
|
# * reference a table (identifier_object, identifier_table)
|
|
351
142
|
# * check for existence (identifier?, identifier_exists?)
|
|
@@ -405,68 +196,42 @@ module Symbiont
|
|
|
405
196
|
end
|
|
406
197
|
end
|
|
407
198
|
|
|
408
|
-
# Definition method for div objects. Methods for the following actions will be created:
|
|
409
|
-
# * reference a div (identifier_object, identifier_div)
|
|
410
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
411
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
412
|
-
# * get text from div (identifier)
|
|
413
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
414
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
415
|
-
# @return [Object] instance of Symbiont::WebObjects::Div
|
|
416
199
|
def div(identifier, locator)
|
|
417
|
-
|
|
418
|
-
@platform.get_div_for(locator.clone)
|
|
419
|
-
end
|
|
420
|
-
|
|
421
|
-
alias_method "#{identifier}_div".to_sym, "#{identifier}_object".to_sym
|
|
422
|
-
|
|
423
|
-
define_method("#{identifier}_exists?") do
|
|
424
|
-
@platform.check_div_for_existence(locator.clone)
|
|
425
|
-
end
|
|
426
|
-
|
|
427
|
-
alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
|
|
428
|
-
|
|
429
|
-
define_method("#{identifier}_visible?") do
|
|
430
|
-
@platform.check_div_for_visibility(locator.clone)
|
|
431
|
-
end
|
|
432
|
-
|
|
433
|
-
alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
|
|
434
|
-
|
|
435
|
-
define_method("#{identifier}") do
|
|
436
|
-
@platform.get_div_text_for(locator.clone)
|
|
437
|
-
end
|
|
200
|
+
common_definition_methods(identifier, locator, 'div_element')
|
|
438
201
|
end
|
|
439
202
|
|
|
440
|
-
# Definition method for span objects. Methods for the following actions will be created:
|
|
441
|
-
# * reference a span (identifier_object, identifier_span)
|
|
442
|
-
# * check for existence (identifier?, identifier_exists?)
|
|
443
|
-
# * check for visibility (identifier_?, identifier_visible?)
|
|
444
|
-
# * get text from span (identifier)
|
|
445
|
-
# @param [Symbol] identifier the friendly name of the web object
|
|
446
|
-
# @param [optional, Hash] locator the key/values that identify the object
|
|
447
|
-
# @return [Object] instance of Symbiont::WebObjects::Span
|
|
448
203
|
def span(identifier, locator)
|
|
204
|
+
common_definition_methods(identifier, locator, 'span_element')
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def common_definition_methods(identifier, locator, method)
|
|
449
208
|
define_method("#{identifier}_object") do
|
|
450
|
-
|
|
209
|
+
platform.send(method, locator.clone)
|
|
451
210
|
end
|
|
452
|
-
|
|
453
|
-
alias_method "#{identifier}_span".to_sym, "#{identifier}_object".to_sym
|
|
454
|
-
|
|
211
|
+
|
|
455
212
|
define_method("#{identifier}_exists?") do
|
|
456
|
-
|
|
213
|
+
platform.send(method, locator.clone).exists?
|
|
457
214
|
end
|
|
458
|
-
|
|
459
|
-
alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
|
|
460
|
-
|
|
215
|
+
|
|
461
216
|
define_method("#{identifier}_visible?") do
|
|
462
|
-
|
|
217
|
+
platform.send(method, locator.clone).visible?
|
|
463
218
|
end
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
219
|
+
|
|
220
|
+
define_method("#{identifier}_enabled?") do
|
|
221
|
+
platform.send(method, locator.clone).enabled?
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
define_method("#{identifier}_text") do
|
|
225
|
+
platform.send(method, locator.clone).text
|
|
469
226
|
end
|
|
227
|
+
|
|
228
|
+
element = method[0..method.index("_") - 1]
|
|
229
|
+
|
|
230
|
+
alias_method "#{identifier}_#{element}".to_sym, "#{identifier}_object".to_sym
|
|
231
|
+
alias_method "#{identifier}?".to_sym, "#{identifier}_exists?".to_sym
|
|
232
|
+
alias_method "#{identifier}_?".to_sym, "#{identifier}_visible?".to_sym
|
|
233
|
+
alias_method "#{identifier}!".to_sym, "#{identifier}_enabled?".to_sym
|
|
470
234
|
end
|
|
235
|
+
|
|
471
236
|
end # module: Generators
|
|
472
237
|
end # module: Symbiont
|