symbiont 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -2,15 +2,34 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class Button < WebObject
|
5
|
-
|
6
|
-
def
|
7
|
-
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
include_platform_specifics_for(platform)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.usable_selectors_for_watir
|
12
|
+
super + [:value, :text, :src, :alt, :css]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.usable_selectors_for_selenium
|
16
|
+
super + [:value, :src, :alt]
|
17
|
+
end
|
18
|
+
|
19
|
+
def include_platform_specifics_for(platform)
|
20
|
+
super
|
21
|
+
if platform[:platform] == :selenium_webdriver
|
22
|
+
require 'symbiont/platform_selenium/web_objects/button'
|
23
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Button
|
24
|
+
end
|
8
25
|
end
|
9
|
-
|
26
|
+
|
10
27
|
end # class: Button
|
11
28
|
|
12
29
|
::Symbiont::WebObjects.class_for_type[:submit] = ::Symbiont::WebObjects::Button
|
13
30
|
::Symbiont::WebObjects.class_for_type[:button] = ::Symbiont::WebObjects::Button
|
31
|
+
::Symbiont::WebObjects.class_for_type[:image] = ::Symbiont::WebObjects::Button
|
32
|
+
::Symbiont::WebObjects.class_for_type[:reset] = ::Symbiont::WebObjects::Button
|
14
33
|
|
15
34
|
end # module: WebObjects
|
16
35
|
end # module: Symbiont
|
@@ -2,19 +2,33 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class CheckBox < WebObject
|
5
|
-
|
6
|
-
def
|
7
|
-
@web_object
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
include_platform_specifics_for(platform)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.usable_selectors_for_watir
|
12
|
+
super + [:value]
|
8
13
|
end
|
9
|
-
|
10
|
-
def
|
11
|
-
|
14
|
+
|
15
|
+
def self.usable_selectors_for_selenium
|
16
|
+
super + [:value]
|
12
17
|
end
|
13
|
-
|
14
|
-
def
|
15
|
-
|
18
|
+
|
19
|
+
def include_platform_specifics_for(platform)
|
20
|
+
super
|
21
|
+
if platform[:platform] == :watir_webdriver
|
22
|
+
require 'symbiont/platform_watir/web_objects/checkbox'
|
23
|
+
self.class.send :include, Symbiont::Platforms::WatirWebDriver::CheckBox
|
24
|
+
elsif platform[:platform] == :selenium_webdriver
|
25
|
+
require 'symbiont/platform_selenium/web_objects/checkbox'
|
26
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::CheckBox
|
27
|
+
else
|
28
|
+
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
29
|
+
end
|
16
30
|
end
|
17
|
-
|
31
|
+
|
18
32
|
end # class: CheckBox
|
19
33
|
|
20
34
|
::Symbiont::WebObjects.class_for_type[:checkbox] = ::Symbiont::WebObjects::CheckBox
|
@@ -2,7 +2,15 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class Div < WebObject
|
5
|
-
|
5
|
+
|
6
|
+
def self.usable_selectors_for_watir
|
7
|
+
super + [:text, :title]
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.usable_selectors_for_selenium
|
11
|
+
super + [:text, :title]
|
12
|
+
end
|
13
|
+
|
6
14
|
end # class: Div
|
7
15
|
|
8
16
|
::Symbiont::WebObjects.class_for_tag[:div] = ::Symbiont::WebObjects::Div
|
@@ -2,15 +2,36 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class Link < WebObject
|
5
|
-
|
6
|
-
def
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
include_platform_specifics_for(platform)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.usable_selectors_for_watir
|
7
12
|
super + [:href, :text, :title, :css]
|
8
13
|
end
|
9
14
|
|
10
|
-
def self.
|
15
|
+
def self.selector_mapping_for_watir
|
11
16
|
super.merge({:link => :text, :link_text => :text})
|
12
17
|
end
|
13
|
-
|
18
|
+
|
19
|
+
def self.usable_selectors_for_selenium
|
20
|
+
super + [:link, :link_text, :title]
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.selector_mapping_for_selenium
|
24
|
+
super.merge(:text => :link_text)
|
25
|
+
end
|
26
|
+
|
27
|
+
def include_platform_specifics_for(platform)
|
28
|
+
super
|
29
|
+
if platform[:platform] == :selenium_webdriver
|
30
|
+
require 'symbiont/platform_selenium/web_objects/link'
|
31
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Link
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
14
35
|
end # class: Link
|
15
36
|
|
16
37
|
::Symbiont::WebObjects.class_for_tag[:a] = ::Symbiont::WebObjects::Link
|
@@ -2,7 +2,33 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class Radio < WebObject
|
5
|
-
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
include_platform_specifics_for(platform)
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.usable_selectors_for_watir
|
12
|
+
super + [:value]
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.usable_selectors_for_selenium
|
16
|
+
super + [:value]
|
17
|
+
end
|
18
|
+
|
19
|
+
def include_platform_specifics_for(platform)
|
20
|
+
super
|
21
|
+
if platform[:platform] == :watir_webdriver
|
22
|
+
require 'symbiont/platform_watir/web_objects/radio'
|
23
|
+
self.class.send :include, Symbiont::Platforms::WatirWebDriver::Radio
|
24
|
+
elsif platform[:platform] == :selenium_webdriver
|
25
|
+
require 'symbiont/platform_selenium/web_objects/radio'
|
26
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Radio
|
27
|
+
else
|
28
|
+
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
6
32
|
end # class: Radio
|
7
33
|
|
8
34
|
::Symbiont::WebObjects.class_for_type[:radio] = ::Symbiont::WebObjects::Radio
|
@@ -2,69 +2,33 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class SelectList < WebObject
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
Object::Symbiont::WebObjects::Option.new(options[idx])
|
5
|
+
def initialize(web_object, platform)
|
6
|
+
@web_object = web_object
|
7
|
+
include_platform_specifics_for(platform)
|
9
8
|
end
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
# @return [array of Symbiont::WebObjects::Option]
|
14
|
-
def options
|
15
|
-
web_objects = []
|
16
|
-
options = @web_object.wd.find_elements(:xpath, option_xpath)
|
17
|
-
options.each do |opt|
|
18
|
-
web_objects << Object::Symbiont::WebObjects::Option.new(opt)
|
19
|
-
end
|
20
|
-
web_objects
|
9
|
+
|
10
|
+
def self.usable_selectors_for_watir
|
11
|
+
super + [:value, :text]
|
21
12
|
end
|
22
|
-
|
23
|
-
# Selects an option from the select list.
|
24
|
-
def select(value)
|
25
|
-
@web_object.select(value)
|
26
|
-
end
|
27
|
-
|
28
|
-
# Selects the option whose value attribute matches the provided string.
|
29
|
-
def select_value(value)
|
30
|
-
@web_object.select_value(value)
|
31
|
-
end
|
32
|
-
|
33
|
-
# This method returns an array of strings that contain the text of the
|
34
|
-
# currently selected options in a select list.
|
35
|
-
# @return [Array<String>]
|
36
|
-
def selected_options
|
37
|
-
@web_object.selected_options.map { |e| e.text }.compact
|
38
|
-
end
|
39
|
-
|
40
|
-
# This method returns an array of strings that contain the values of the
|
41
|
-
# currently selected options in a select list.
|
42
|
-
# @return [Array<String>]
|
43
|
-
def selected_values
|
44
|
-
@web_object.selected_options.map { |e| e.value }.compact
|
45
|
-
end
|
46
|
-
|
47
|
-
# This method returns true if any of the text or the lable of any option
|
48
|
-
# that is selected matches the provided value.
|
49
|
-
# @param [String, Regexp] value A value to check for
|
50
|
-
# @return [Boolean]
|
51
|
-
def selected?(value)
|
52
|
-
@web_object.selected? value
|
53
|
-
end
|
54
|
-
|
55
|
-
# This method checks to see if the select list has one or more options
|
56
|
-
# where the text or the label matches the provided value.
|
57
|
-
# @param [String, Regexp] value A value to check for.
|
58
|
-
# @return [Boolean]
|
59
|
-
def include?(value)
|
60
|
-
@web_object.include? value
|
61
|
-
end
|
62
|
-
|
13
|
+
|
63
14
|
protected
|
64
15
|
|
65
16
|
def option_xpath
|
66
17
|
".//child::option"
|
67
18
|
end
|
19
|
+
|
20
|
+
def include_platform_specifics_for(platform)
|
21
|
+
super
|
22
|
+
if platform[:platform] == :watir_webdriver
|
23
|
+
require 'symbiont/platform_watir/web_objects/select_list'
|
24
|
+
self.class.send :include, Symbiont::Platforms::WatirWebDriver::SelectList
|
25
|
+
elsif platform[:platform] == :selenium_webdriver
|
26
|
+
require 'symbiont/platform_selenium/web_objects/select_list'
|
27
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::SelectList
|
28
|
+
else
|
29
|
+
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
30
|
+
end
|
31
|
+
end
|
68
32
|
end # class: SelectList
|
69
33
|
|
70
34
|
::Symbiont::WebObjects.class_for_tag[:select] = ::Symbiont::WebObjects::SelectList
|
@@ -2,7 +2,15 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class Span < WebObject
|
5
|
-
|
5
|
+
|
6
|
+
def self.usable_selectors_for_watir
|
7
|
+
super + [:text, :title]
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.usable_selectors_for_selenium
|
11
|
+
super + [:text, :title]
|
12
|
+
end
|
13
|
+
|
6
14
|
end # class: Span
|
7
15
|
|
8
16
|
::Symbiont::WebObjects.class_for_tag[:span] = ::Symbiont::WebObjects::Span
|
@@ -3,17 +3,12 @@ module Symbiont
|
|
3
3
|
|
4
4
|
class Table < WebObject
|
5
5
|
include Enumerable
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# @return [Symbiont::WebObjects::TableRow]
|
11
|
-
def [](index)
|
12
|
-
index = find_by_title(index) if index.kind_of?(String)
|
13
|
-
return nil unless index
|
14
|
-
Object::Symbiont::WebObjects::TableRow.new(@web_object[index])
|
6
|
+
|
7
|
+
def initialize(web_object, platform)
|
8
|
+
@web_object = web_object
|
9
|
+
include_platform_specifics_for(platform)
|
15
10
|
end
|
16
|
-
|
11
|
+
|
17
12
|
# This method is an iterator that returns a TableRow object each time through
|
18
13
|
# the loop.
|
19
14
|
# @return [Symbiont::WebObjects::TableRow]
|
@@ -22,12 +17,7 @@ module Symbiont
|
|
22
17
|
yield self[index - 1]
|
23
18
|
end
|
24
19
|
end
|
25
|
-
|
26
|
-
# This method will return the number of rows in a table.
|
27
|
-
def rows
|
28
|
-
@web_object.wd.find_elements(:xpath, row_xpath).size
|
29
|
-
end
|
30
|
-
|
20
|
+
|
31
21
|
# Returns a reference to the first row web object of a table.
|
32
22
|
# @return [Symbiont::WebObjects::TableRow]
|
33
23
|
def first_row
|
@@ -45,13 +35,20 @@ module Symbiont
|
|
45
35
|
def row_xpath
|
46
36
|
".//child::tr"
|
47
37
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
38
|
+
|
39
|
+
def include_platform_specifics_for(platform)
|
40
|
+
super
|
41
|
+
if platform[:platform] == :watir_webdriver
|
42
|
+
require 'symbiont/platform_watir/web_objects/table'
|
43
|
+
self.class.send :include, Symbiont::Platforms::WatirWebDriver::Table
|
44
|
+
elsif platform[:platform] == :selenium_webdriver
|
45
|
+
require 'symbiont/platform_selenium/web_objects/table'
|
46
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::Table
|
47
|
+
else
|
48
|
+
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
49
|
+
end
|
53
50
|
end
|
54
|
-
|
51
|
+
|
55
52
|
end # class: Table
|
56
53
|
|
57
54
|
::Symbiont::WebObjects.class_for_tag[:table] = ::Symbiont::WebObjects::Table
|
@@ -2,7 +2,23 @@ module Symbiont
|
|
2
2
|
module WebObjects
|
3
3
|
|
4
4
|
class TableCell < WebObject
|
5
|
-
|
5
|
+
|
6
|
+
def initialize(web_object, platform)
|
7
|
+
@web_object = web_object
|
8
|
+
end
|
9
|
+
|
10
|
+
def enabled?
|
11
|
+
true
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.usable_selectors_for_watir
|
15
|
+
super + [:text]
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.usable_selectors_for_selenium
|
19
|
+
super + [:text]
|
20
|
+
end
|
21
|
+
|
6
22
|
end # class: TableCell
|
7
23
|
|
8
24
|
::Symbiont::WebObjects.class_for_tag[:td] = ::Symbiont::WebObjects::TableCell
|
@@ -3,17 +3,12 @@ module Symbiont
|
|
3
3
|
|
4
4
|
class TableRow < WebObject
|
5
5
|
include Enumerable
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
# @return [Symbiont::WebObjects::TableCell]
|
11
|
-
def [](index)
|
12
|
-
index = find_by_title(index) if index.kind_of?(String)
|
13
|
-
return nil unless index
|
14
|
-
Object::Symbiont::WebObjects::TableCell.new(@web_object[index])
|
6
|
+
|
7
|
+
def initialize(web_object, platform)
|
8
|
+
@web_object = web_object
|
9
|
+
include_platform_specifics_for(platform)
|
15
10
|
end
|
16
|
-
|
11
|
+
|
17
12
|
# This method is an iterator that returns a TableCell object each time through
|
18
13
|
# the loop.
|
19
14
|
# @return [Symbiont::WebObjects::TableCell]
|
@@ -22,27 +17,25 @@ module Symbiont
|
|
22
17
|
yield self[index - 1]
|
23
18
|
end
|
24
19
|
end
|
25
|
-
|
26
|
-
# This method returns the number of columns in a table object.
|
27
|
-
def columns
|
28
|
-
@web_object.wd.find_elements(:xpath, cell_xpath).size
|
29
|
-
end
|
30
|
-
|
20
|
+
|
31
21
|
protected
|
32
22
|
|
33
23
|
def cell_xpath
|
34
24
|
".//child::td|th"
|
35
25
|
end
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
26
|
+
|
27
|
+
def include_platform_specifics_for(platform)
|
28
|
+
super
|
29
|
+
if platform[:platform] == :watir_webdriver
|
30
|
+
require 'symbiont/platform_watir/web_objects/table_row'
|
31
|
+
self.class.send :include, Symbiont::Platforms::WatirWebDriver::TableRow
|
32
|
+
elsif platform[:platform] == :selenium_webdriver
|
33
|
+
require 'symbiont/platform_selenium/web_objects/table_row'
|
34
|
+
self.class.send :include, Symbiont::Platforms::SeleniumWebDriver::TableRow
|
35
|
+
else
|
36
|
+
raise ArgumentError, "The platform #{platform[:platform]} appears to be unsupported."
|
37
|
+
end
|
44
38
|
end
|
45
|
-
|
46
39
|
end # class: TableRow
|
47
40
|
|
48
41
|
::Symbiont::WebObjects.class_for_tag[:tr] = ::Symbiont::WebObjects::TableRow
|